diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echo.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echo.java index 1d62b571..ad2000af 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echo.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echo.java @@ -1,4 +1,43 @@ package de.steamwar.bausystem.features.script.command.io; -public class Echo { +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.features.script.ScriptExecutor; +import de.steamwar.bausystem.features.script.SpecialCommand; +import de.steamwar.bausystem.linkage.LinkageType; +import de.steamwar.bausystem.linkage.Linked; +import net.md_5.bungee.api.ChatColor; + +@Linked(LinkageType.SCRIPT_COMMAND) +public class Echo implements SpecialCommand { + + @Override + public String[] description() { + return new String[]{ + "§eecho §8<§7Wert§8>", + "", + "§7Schreibe etwas dem Spieler. Wenn kein Wert angegeben wurde ist die Nachricht leer." + }; + } + + @Override + public String command() { + return "echo"; + } + + @Override + public boolean execute(String[] command, ScriptExecutor scriptExecutor) { + if (command.length <= 1) { + scriptExecutor.getPlayer().sendMessage(BauSystem.PREFIX + ""); + return true; + } + StringBuilder st = new StringBuilder(); + for (int i = 1; i < command.length; i++) { + if (i != 1) { + st.append(" "); + } + st.append(command[i]); + } + scriptExecutor.getPlayer().sendMessage(BauSystem.PREFIX + ChatColor.translateAlternateColorCodes('&', st.toString())); + return true; + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unglobal.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unglobal.java index a6515bcb..d0ab5560 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unglobal.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unglobal.java @@ -12,9 +12,9 @@ public class Unglobal implements SpecialCommand { @Override public String[] description() { return new String[]{ - "unglobal §8<§7Name§8>", + "§eunglobal §8<§7Name§8>", "", - "Lösche eine Globale variable" + "§7Lösche eine Globale variable." }; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unvar.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unvar.java index 2875508c..3186f296 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unvar.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unvar.java @@ -12,9 +12,9 @@ public class Unvar implements SpecialCommand { @Override public String[] description() { return new String[]{ - "unvar §8<§7Name§8>", + "§eunvar §8<§7Name§8>", "", - "Lösche eine Locale variable" + "§7Lösche eine Locale variable." }; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/variables/Constants.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/variables/Constants.java index e0ee2692..03312728 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/variables/Constants.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/variables/Constants.java @@ -1,5 +1,6 @@ package de.steamwar.bausystem.features.script.variables; +import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tracer.record.RecordStateMachine; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; @@ -44,6 +45,9 @@ public class Constants { CONSTANTS.put("z", player -> { return new Value.LongValue(player.getLocation().getBlockZ()); }); + CONSTANTS.put("name", player -> { + return new Value.StringValue(player.getDisplayName()); + }); } public Set allVariables() {