From 360b47e490efff7ff5f45b3fc4d48e76bc01ef48 Mon Sep 17 00:00:00 2001 From: jojo Date: Sat, 26 Sep 2020 21:36:08 +0200 Subject: [PATCH] Remove Missile.count() --- src/de/steamwar/misslewars/items/Missile.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/de/steamwar/misslewars/items/Missile.java b/src/de/steamwar/misslewars/items/Missile.java index 888d035..3f02abf 100644 --- a/src/de/steamwar/misslewars/items/Missile.java +++ b/src/de/steamwar/misslewars/items/Missile.java @@ -50,7 +50,6 @@ import java.util.Objects; public class Missile extends SpecialItem { private static final World world = new BukkitWorld(Bukkit.getWorlds().get(0)); - private static final BlockType TNT = BlockTypes.TNT; private static final int GRAPH_SIZE = 7; private final Clipboard clipboard; @@ -76,7 +75,9 @@ public class Missile extends SpecialItem { lore(lore, strings, 2, " §7Speed"); lore(lore, strings, 3, " §7Size"); - tntCount = count(); + EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1); + BlockTypeMask blockTypeMask = new BlockTypeMask(clipboard, BlockTypes.TNT); + tntCount = e.countBlocks(clipboard.getRegion(), blockTypeMask); lore.add("§7TNT §8: §e" + tntCount); item = createItem(itemType, "§c" + name, 1, lore, false); @@ -116,16 +117,6 @@ public class Missile extends SpecialItem { return st.toString(); } - private int count() { - try { - EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1); - BlockTypeMask blockTypeMask = new BlockTypeMask(clipboard, TNT); - return e.countBlocks(clipboard.getRegion(), blockTypeMask); - } catch (Exception e) { - return 0; - } - } - @Override public ItemStack getItem() { return item;