Add CommandSimulator
Add TNTSimulator
Dieser Commit ist enthalten in:
Ursprung
549efa9801
Commit
9a1c900a71
@ -36,7 +36,7 @@ public class CommandSimulator implements CommandExecutor {
|
||||
player.sendMessage("§8/§esimulator §8- §7Öffnet die Simulations GUI");
|
||||
player.sendMessage("§8/§esimulator start §8- §7Startet die Simulation");
|
||||
player.sendMessage("§8/§esimulator wand §8- §7Legt dir den Simulatorstab ins Inventar");
|
||||
player.sendMessage("§8/§esimulator delete §8- §7Lösche alle TNT");
|
||||
player.sendMessage("§8/§esimulator delete §8- §7Löscht alle TNT");
|
||||
}
|
||||
|
||||
private boolean permissionCheck(Player player) {
|
||||
|
@ -47,12 +47,11 @@ public class TNTSimulator {
|
||||
private static final Vector NY_VECTOR = new Vector(0, -0.0625, 0);
|
||||
private static final Vector Z_VECTOR = new Vector(0, 0, 0.0625);
|
||||
private static final Vector NZ_VECTOR = new Vector(0, 0, -0.0625);
|
||||
private static final List<String> LORE = Collections.singletonList("§7Zum ändern klicken");
|
||||
private static final List<String> LORE = Collections.singletonList("§eZum ändern klicken");
|
||||
private static final List<TNTSpawn> EMPTY = new ArrayList<>();
|
||||
|
||||
static final Map<Player, TNTSimulator> TNT_SIMULATOR_MAP = new HashMap<>();
|
||||
private final Set<TNTSpawn> TNT_SPAWNS = new HashSet<>();
|
||||
private int number = 0;
|
||||
|
||||
public static final ItemStack WAND = new SWItem(Material.BLAZE_ROD, "§eKanonensimulator", Arrays.asList("§eRechtsklick Block §8- §7Füge einen TNT hinzu", "§eRechtsklick Luft §8- §7Öffne den Simulator", "§eLinksklick §8- §7Starte die Simulation"), false, null).getItemStack();
|
||||
|
||||
@ -75,7 +74,7 @@ public class TNTSimulator {
|
||||
lore.add("§7X§8: §e" + tntSpawn.getPosition().getX());
|
||||
lore.add("§7Y§8: §e" + tntSpawn.getPosition().getY());
|
||||
lore.add("§7Z§8: §e" + tntSpawn.getPosition().getZ());
|
||||
swListEntryList.add(new SWListInv.SWListEntry<>(new SWItem(Material.TNT, "§eTNT" + (!tntSpawn.getName().isEmpty() ? " §8- §e" + tntSpawn.getName() : ""), lore, false, null), tntSpawn));
|
||||
swListEntryList.add(new SWListInv.SWListEntry<>(new SWItem(Material.TNT, "§eTNT", lore, false, null), tntSpawn));
|
||||
});
|
||||
swListEntryList.sort(Comparator.comparing(SWListInv.SWListEntry::getObject));
|
||||
|
||||
@ -96,7 +95,7 @@ public class TNTSimulator {
|
||||
static void editTNT(Player player, TNTSpawn tntSpawn) {
|
||||
TNTSimulator tntSimulator = get(player);
|
||||
|
||||
SWInventory swInventory = new SWInventory(player, 54, "TNT" + (!tntSpawn.getName().isEmpty() ? " - " + tntSpawn.getName() : ""));
|
||||
SWInventory swInventory = new SWInventory(player, 54, "TNT");
|
||||
swInventory.setItem(49, new SWItem(Material.REDSTONE_BLOCK, "§cZurück", clickType -> {
|
||||
openSimulator(player);
|
||||
}));
|
||||
@ -107,16 +106,6 @@ public class TNTSimulator {
|
||||
openSimulator(player);
|
||||
}));
|
||||
|
||||
// tnt Name
|
||||
swInventory.setItem(45, new SWItem(Material.NAME_TAG, "§eName", clickType -> {
|
||||
SWAnvilInv tntSimulatorAnvil = new SWAnvilInv(player, "Name", tntSpawn.getName());
|
||||
tntSimulatorAnvil.setCallback(s -> {
|
||||
tntSpawn.setName(s);
|
||||
editTNT(player, tntSpawn);
|
||||
});
|
||||
tntSimulatorAnvil.open();
|
||||
}));
|
||||
|
||||
// Change Count of spawned TNT
|
||||
swInventory.setItem(10, new SWItem(SWItem.getDye(10), "§7+1", clickType -> {
|
||||
tntSpawn.setCount(tntSpawn.getCount() + 1);
|
||||
@ -265,7 +254,6 @@ public class TNTSimulator {
|
||||
|
||||
static void addTNT(Player player, TNTSpawn tntSpawn) {
|
||||
TNTSimulator tntSimulator = TNT_SIMULATOR_MAP.computeIfAbsent(player, player1 -> new TNTSimulator());
|
||||
if (tntSpawn.name.isEmpty()) tntSpawn.name = (++tntSimulator.number) + "";
|
||||
tntSimulator.TNT_SPAWNS.add(tntSpawn);
|
||||
}
|
||||
|
||||
@ -361,7 +349,6 @@ public class TNTSimulator {
|
||||
|
||||
private static final World WORLD = Bukkit.getWorlds().get(0);
|
||||
|
||||
private String name = "";
|
||||
private final Vector position;
|
||||
private int fuseTicks = 80;
|
||||
private int count = 1;
|
||||
@ -384,14 +371,6 @@ public class TNTSimulator {
|
||||
});
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Vector getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren