SteamWar/MissileWars
Archiviert
13
0

Remove Missile.count()

Dieser Commit ist enthalten in:
jojo 2020-09-26 21:36:08 +02:00
Ursprung 4cb0242974
Commit 360b47e490

Datei anzeigen

@ -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;