From ea45eb1942878664ee362ec6d69d03d380fd6e49 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 8 Mar 2020 08:22:34 +0100 Subject: [PATCH] Hotfixing AutoLoader spam messages due to wrong handling --- .../bausystem/world/AutoLoader_15.java | 1 - .../bausystem/commands/CommandSlow.java | 48 +++++++++++++++++++ .../steamwar/bausystem/world/AutoLoader.java | 7 +++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSlow.java diff --git a/BauSystem_15/src/de/steamwar/bausystem/world/AutoLoader_15.java b/BauSystem_15/src/de/steamwar/bausystem/world/AutoLoader_15.java index cd19878..a227145 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/world/AutoLoader_15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/world/AutoLoader_15.java @@ -20,7 +20,6 @@ class AutoLoader_15 { return true; } - @SuppressWarnings("deprecation") static void onPlayerInteract(IAutoLoader loader, PlayerInteractEvent event){ loader.print("§cDer AutoLoader ist in der 1.14 noch nicht fertig implementiert", false); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSlow.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSlow.java new file mode 100644 index 0000000..4eb2adc --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSlow.java @@ -0,0 +1,48 @@ +package de.steamwar.bausystem.commands; + +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.Permission; +import de.steamwar.bausystem.world.Welt; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class CommandSlow implements CommandExecutor { + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if(!(sender instanceof Player)) + return false; + Player player = (Player) sender; + + if(args.length == 0){ + player.sendMessage(BauSystem.PREFIX + "§8/§7slow §8[§eTPS§8]"); + return false; + } + + if(Welt.noPermission(player, Permission.world)){ + player.sendMessage(BauSystem.PREFIX + "§cDu darst hier die Geschwindigkeit nicht verstellen"); + return false; + } + + float tps; + try{ + tps = Float.parseFloat(args[0]); + }catch(NumberFormatException e){ + player.sendMessage(BauSystem.PREFIX + "§cDu solltest eine Zahl angeben..."); + return false; + } + + if(tps > 20){ + player.sendMessage(BauSystem.PREFIX + "§cTut mir leid, aber das ist nicht möglich (TPS > 20)"); + return false; + } + + if(tps == 20){ + + } + + return false; + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/AutoLoader.java b/BauSystem_Main/src/de/steamwar/bausystem/world/AutoLoader.java index 0873c6a..4b8672e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/AutoLoader.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/AutoLoader.java @@ -140,6 +140,9 @@ public class AutoLoader extends IAutoLoader implements Listener { return; switch(Core.getVersion()){ + case 15: + AutoLoader_15.onPlayerInteract(this, event); + break; default: AutoLoader_12.onPlayerInteract(this, event); } @@ -182,6 +185,8 @@ public class AutoLoader extends IAutoLoader implements Listener { @Override boolean setRedstone(Location location, boolean active){ switch(Core.getVersion()){ + case 15: + return AutoLoader_15.setRedstone(location, active); default: return AutoLoader_12.setRedstone(location, active); } @@ -211,6 +216,8 @@ public class AutoLoader extends IAutoLoader implements Listener { @Override public boolean perform() { switch(Core.getVersion()){ + case 15: + return AutoLoader_15.tntPlaceActionPerform(location); default: return AutoLoader_12.tntPlaceActionPerform(location); }