From 0b326387793f65b4077f448ebd53276eed643717 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 25 Mar 2021 10:44:48 +0100 Subject: [PATCH] Fix pr stuff --- BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java | 9 +++------ .../src/de/steamwar/bausystem/commands/CommandGUI.java | 6 +----- .../bausystem/commands/CommandRedstoneTester.java | 5 +++++ .../de/steamwar/bausystem/world/RedstoneListener.java | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 427072b..9e26020 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -23,6 +23,7 @@ import de.steamwar.bausystem.commands.*; import de.steamwar.bausystem.world.*; import de.steamwar.core.CommandRemover; import de.steamwar.core.Core; +import de.steamwar.core.VersionedRunnable; import de.steamwar.scoreboard.SWScoreboard; import de.steamwar.sql.SteamwarUser; import org.bukkit.Bukkit; @@ -99,9 +100,7 @@ public class BauSystem extends JavaPlugin implements Listener { getCommand("script").setExecutor(new CommandScript()); getCommand("simulator").setExecutor(new CommandSimulator()); getCommand("simulator").setTabCompleter(new CommandSimulatorTabCompleter()); - if (Core.getVersion() >= 15) { - getCommand("redstonetester").setExecutor(new CommandRedstoneTester()); - } + getCommand("redstonetester").setExecutor(new CommandRedstoneTester()); getCommand("gui").setExecutor(new CommandGUI()); Bukkit.getPluginManager().registerEvents(this, this); @@ -112,9 +111,7 @@ public class BauSystem extends JavaPlugin implements Listener { Bukkit.getPluginManager().registerEvents(new TNTSimulatorListener(), this); Bukkit.getPluginManager().registerEvents(new CommandGUI(), this); Bukkit.getPluginManager().registerEvents(new DetonatorListener(), this); - if (Core.getVersion() >= 15) { - Bukkit.getPluginManager().registerEvents(new RedstoneListener(), this); - } + VersionedRunnable.call(new VersionedRunnable(() -> Bukkit.getPluginManager().registerEvents(new RedstoneListener(), this), 15)); new AFKStopper(); autoShutdown = Bukkit.getScheduler().runTaskLater(this, Bukkit::shutdown, 1200); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java index c9d948a..5038659 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java @@ -81,11 +81,7 @@ public class CommandGUI implements CommandExecutor, Listener { if (Welt.noPermission(player, Permission.build)) return; player.closeInventory(); - if (Core.getVersion() >= 15) { - player.performCommand("redstonetester"); - } else { - player.sendMessage(BauSystem.PREFIX + "Der RedstoneTester ist nicht in der 1.12 verfügbar"); - } + player.performCommand("redstonetester"); }); inv.setItem(40, getMaterial("WOODEN_AXE", "WOOD_AXE"), "§eWorldedit Axt", getNoPermsLore(Arrays.asList("§8//§7wand"), player, "§cDu hast keine Worldeditrechte", Permission.worldedit), false, clickType -> { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandRedstoneTester.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandRedstoneTester.java index fd78ee8..356e70f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandRedstoneTester.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandRedstoneTester.java @@ -24,6 +24,7 @@ import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.world.RedstoneListener; import de.steamwar.bausystem.world.Welt; +import de.steamwar.core.Core; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -44,6 +45,10 @@ public class CommandRedstoneTester implements CommandExecutor { if (!(commandSender instanceof Player)) return false; Player player = (Player) commandSender; + if (Core.getVersion() >= 15) { + player.sendMessage(BauSystem.PREFIX + "Der RedstoneTester ist nicht in der 1.12 verfügbar"); + return false; + } if (!permissionCheck(player)) { return false; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/RedstoneListener.java b/BauSystem_Main/src/de/steamwar/bausystem/world/RedstoneListener.java index 7179592..a04d188 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/RedstoneListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/RedstoneListener.java @@ -100,7 +100,7 @@ public class RedstoneListener implements Listener { private boolean validBlock(Player player, BlockData block) { if (block instanceof Powerable) return true; if (block instanceof Piston) return true; - player.sendMessage(BauSystem.PREFIX + "Unbekannte Position"); + player.sendMessage(BauSystem.PREFIX + "§cUnbekannte Position"); return false; }