SteamWar/BauSystem2.0
Archiviert
12
0

Add Echoactionbar
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Add Constants region-type

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-11-14 13:06:43 +01:00
Ursprung 8da8f3b6ef
Commit 4cb314dbee
3 geänderte Dateien mit 62 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -80,7 +80,7 @@ public class ScriptCommand extends SWCommand {
}); });
swItems.add(new SWListInv.SWListEntry<>(swItem, specialCommand)); swItems.add(new SWListInv.SWListEntry<>(swItem, specialCommand));
}); });
for (int i = 0; i < 9; i++) { for (int i = 0; i < 8; i++) {
swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", new ArrayList<>(), false, clickType -> { swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", new ArrayList<>(), false, clickType -> {
}), null)); }), null));
} }
@ -122,7 +122,9 @@ public class ScriptCommand extends SWCommand {
}), null)); }), null));
swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.IRON_BLOCK, "§7Constant §eoffhandmaterial", Arrays.asList("§eMaterial§7 des Items in oder Off Hand"), false, clickType -> { swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.IRON_BLOCK, "§7Constant §eoffhandmaterial", Arrays.asList("§eMaterial§7 des Items in oder Off Hand"), false, clickType -> {
}), null)); }), null));
for (int i = 0; i < 2 + 2 * 9; i++) { swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.MAP, "§7Constant §eregion-type", Arrays.asList("§eRegionstype§7 der jetztigen Region"), false, clickType -> {
}), null));
for (int i = 0; i < 1 + 2 * 9; i++) {
swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", new ArrayList<>(), false, clickType -> { swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", new ArrayList<>(), false, clickType -> {
}), null)); }), null));
} }

Datei anzeigen

@ -0,0 +1,50 @@
package de.steamwar.bausystem.features.script.command.io;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.SWUtils;
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;
import org.bukkit.Material;
@Linked(LinkageType.SCRIPT_COMMAND)
public class Echoactionbar implements SpecialCommand {
@Override
public String[] description() {
return new String[]{
"§eechoactionbar §8<§7Wert§8>",
"",
"§7Schreibe etwas dem Spieler in der ActionBar. Wenn kein Wert angegeben wurde ist die Nachricht leer."
};
}
@Override
public Material material() {
return Material.BIRCH_SIGN;
}
@Override
public String command() {
return "echoactionbar";
}
@Override
public boolean execute(String[] command, ScriptExecutor scriptExecutor) {
if (command.length <= 1) {
SWUtils.sendToActionbar(scriptExecutor.getPlayer(), "");
return true;
}
StringBuilder st = new StringBuilder();
for (int i = 1; i < command.length; i++) {
if (i != 1) {
st.append(" ");
}
st.append(command[i]);
}
SWUtils.sendToActionbar(scriptExecutor.getPlayer(), ChatColor.translateAlternateColorCodes('&', st.toString()));
return true;
}
}

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bausystem.features.script.variables; package de.steamwar.bausystem.features.script.variables;
import de.steamwar.bausystem.features.tracer.record.RecordStateMachine; import de.steamwar.bausystem.features.tracer.record.RecordStateMachine;
import de.steamwar.bausystem.region.GlobalRegion;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.FireMode; import de.steamwar.bausystem.region.flags.flagvalues.FireMode;
@ -215,6 +216,13 @@ public class Constants {
CONSTANTS.put("offhandmaterial", player -> { CONSTANTS.put("offhandmaterial", player -> {
return new ConstantStringValue(() -> player.getInventory().getItemInOffHand().getType().name()); return new ConstantStringValue(() -> player.getInventory().getItemInOffHand().getType().name());
}); });
CONSTANTS.put("region-type", player -> {
Region region = Region.getRegion(player.getLocation());
if (region.isGlobal()) {
return new ConstantStringValue(() -> "global");
}
return new ConstantStringValue(() -> region.getPrototype().getDisplayName().replace(' ', '_').toLowerCase());
});
} }
public Set<String> allVariables() { public Set<String> allVariables() {