Add variable reference support to internal commands #207
@ -21,20 +21,18 @@ package de.steamwar.bausystem.tracer.record;
|
|||||||
|
|
||||||
public enum RecordStatus {
|
public enum RecordStatus {
|
||||||
|
|
||||||
RECORD("§aan", true,false, "§cTNT-Tracer muss gestoppt werden"),
|
RECORD("§aan", true, "§cTNT-Tracer muss gestoppt werden"),
|
||||||
RECORD_AUTO("§aan", true, true, "§cTNT-Tracer darf nicht aufnehmen"),
|
RECORD_AUTO("§aan", true, "§cTNT-Tracer darf nicht aufnehmen"),
|
||||||
IDLE("§caus", false, false, "§cAuto-Tracer gestoppt"),
|
IDLE("§caus", false, "§cAuto-Tracer gestoppt"),
|
||||||
IDLE_AUTO("§eauto", false, true, "§aAuto-Tracer gestartet");
|
IDLE_AUTO("§eauto", false, "§aAuto-Tracer gestartet");
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
boolean tracing;
|
boolean tracing;
|
||||||
boolean autoTrace;
|
|
||||||
String autoMessage;
|
String autoMessage;
|
||||||
|
|
||||||
RecordStatus(String value, boolean tracing, boolean autoTrace, String autoMessage) {
|
RecordStatus(String value, boolean tracing, String autoMessage) {
|
||||||
this.name = value;
|
this.name = value;
|
||||||
this.tracing = tracing;
|
this.tracing = tracing;
|
||||||
this.autoTrace = autoTrace;
|
|
||||||
this.autoMessage = autoMessage;
|
this.autoMessage = autoMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +45,7 @@ public enum RecordStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAutoTrace() {
|
public boolean isAutoTrace() {
|
||||||
return autoTrace;
|
return this == RECORD_AUTO || this == IDLE_AUTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
YoyoNow markierte diese Unterhaltung als gelöst
|
|||||||
public String getAutoMessage() {
|
public String getAutoMessage() {
|
||||||
|
@ -37,7 +37,6 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.inventory.meta.BookMeta;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.function.IntBinaryOperator;
|
import java.util.function.IntBinaryOperator;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@ -274,11 +273,11 @@ public class ScriptListener implements Listener {
|
|||||||
|
|
||||||
private static void arithmeticCommand(ScriptExecutor scriptExecutor, String[] args, IntBinaryOperator operation) {
|
private static void arithmeticCommand(ScriptExecutor scriptExecutor, String[] args, IntBinaryOperator operation) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
scriptExecutor.player.sendMessage(BauSystem.PREFIX + "§cDas erste Argument ist eine Variable");
|
scriptExecutor.player.sendMessage(BauSystem.PREFIX + "§cAls erstes Argument fehlt eine Variable");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
scriptExecutor.player.sendMessage(BauSystem.PREFIX + "§cDas zweite Argument ist eine Zahl oder Variable");
|
scriptExecutor.player.sendMessage(BauSystem.PREFIX + "§cAls zweites Argument fehlt eine Zahl oder Variable");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +321,7 @@ public class ScriptListener implements Listener {
|
|||||||
switch (key) {
|
switch (key) {
|
||||||
case "trace":
|
case "trace":
|
||||||
return RecordStateMachine.getRecordStatus().isTracing() ? 1 : 0;
|
return RecordStateMachine.getRecordStatus().isTracing() ? 1 : 0;
|
||||||
case "auto_trace":
|
case "autotrace":
|
||||||
return RecordStateMachine.getRecordStatus().isAutoTrace() ? 1 : 0;
|
return RecordStateMachine.getRecordStatus().isAutoTrace() ? 1 : 0;
|
||||||
case "tnt":
|
case "tnt":
|
||||||
return region.getTntMode() == CommandTNT.TNTMode.OFF ? 0 : 1;
|
return region.getTntMode() == CommandTNT.TNTMode.OFF ? 0 : 1;
|
||||||
@ -338,7 +337,7 @@ public class ScriptListener implements Listener {
|
|||||||
private static boolean isVariable(ScriptExecutor scriptExecutor, String key) {
|
private static boolean isVariable(ScriptExecutor scriptExecutor, String key) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "trace":
|
case "trace":
|
||||||
case "auto_trace":
|
case "autotrace":
|
||||||
case "tnt":
|
case "tnt":
|
||||||
case "freeze":
|
case "freeze":
|
||||||
case "fire":
|
case "fire":
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
return this == RECORD_AUTO || this == IDLE_AUTO