From dbcadcfa0c729feb0c8008c72f3699e117007e09 Mon Sep 17 00:00:00 2001 From: jojo Date: Sun, 14 Feb 2021 11:24:06 +0100 Subject: [PATCH] Fix pr stuff --- .../de/steamwar/bausystem/commands/CommandSimulator.java | 4 ++-- .../src/de/steamwar/bausystem/world/TNTSimulator.java | 8 ++------ .../de/steamwar/bausystem/world/TNTSimulatorListener.java | 1 - 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSimulator.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSimulator.java index 73771ac..8a9f47d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSimulator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSimulator.java @@ -33,9 +33,9 @@ import org.bukkit.entity.Player; public class CommandSimulator implements CommandExecutor { private void help(Player player) { - player.sendMessage("§8/§esimulator §8- §7Öffnet die Simulations GUI"); + player.sendMessage("§8/§esimulator §8- §7Öffnet das Simulations GUI"); player.sendMessage("§8/§esimulator start §8- §7Startet die Simulation"); - player.sendMessage("§8/§esimulator wand §8- §7Legt den Simulator ins Inventar"); + player.sendMessage("§8/§esimulator wand §8- §7Legt den Simulatorstab ins Inventar"); } private boolean permissionCheck(Player player) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/TNTSimulator.java b/BauSystem_Main/src/de/steamwar/bausystem/world/TNTSimulator.java index b59b814..5710297 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/TNTSimulator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/TNTSimulator.java @@ -32,13 +32,11 @@ import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.entity.TNTPrimed; import org.bukkit.inventory.ItemStack; -import org.bukkit.scheduler.BukkitTask; import org.bukkit.util.Consumer; import org.bukkit.util.Vector; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; public class TNTSimulator { @@ -318,15 +316,13 @@ public class TNTSimulator { } }); AtomicInteger currentTick = new AtomicInteger(0); - AtomicReference taskCanceler = new AtomicReference<>(() -> {}); - BukkitTask bukkitTask = Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), () -> { + Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), bukkitTask -> { int tick = currentTick.get(); spawnRandomList(first.getOrDefault(tick, EMPTY)); spawnRandomList(second.getOrDefault(tick, EMPTY)); - if (tick > lastTick.get()) taskCanceler.get().run(); + if (tick > lastTick.get()) bukkitTask.cancel(); currentTick.incrementAndGet(); }, 1, 1); - taskCanceler.set(bukkitTask::cancel); } private void spawnRandomList(List tntSpawns) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/TNTSimulatorListener.java b/BauSystem_Main/src/de/steamwar/bausystem/world/TNTSimulatorListener.java index 80ca456..e0af211 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/TNTSimulatorListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/TNTSimulatorListener.java @@ -26,7 +26,6 @@ import de.steamwar.bausystem.Permission; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.util.Vector;