diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/ScriptListener.java b/BauSystem_Main/src/de/steamwar/bausystem/world/ScriptListener.java index 98470ea..23b21b5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/ScriptListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/ScriptListener.java @@ -20,6 +20,12 @@ package de.steamwar.bausystem.world; import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.commands.CommandFire; +import de.steamwar.bausystem.commands.CommandFreeze; +import de.steamwar.bausystem.commands.CommandNV; +import de.steamwar.bausystem.commands.CommandTNT; +import de.steamwar.bausystem.tracer.TraceManager; +import de.steamwar.bausystem.tracer.recorder.RecordManager; import de.steamwar.core.Core; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -182,7 +188,43 @@ public class ScriptListener implements Listener { } private static void infoCommand(ScriptExecutor scriptExecutor, String[] args) { - scriptExecutor.player.sendMessage(BauSystem.PREFIX + ChatColor.translateAlternateColorCodes('&', String.join(" ", args))); + scriptExecutor.player.sendMessage("§eInfo§8» §7" + ChatColor.translateAlternateColorCodes('&', String.join(" ", args))); + } + + private class VariableHolder { + + private Map variables = new HashMap<>(); + + public void setValue(String key, String value) { + int internalValue = 0; + if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes")) { + internalValue = 1; + } else if (value.equalsIgnoreCase("false") || value.equalsIgnoreCase("no")) { + internalValue = 0; + } else { + try { + internalValue = Integer.parseInt(value); + } catch (NumberFormatException e) { + internalValue = 0; + } + } + variables.put(key, internalValue); + } + + public int getValue(String key) { + switch (key) { + case "trace": + return RecordManager.getStatus().isTracing() ? 1 : 0; + case "tnt": + return CommandTNT.getInstance().isOn() ? 1 : 0; + case "freeze": + return CommandFreeze.getInstance().isOn() ? 1 : 0; + case "fire": + return CommandFire.getInstance().isOn() ? 1 : 0; + } + return variables.getOrDefault(key, 0); + } + } }