SteamWar/BauSystem
Archiviert
13
0

Add messages for player

Dieser Commit ist enthalten in:
jojo 2020-12-16 09:36:28 +01:00
Ursprung 93003de08d
Commit 203519b15f

Datei anzeigen

@ -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);