Removed ExecutionBlockTimeout property

Removed ExecutionBLockTimeout property since it is pointless
This commit is contained in:
J-onasJones 2023-09-26 23:46:21 +02:00
parent 01214a78e7
commit d287466669
2 changed files with 9 additions and 16 deletions

View file

@ -42,12 +42,11 @@ public class CmdConfigHandler {
CmdMode commandMode = getCommandMode(configCommandDef);
int permissionLevel = getPermissionLevel(configCommandDef);
int execTimeout = getExecTimeout(configCommandDef);
int execRerunTimeout = getExecRerunTiemout(configCommandDef);
boolean broadcastToOP = doBroadcastToOP(configCommandDef);
String ingameCommand = getIngameCommand(configCommandDef);
String command = getCommand(configCommandDef);
preRegisteredCommand.init(commandMode, command, permissionLevel, execTimeout, ingameCommand, execRerunTimeout, broadcastToOP);
preRegisteredCommand.init(commandMode, command, permissionLevel, execTimeout, ingameCommand, broadcastToOP);
return preRegisteredCommand;
}
@ -79,21 +78,17 @@ public class CmdConfigHandler {
}
private static String getIngameCommand(String configCommandDef) {
return getSplitCommandPartByIndex(configCommandDef, 5);
}
private static int getExecRerunTiemout(String configCommandDef) {
return Integer.parseInt(getSplitCommandPartByIndex(configCommandDef, 3));
}
private static String getBroadcastToOP(String configCommandDef) throws BroadcastToOpNotBoolException {
return getSplitCommandPartByIndex(configCommandDef, 4);
}
private static String getBroadcastToOP(String configCommandDef) throws BroadcastToOpNotBoolException {
return getSplitCommandPartByIndex(configCommandDef, 3);
}
private static boolean doBroadcastToOP(String configCommandDef) throws BroadcastToOpNotBoolException {
if (getSplitCommandPartByIndex(configCommandDef, 4).equals("true")) {
if (getSplitCommandPartByIndex(configCommandDef, 3).equals("true")) {
return true;
} else if (getSplitCommandPartByIndex(configCommandDef, 5).equals("false")) {
} else if (getSplitCommandPartByIndex(configCommandDef, 4).equals("false")) {
return false;
} else {
throw new BroadcastToOpNotBoolException();
@ -101,7 +96,7 @@ public class CmdConfigHandler {
}
private static String getCommand(String configCommandDef) throws Exception {
return configCommandDef.replaceFirst(getCommandMode(configCommandDef).name() + " " + getPermissionLevel(configCommandDef) + " " + getExecTimeout(configCommandDef) + " " + getExecRerunTiemout(configCommandDef) + " " + getBroadcastToOP(configCommandDef) + " " + getIngameCommand(configCommandDef) + " ", "")
return configCommandDef.replaceFirst(getCommandMode(configCommandDef).name() + " " + getPermissionLevel(configCommandDef) + " " + getExecTimeout(configCommandDef) + " " + getBroadcastToOP(configCommandDef) + " " + getIngameCommand(configCommandDef) + " ", "")
.replaceFirst("\"", "")
.replaceAll("\"$", "");
}

View file

@ -9,16 +9,14 @@ public class CommandPreRegistry { //TODO: Add timeout before command can be ran
private int permissionLevel;
private int execTimeout;
private String ingamecommand;
private int execRerunTimeout;
private boolean broadcastToOp;
public void init(Constants.CmdMode commandmode, String command, int permissionLevel, int execTimeout, String ingamecommand, int execRerunTimeout, boolean broadcastToOp) {
public void init(Constants.CmdMode commandmode, String command, int permissionLevel, int execTimeout, String ingamecommand, boolean broadcastToOp) {
this.commandmode = commandmode;
this.command = command;
this.permissionLevel = permissionLevel;
this.execTimeout = execTimeout;
this.ingamecommand = ingamecommand;
this.execRerunTimeout = execRerunTimeout;
this.broadcastToOp = broadcastToOp;
}
}