SteamWar/BauSystem
Archiviert
13
0
Dieser Commit ist enthalten in:
jojo 2021-01-31 13:29:39 +01:00
Ursprung a219bfc7b0
Commit 4f1307cc8d

Datei anzeigen

@ -50,7 +50,7 @@ public class TNTSimulator {
static final Map<Player, TNTSimulator> TNT_SIMULATOR_MAP = new HashMap<>();
private final Set<TNTSpawn> TNT_SPAWNS = new HashSet<>();
public static final ItemStack WAND = new SWItem(Material.TRIPWIRE_HOOK, "§eKanonen Simulator", 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();
public static final ItemStack WAND = new SWItem(Material.TRIPWIRE_HOOK, "§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();
public static TNTSimulator get(Player player) {
return TNT_SIMULATOR_MAP.computeIfAbsent(player, p -> new TNTSimulator());
@ -62,15 +62,15 @@ public class TNTSimulator {
List<SWListInv.SWListEntry<TNTSpawn>> swListEntryList = new ArrayList<>();
tntSimulator.TNT_SPAWNS.forEach(tntSpawn -> {
List<String> lore = new ArrayList<>();
lore.add("§7Klicken zum einstellen");
lore.add("§7Klicken zum Konfigurieren");
lore.add("");
lore.add("§eTNT-Anzahl§8: §7" + tntSpawn.getCount());
lore.add("§eTick§8: §7" + tntSpawn.getTickOffset());
lore.add("§eFuse-Tick§8: §7" + tntSpawn.getFuseTicks());
lore.add("§7TNT-Anzahl§8: §e" + tntSpawn.getCount());
lore.add("§7Tick§8: §e" + tntSpawn.getTickOffset());
lore.add("§7Fuse-Tick§8: §e" + tntSpawn.getFuseTicks());
lore.add("");
lore.add("§eX§8: §7" + tntSpawn.getPosition().getX());
lore.add("§eY§8: §7" + tntSpawn.getPosition().getY());
lore.add("§eZ§8: §7" + tntSpawn.getPosition().getZ());
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.sort(Comparator.comparing(SWListInv.SWListEntry::getObject));
@ -82,20 +82,6 @@ public class TNTSimulator {
tntSimulator.TNT_SPAWNS.clear();
openSimulator(player);
}));
swListInv.setItem(49, new SWItem(Material.TNT, "§aNeues TNT", clickType -> {
Vector vector = player.getLocation().toVector().multiply(16);
vector.setX((int) vector.getX());
vector.setY((int) vector.getY());
vector.setZ((int) vector.getZ());
vector.multiply(0.0625);
TNTSpawn tntSpawn = new TNTSpawn(vector);
if (tntSimulator.TNT_SPAWNS.contains(tntSpawn)) {
return;
}
tntSimulator.TNT_SPAWNS.add(tntSpawn);
editTNT(player, tntSpawn);
}));
swListInv.setItem(47, new SWItem(Material.FLINT_AND_STEEL, "§eSimulation starten", clickType -> {
startSimulation(player);
player.closeInventory();
@ -271,16 +257,11 @@ public class TNTSimulator {
}
static void startSimulation(Player player) {
if (TNT_SIMULATOR_MAP.containsKey(player)) {
TNT_SIMULATOR_MAP.get(player).start();
}
TNT_SIMULATOR_MAP.getOrDefault(player, new TNTSimulator()).start();
}
static void addTNT(Player player, TNTSpawn tntSpawn) {
if (!TNT_SIMULATOR_MAP.containsKey(player)) {
TNT_SIMULATOR_MAP.put(player, new TNTSimulator());
}
TNT_SIMULATOR_MAP.get(player).TNT_SPAWNS.add(tntSpawn);
TNT_SIMULATOR_MAP.computeIfAbsent(player, player1 -> new TNTSimulator()).TNT_SPAWNS.add(tntSpawn);
}
private static String active(boolean b) {
@ -364,7 +345,7 @@ public class TNTSimulator {
private static final World WORLD = Bukkit.getWorlds().get(0);
private String name = "";
private Vector position;
private final Vector position;
private int fuseTicks = 80;
private int count = 1;
private int tickOffset = 0;
@ -398,10 +379,6 @@ public class TNTSimulator {
return position;
}
public void setPosition(Vector position) {
this.position = position;
}
public int getFuseTicks() {
return fuseTicks;
}