From e0d12f467abc90a1c3cb4e6fe777e113259e7772 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 6 Sep 2019 00:27:50 +0200 Subject: [PATCH] Removed unused imports --- .../SlimefunItem/items/SoulboundRune.java | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/items/SoulboundRune.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/items/SoulboundRune.java index d25333b93..326d33a39 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/items/SoulboundRune.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/items/SoulboundRune.java @@ -1,15 +1,19 @@ package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Item; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import me.mrCookieSlime.Slimefun.SlimefunPlugin; import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.SlimefunItems; import me.mrCookieSlime.Slimefun.Objects.Category; @@ -17,13 +21,8 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem; import me.mrCookieSlime.Slimefun.Objects.handlers.ItemDropHandler; import me.mrCookieSlime.Slimefun.Setup.Messages; import me.mrCookieSlime.Slimefun.Setup.SlimefunManager; -import me.mrCookieSlime.Slimefun.SlimefunPlugin; import me.mrCookieSlime.Slimefun.api.Slimefun; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - public class SoulboundRune extends SimpleSlimefunItem { public SoulboundRune(Category category, ItemStack item, String id, RecipeType type, ItemStack[] recipe) { @@ -35,9 +34,12 @@ public class SoulboundRune extends SimpleSlimefunItem { return (e, p, i) -> { ItemStack item = i.getItemStack(); if (SlimefunManager.isItemSimiliar(item, SlimefunItems.RUNE_SOULBOUND, true)) { - if (!Slimefun.hasUnlocked(p, SlimefunItems.RUNE_SOULBOUND, true)) return true; - - Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunPlugin.instance, () -> { + + if (!Slimefun.hasUnlocked(p, SlimefunItems.RUNE_SOULBOUND, true)) { + return true; + } + + Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunPlugin.instance, () -> { // Being sure the entity is still valid and not picked up or whatsoever. if (!i.isValid()) return; @@ -46,6 +48,7 @@ public class SoulboundRune extends SimpleSlimefunItem { entity -> entity instanceof Item && !SlimefunManager.isItemSoulbound(((Item) entity).getItemStack()) && !SlimefunManager.isItemSimiliar(((Item) entity).getItemStack(), SlimefunItems.RUNE_SOULBOUND, true) ); + if (entites.isEmpty()) return; Entity entity = entites.stream().findFirst().get(); @@ -56,10 +59,7 @@ public class SoulboundRune extends SimpleSlimefunItem { e.setCancelled(true); ItemMeta enchMeta = ench.getItemMeta(); - - List lore; - if (enchMeta.hasLore()) lore = enchMeta.getLore(); - else lore = new ArrayList<>(); + List lore = enchMeta.hasLore() ? enchMeta.getLore(): new ArrayList<>(); // This lightning is just an effect, it deals no damage. l.getWorld().strikeLightningEffect(l); @@ -83,10 +83,12 @@ public class SoulboundRune extends SimpleSlimefunItem { Messages.local.sendTranslation(p, "messages.soulbound-rune.success", true); } }, 10L); - } else { + } + else { Messages.local.sendTranslation(p, "messages.soulbound-rune.fail", true); } }, 20L); + return true; } return false;