SteamWar/BauSystem
Archiviert
13
0

Make Sleep 'CaSeInDePeNdEnCe'

Make Sleep Command like Bukkit Command (String.split(" "))
Dieser Commit ist enthalten in:
jojo 2020-12-16 09:08:27 +01:00
Ursprung 5b73ec5305
Commit 15570cab7c

Datei anzeigen

@ -67,17 +67,21 @@ public class ScriptListener implements Listener {
while (index < commands.size()) {
String command = commands.get(index++);
if (command.startsWith("sleep")) {
String sleepTimeString = command.substring(5).trim();
String[] strings = command.split(" ");
if (strings.length > 0) {
if (strings[0].equalsIgnoreCase("sleep")) {
int sleepTime = 1;
if (strings.length > 1) {
try {
sleepTime = Integer.parseInt(sleepTimeString);
sleepTime = Integer.parseInt(strings[1]);
} catch (NumberFormatException e) {
// Ignored
}
}
Bukkit.getScheduler().runTaskLater(BauSystem.getPlugin(), this::resume, sleepTime);
break;
}
}
PlayerCommandPreprocessEvent preprocessEvent = new PlayerCommandPreprocessEvent(player, "/" + command);
Bukkit.getServer().getPluginManager().callEvent(preprocessEvent);