Fix pr stuff
Dieser Commit ist enthalten in:
Ursprung
bcb964fdb4
Commit
de28cc9c1d
@ -50,6 +50,7 @@ public class TNTSimulator {
|
|||||||
|
|
||||||
static final Map<Player, TNTSimulator> TNT_SIMULATOR_MAP = new HashMap<>();
|
static final Map<Player, TNTSimulator> TNT_SIMULATOR_MAP = new HashMap<>();
|
||||||
private final Set<TNTSpawn> TNT_SPAWNS = new HashSet<>();
|
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();
|
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();
|
||||||
|
|
||||||
@ -84,8 +85,8 @@ public class TNTSimulator {
|
|||||||
openSimulator(player);
|
openSimulator(player);
|
||||||
}));
|
}));
|
||||||
swListInv.setItem(47, new SWItem(Material.FLINT_AND_STEEL, "§eSimulation starten", clickType -> {
|
swListInv.setItem(47, new SWItem(Material.FLINT_AND_STEEL, "§eSimulation starten", clickType -> {
|
||||||
startSimulation(player);
|
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
|
startSimulation(player);
|
||||||
}));
|
}));
|
||||||
swListInv.open();
|
swListInv.open();
|
||||||
}
|
}
|
||||||
@ -108,7 +109,6 @@ public class TNTSimulator {
|
|||||||
swInventory.setItem(45, new SWItem(Material.NAME_TAG, "§eName", clickType -> {
|
swInventory.setItem(45, new SWItem(Material.NAME_TAG, "§eName", clickType -> {
|
||||||
SWAnvilInv tntSimulatorAnvil = new SWAnvilInv(player, "Name", tntSpawn.getName());
|
SWAnvilInv tntSimulatorAnvil = new SWAnvilInv(player, "Name", tntSpawn.getName());
|
||||||
tntSimulatorAnvil.setCallback(s -> {
|
tntSimulatorAnvil.setCallback(s -> {
|
||||||
if (s.startsWith("»")) s = s.substring(1);
|
|
||||||
tntSpawn.setName(s);
|
tntSpawn.setName(s);
|
||||||
editTNT(player, tntSpawn);
|
editTNT(player, tntSpawn);
|
||||||
});
|
});
|
||||||
@ -262,7 +262,9 @@ public class TNTSimulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void addTNT(Player player, TNTSpawn tntSpawn) {
|
static void addTNT(Player player, TNTSpawn tntSpawn) {
|
||||||
TNT_SIMULATOR_MAP.computeIfAbsent(player, player1 -> new TNTSimulator()).TNT_SPAWNS.add(tntSpawn);
|
TNTSimulator tntSimulator = TNT_SIMULATOR_MAP.computeIfAbsent(player, player1 -> new TNTSimulator());
|
||||||
|
if (tntSpawn.name.isEmpty()) tntSpawn.name = (++tntSimulator.number) + "";
|
||||||
|
tntSimulator.TNT_SPAWNS.add(tntSpawn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String active(boolean b) {
|
private static String active(boolean b) {
|
||||||
|
@ -47,8 +47,12 @@ public class TNTSimulatorListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
if (event.getItem() == null) return;
|
if (event.getItem() == null) {
|
||||||
if (!event.getItem().isSimilar(WAND)) return;
|
return;
|
||||||
|
}
|
||||||
|
if (!event.getItem().isSimilar(WAND)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if (!permissionCheck(event.getPlayer())) {
|
if (!permissionCheck(event.getPlayer())) {
|
||||||
return;
|
return;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren