SteamWar/MissileWars
Archiviert
13
0

Fix Missle Info

Dieser Commit ist enthalten in:
jojo 2020-09-18 21:07:00 +02:00
Ursprung 8328be9bfe
Commit a19a277e88

Datei anzeigen

@ -25,41 +25,35 @@ import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.function.mask.BlockTypeMask;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import de.steamwar.misslewars.MissileWars;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.logging.Level;
public class Missile extends SpecialItem {
private static final World world = new BukkitWorld(Bukkit.getWorlds().get(0));
private static Set<BaseBlock> tnt = new HashSet<>();
static {
BlockState blockState = BlockTypes.TNT.getDefaultState();
if (blockState != null) {
tnt.add(blockState.toBaseBlock());
}
Bukkit.getLogger().log(Level.SEVERE, tnt.toString());
}
private static final BlockType TNT = BlockTypes.TNT;
private final Clipboard clipboard;
private final ItemStack item;
@ -94,9 +88,6 @@ public class Missile extends SpecialItem {
lore.add("§7TNT §8: §e" + count());
} catch (Exception e) {
Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e.getCause());
for (Player p : Bukkit.getOnlinePlayers()) {
p.sendMessage(Arrays.toString(e.getStackTrace()));
}
lore.add("§7TNT §8: §e?");
}
@ -139,10 +130,9 @@ public class Missile extends SpecialItem {
}
private int count() {
if (tnt.isEmpty()) {
return 0;
}
return WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1).countBlocks(clipboard.getRegion(), tnt);
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1);
BlockTypeMask blockTypeMask = new BlockTypeMask(e, TNT);
return e.countBlocks(clipboard.getRegion(), blockTypeMask);
}
@Override