From c4564e313a58b31f226a18c185a93f81c55e7802 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 19 Mar 2021 22:27:57 +0100 Subject: [PATCH] Fix ScriptListener Fix RecordStatus --- .../bausystem/tracer/record/RecordStatus.java | 14 ++++++-------- .../steamwar/bausystem/world/ScriptListener.java | 9 ++++----- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/record/RecordStatus.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/record/RecordStatus.java index b3d0a94..b87e740 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/record/RecordStatus.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/record/RecordStatus.java @@ -21,20 +21,18 @@ package de.steamwar.bausystem.tracer.record; public enum RecordStatus { - RECORD("§aan", true,false, "§cTNT-Tracer muss gestoppt werden"), - RECORD_AUTO("§aan", true, true, "§cTNT-Tracer darf nicht aufnehmen"), - IDLE("§caus", false, false, "§cAuto-Tracer gestoppt"), - IDLE_AUTO("§eauto", false, true, "§aAuto-Tracer gestartet"); + RECORD("§aan", true, "§cTNT-Tracer muss gestoppt werden"), + RECORD_AUTO("§aan", true, "§cTNT-Tracer darf nicht aufnehmen"), + IDLE("§caus", false, "§cAuto-Tracer gestoppt"), + IDLE_AUTO("§eauto", false, "§aAuto-Tracer gestartet"); String name; boolean tracing; - boolean autoTrace; String autoMessage; - RecordStatus(String value, boolean tracing, boolean autoTrace, String autoMessage) { + RecordStatus(String value, boolean tracing, String autoMessage) { this.name = value; this.tracing = tracing; - this.autoTrace = autoTrace; this.autoMessage = autoMessage; } @@ -47,7 +45,7 @@ public enum RecordStatus { } public boolean isAutoTrace() { - return autoTrace; + return this == RECORD_AUTO || this == IDLE_AUTO; } public String getAutoMessage() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/ScriptListener.java b/BauSystem_Main/src/de/steamwar/bausystem/world/ScriptListener.java index af29687..31a361b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/ScriptListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/ScriptListener.java @@ -37,7 +37,6 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BookMeta; import java.util.*; -import java.util.function.Function; import java.util.function.IntBinaryOperator; import java.util.logging.Level; @@ -274,11 +273,11 @@ public class ScriptListener implements Listener { private static void arithmeticCommand(ScriptExecutor scriptExecutor, String[] args, IntBinaryOperator operation) { 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; } 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; } @@ -322,7 +321,7 @@ public class ScriptListener implements Listener { switch (key) { case "trace": return RecordStateMachine.getRecordStatus().isTracing() ? 1 : 0; - case "auto_trace": + case "autotrace": return RecordStateMachine.getRecordStatus().isAutoTrace() ? 1 : 0; case "tnt": 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) { switch (key) { case "trace": - case "auto_trace": + case "autotrace": case "tnt": case "freeze": case "fire":