|
@@ -42,7 +42,7 @@ public class CommandScript extends Command {
|
|
|
case "start": {
|
|
|
if(arg.length >= 2) {
|
|
|
String[] pars = Arrays.copyOfRange(arg, 1, arg.length);
|
|
|
- scripts.startScript(pars);
|
|
|
+ scripts.startScript(null, pars);
|
|
|
return;
|
|
|
}
|
|
|
break;
|
|
@@ -51,7 +51,7 @@ public class CommandScript extends Command {
|
|
|
if(arg.length >= 3) {
|
|
|
PlayerEntity p = Utils.getPlayerByName(server, arg[1]);
|
|
|
if(p == null) {
|
|
|
- sendMessage(cs, String.format("Cannot find player '%s'", arg[1]));
|
|
|
+ sendMessage(cs, String.format("Cannot find player '%s'.", arg[1]));
|
|
|
return;
|
|
|
}
|
|
|
String[] pars = Arrays.copyOfRange(arg, 2, arg.length);
|
|
@@ -75,7 +75,7 @@ public class CommandScript extends Command {
|
|
|
sendMessage(cs, String.format("%s = null", arg[2]));
|
|
|
}
|
|
|
} catch(NumberFormatException ex) {
|
|
|
- sendMessage(cs, String.format("'%s' is not a valid id", arg[1]));
|
|
|
+ sendMessage(cs, String.format("'%s' is not a valid id.", arg[1]));
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -84,15 +84,16 @@ public class CommandScript extends Command {
|
|
|
case "see": {
|
|
|
Collection<Script> scs = scripts.getScriptManager().getScripts();
|
|
|
if(scs.isEmpty()) {
|
|
|
- sendMessage(cs, "No scripts are active");
|
|
|
+ sendMessage(cs, "No scripts are active.");
|
|
|
return;
|
|
|
}
|
|
|
sendMessage(cs, "Active scripts:");
|
|
|
scs.forEach(sc -> {
|
|
|
- sendMessage(cs, String.format(" - %s (%d)", sc.getName(), sc.getId()));
|
|
|
+ String id = String.valueOf(sc.getId());
|
|
|
+ sendListMessage(cs, id, sc.getName());
|
|
|
scripts.getPlayerList(sc.getId()).forEach(uuid -> {
|
|
|
ServerPlayerEntity p = server.getPlayerList().getPlayerByUUID(uuid);
|
|
|
- sendMessage(cs, String.format(" - %s", p == null ? "null" : p.getName().getFormattedText()));
|
|
|
+ sendListMessage(cs, id, p == null ? "null" : p.getName().getFormattedText());
|
|
|
});
|
|
|
});
|
|
|
return;
|
|
@@ -103,9 +104,9 @@ public class CommandScript extends Command {
|
|
|
if(arg[1].equals("all")) {
|
|
|
scripts.clearPlayerRegistry();
|
|
|
if(scripts.getScriptManager().removeScriptsSafe()) {
|
|
|
- sendMessage(cs, "All active scripts were terminated");
|
|
|
+ sendMessage(cs, "All active scripts were terminated.");
|
|
|
} else {
|
|
|
- sendMessage(cs, "Iterating is not allowed currently");
|
|
|
+ sendMessage(cs, "Iterating is not allowed currently.");
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -113,14 +114,14 @@ public class CommandScript extends Command {
|
|
|
Script qd = scripts.getScriptManager().getScript(id);
|
|
|
if(qd != null) {
|
|
|
scripts.getScriptManager().removeScriptSafe(qd);
|
|
|
- sendMessage(cs, String.format("Script '%s' was terminated", qd.getName()));
|
|
|
+ sendMessage(cs, String.format("Script '%s' was terminated.", qd.getName()));
|
|
|
} else {
|
|
|
- sendMessage(cs, String.format("Script id '%d' is not valid", id));
|
|
|
+ sendMessage(cs, String.format("Script id '%d' is not valid.", id));
|
|
|
}
|
|
|
} catch(NumberFormatException ex) {
|
|
|
- sendMessage(cs, String.format("'%s' is not a valid id", arg[1]));
|
|
|
+ sendMessage(cs, String.format("'%s' is not a valid id.", arg[1]));
|
|
|
} catch(Exception ex) {
|
|
|
- sendMessage(cs, "Exception on script termination");
|
|
|
+ sendMessage(cs, "An exception on script termination was thrown.");
|
|
|
ex.printStackTrace();
|
|
|
}
|
|
|
return;
|
|
@@ -131,10 +132,10 @@ public class CommandScript extends Command {
|
|
|
}
|
|
|
|
|
|
sendMessage(cs, "/script ...");
|
|
|
- sendMessage(cs, "start <scripts...>", "starts a script");
|
|
|
- sendMessage(cs, "startp <player> <scripts...>", "starts a player script");
|
|
|
- sendMessage(cs, "variable <id> <name>", "shows the value of a variable");
|
|
|
- sendMessage(cs, "see", "shows active scripts");
|
|
|
- sendMessage(cs, "term <id/all>", "terminates a script");
|
|
|
+ sendListMessage(cs, "start <scripts...>", "starts a script");
|
|
|
+ sendListMessage(cs, "startp <player> <scripts...>", "starts a player script");
|
|
|
+ sendListMessage(cs, "variable <id> <name>", "shows the value of a variable");
|
|
|
+ sendListMessage(cs, "see", "shows active scripts");
|
|
|
+ sendListMessage(cs, "term <id/all>", "terminates a script");
|
|
|
}
|
|
|
}
|