From 203519b15f62a3f76ebf38cb449255ce6f18584e Mon Sep 17 00:00:00 2001 From: jojo Date: Wed, 16 Dec 2020 09:36:28 +0100 Subject: [PATCH] Add messages for player --- .../de/steamwar/bausystem/world/ScriptListener.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/ScriptListener.java b/BauSystem_Main/src/de/steamwar/bausystem/world/ScriptListener.java index 55cc052..38756a3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/ScriptListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/ScriptListener.java @@ -32,6 +32,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BookMeta; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.logging.Level; @@ -96,7 +97,10 @@ public class ScriptListener implements Listener { if (strings.length > 1) { try { sleepTime = Integer.parseInt(strings[1]); - if (sleepTime <= 0) sleepTime = 1; + if (sleepTime <= 0) { + player.sendMessage(scriptPrefix + "Sleep kleiner gleich 0, default 1 GameTick"); + sleepTime = 1; + } } catch (NumberFormatException e) { player.sendMessage(scriptPrefix + "Sleep ohne Zahl, default 1 GameTick"); } @@ -109,8 +113,11 @@ public class ScriptListener implements Listener { PlayerCommandPreprocessEvent preprocessEvent = new PlayerCommandPreprocessEvent(player, "/" + command); Bukkit.getServer().getPluginManager().callEvent(preprocessEvent); - if(preprocessEvent.isCancelled()) + if (preprocessEvent.isCancelled()) { + player.sendMessage(scriptPrefix + "Befehl konnte nicht ausgeführt werden:"); + player.sendMessage(scriptPrefix + command); continue; + } Bukkit.getLogger().log(Level.INFO, player.getName() + " dispatched command: " + command); Bukkit.getServer().dispatchCommand(player, command);