SteamWar/BauSystem2.0
Archiviert
12
0

Update Constants

Fix CustomCommandListener

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-08-24 11:27:04 +02:00
Ursprung 2e93bb165d
Commit ed9ba5b7bd
3 geänderte Dateien mit 27 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -128,7 +128,11 @@ public class CustomCommandListener implements Listener {
} }
String[] command = e.getMessage().split(" "); String[] command = e.getMessage().split(" ");
customCommands.stream().map(customCommand -> customCommand.execute(command, e)).filter(b -> !b).findFirst(); for (CustomCommand customCommand : customCommands) {
if (customCommand.execute(command, e)) {
return;
}
}
} }
private boolean isNoBook(ItemStack item) { private boolean isNoBook(ItemStack item) {

Datei anzeigen

@ -1,6 +1,5 @@
package de.steamwar.bausystem.features.script; package de.steamwar.bausystem.features.script;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
@ -23,23 +22,27 @@ public class ScriptCommand extends SWCommand {
super("script"); super("script");
} }
private static List<SWListInv.SWListEntry<Object>> swItems = new ArrayList<>(); private static List<SWListInv.SWListEntry<SpecialCommand>> swItems = new ArrayList<>();
@Register(help = true) @Register(help = true)
public void genericHelp(Player p, String... args) { public void genericHelp(Player p, String... args) {
p.sendMessage("§8/§escript §8- §7Gibt das Script Buch"); p.sendMessage("§8/§escript §8- §7Öffnet die ScriptGUI");
} }
@Register @Register
public void giveCommand(Player p) { public void giveCommand(Player p) {
if (swItems.isEmpty()) { if (swItems.isEmpty()) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 3; 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));
} }
swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.BOOK, "§eCustom Commands", Arrays.asList("§7Schreibe§8: §7#!CMD 'COMMAND'", "§7an den Anfang eines Script Buches um", "§7ein Custom Command zu nutzen. Der", "§7Befehl startet immer mit / und kann dann so", "§7aufgebaut sein wie du willst. Alles was in Spitzen", "§7Klammern steht (<>) wird als Parameter und somit", "§7als Variable gewertet."), false, clickType -> { swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.BOOK, "§eCustom Commands", Arrays.asList("§7Schreibe§8: §7#!CMD 'COMMAND'", "§7an den Anfang eines Script Buches um", "§7ein Custom Command zu nutzen. Der", "§7Befehl startet immer mit / und kann dann so", "§7aufgebaut sein wie du willst. Alles was in Spitzen", "§7Klammern steht (<>) wird als Parameter und somit", "§7als Variable gewertet."), false, clickType -> {
}), null)); }), null));
for (int i = 0; i < 4; i++) { swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", new ArrayList<>(), false, clickType -> {
}), null));
swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.BOOK, "§eOther", Arrays.asList("§7Kommentare fangen mit §e#§7 an.", "§7Jump_Points fangen mit §e.§7 an."), false, clickType -> {
}), null));
for (int i = 0; i < 3; 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));
} }
@ -69,12 +72,8 @@ public class ScriptCommand extends SWCommand {
} }
SWItem swItem = new SWItem(specialCommand.material(), "§7Command: §e" + specialCommand.command(), strings, false, clickType -> { SWItem swItem = new SWItem(specialCommand.material(), "§7Command: §e" + specialCommand.command(), strings, false, clickType -> {
p.sendMessage("§eScript Command§8: §e" + specialCommand.command());
for (String s : specialCommand.description()) {
p.sendMessage("§7" + s);
}
}); });
swItems.add(new SWListInv.SWListEntry<>(swItem, null)); swItems.add(new SWListInv.SWListEntry<>(swItem, specialCommand));
}); });
for (int i = 0; i < 9 + 4; i++) { for (int i = 0; i < 9 + 4; 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 -> {
@ -92,6 +91,8 @@ public class ScriptCommand extends SWCommand {
}), null)); }), null));
swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.TNT, "§7Constant §etnt", Arrays.asList("§etrue§7 wenn TNT nicht ausgeschaltet ist."), false, clickType -> { swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.TNT, "§7Constant §etnt", Arrays.asList("§etrue§7 wenn TNT nicht ausgeschaltet ist."), false, clickType -> {
}), null)); }), null));
swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.TNT, "§7Constant §etnt-onlytb", Arrays.asList("§etrue§7 wenn TNT Nur Testblock an ist."), false, clickType -> {
}), null));
swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.GUNPOWDER, "§7Constant §efreeze", Arrays.asList("§etrue§7 wenn Freeze nicht ausgeschaltet ist."), false, clickType -> { swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.GUNPOWDER, "§7Constant §efreeze", Arrays.asList("§etrue§7 wenn Freeze nicht ausgeschaltet ist."), false, clickType -> {
}), null)); }), null));
swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.FIRE_CHARGE, "§7Constant §efire", Arrays.asList("§etrue§7 wenn Fire nicht ausgeschaltet ist."), false, clickType -> { swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.FIRE_CHARGE, "§7Constant §efire", Arrays.asList("§etrue§7 wenn Fire nicht ausgeschaltet ist."), false, clickType -> {
@ -114,7 +115,14 @@ public class ScriptCommand extends SWCommand {
} }
} }
SWListInv<Object> swListInv = new SWListInv<>(p, "Script Elements", swItems, (clickType, o) -> { SWListInv<SpecialCommand> swListInv = new SWListInv<>(p, "Script Elements", swItems, (clickType, o) -> {
if (o != null) {
p.sendMessage("§eScript Command§8: §e" + o.command());
for (String s : o.description()) {
p.sendMessage("§7" + s);
}
p.closeInventory();
}
}); });
swListInv.open(); swListInv.open();
} }

Datei anzeigen

@ -30,6 +30,9 @@ public class Constants {
CONSTANTS.put("tnt", player -> { CONSTANTS.put("tnt", player -> {
return new Value.BooleanValue(Region.getRegion(player.getLocation()).getPlain(Flag.TNT, TNTMode.class) != TNTMode.DENY); return new Value.BooleanValue(Region.getRegion(player.getLocation()).getPlain(Flag.TNT, TNTMode.class) != TNTMode.DENY);
}); });
CONSTANTS.put("tnt-onlytb", player -> {
return new Value.BooleanValue(Region.getRegion(player.getLocation()).getPlain(Flag.TNT, TNTMode.class) != TNTMode.ONLY_TB);
});
CONSTANTS.put("freeze", player -> { CONSTANTS.put("freeze", player -> {
return new Value.BooleanValue(Region.getRegion(player.getLocation()).getPlain(Flag.FREEZE, FreezeMode.class) == FreezeMode.ACTIVE); return new Value.BooleanValue(Region.getRegion(player.getLocation()).getPlain(Flag.FREEZE, FreezeMode.class) == FreezeMode.ACTIVE);
}); });