SteamWar/BauSystem2.0
Archiviert
12
0

Update Simulator to Message System
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-12-19 16:11:19 +01:00
Ursprung ec6e754786
Commit b6b8d696ea
4 geänderte Dateien mit 30 neuen und 34 gelöschten Zeilen

Datei anzeigen

@ -579,6 +579,7 @@ SIMULATOR_TNT_SPAWN_ACTIVATED_WITH = §7Gezündet durch §8- §e{0}
SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_COMPARATOR = Comparator SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_COMPARATOR = Comparator
SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_REPEATER = Repeater SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_REPEATER = Repeater
SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE = §eZündphase hinzufügen SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE = §eZündphase hinzufügen
SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE_SHIFT = §eZündphase hinzufügen und +1 Tick Offset
SIMULATOR_TNT_SPAWN_ADD_TNT = §eTNT hinzufügen SIMULATOR_TNT_SPAWN_ADD_TNT = §eTNT hinzufügen
SIMULATOR_TNT_SPAWN_REMOVE_TNT = §cEntfernen SIMULATOR_TNT_SPAWN_REMOVE_TNT = §cEntfernen
SIMULATOR_TNT_SPAWN_POSITION_ANVIL_GUI_NAME = Position SIMULATOR_TNT_SPAWN_POSITION_ANVIL_GUI_NAME = Position

Datei anzeigen

@ -407,6 +407,7 @@ public class TNTSimulator {
editTNT(spawns); editTNT(spawns);
} }
// TODO: Add Material to UI!
private TNTSpawn(YAPIONObject yapionObject) { private TNTSpawn(YAPIONObject yapionObject) {
this.position = new Vector(yapionObject.getPlainValueOrDefault("positionX", 0.0), yapionObject.getPlainValueOrDefault("positionY", 0.0), yapionObject.getPlainValueOrDefault("positionZ", 0.0)); this.position = new Vector(yapionObject.getPlainValueOrDefault("positionX", 0.0), yapionObject.getPlainValueOrDefault("positionY", 0.0), yapionObject.getPlainValueOrDefault("positionZ", 0.0));
this.entity = SimulatorEntityShowMode.createEntity(player, position, false); this.entity = SimulatorEntityShowMode.createEntity(player, position, false);
@ -627,8 +628,12 @@ public class TNTSimulator {
editTNT(tntSpawns); editTNT(tntSpawns);
})); }));
swInventory.setItem(33, new SWItem(Material.TNT, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE", player), clickType -> { swInventory.setItem(33, new SWItem(Material.TNT, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE", player), Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE_SHIFT", player)), false, clickType -> {
spawns.add(new TNTSpawn(position, entity)); TNTSpawn tntSpawn = new TNTSpawn(position, entity);
if (clickType.isShiftClick()) {
tntSpawn.setTickOffset(tickOffset + 1);
}
spawns.add(tntSpawn);
})); }));
swInventory.setItem(53, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("SIMULATOR_BACK", player), clickType -> { swInventory.setItem(53, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("SIMULATOR_BACK", player), clickType -> {

Datei anzeigen

@ -26,8 +26,7 @@ import de.steamwar.bausystem.features.slaves.WorldEditUtils;
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.bausystem.shared.Pair; import de.steamwar.bausystem.shared.Pair;
import de.steamwar.command.SWCommand; import de.steamwar.command.*;
import de.steamwar.command.TypeMapper;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -44,31 +43,15 @@ public class PanzernCommand extends SWCommand {
public PanzernCommand() { public PanzernCommand() {
super("panzern", "panzersklave"); super("panzern", "panzersklave");
} addDefaultHelpMessage("PANZERN_HELP");
addDefaultHelpMessage("PANZERN_PREPARE1");
private boolean permissionCheck(Player player, Permission permission) { addDefaultHelpMessage("PANZERN_PREPARE2");
if (Permission.hasPermission(player, permission)) { addDefaultHelpMessage("PANZERN_PREPARE3");
return true; addDefaultHelpMessage("PANZERN_PREPARE4");
}
BauSystem.MESSAGE.send("PANZERN_NO_PERM", player);
return false;
}
@Register(help = true)
public void genericHelp(Player player, String... args) {
BauSystem.MESSAGE.send("COMMAND_HELP_HEAD", player, "panzern");
BauSystem.MESSAGE.send("PANZERN_HELP", player);
BauSystem.MESSAGE.send("PANZERN_PREPARE1", player);
BauSystem.MESSAGE.send("PANZERN_PREPARE2", player);
BauSystem.MESSAGE.send("PANZERN_PREPARE3", player);
BauSystem.MESSAGE.send("PANZERN_PREPARE4", player);
} }
@Register @Register
public void panzerSelection(Player player, @Mapper("block") Material blockMaterial, @Mapper("slab") Material slabMaterial) { public void panzerSelection(@Guard Player player, @Mapper("block") Material blockMaterial, @Mapper("slab") Material slabMaterial) {
if (!permissionCheck(player, Permission.WORLDEDIT)) {
return;
}
Pair<Location, Location> selection = WorldEditUtils.getSelection(player); Pair<Location, Location> selection = WorldEditUtils.getSelection(player);
if (selection == null) { if (selection == null) {
BauSystem.MESSAGE.send("PANZERN_NO_WORLDEDIT", player); BauSystem.MESSAGE.send("PANZERN_NO_WORLDEDIT", player);
@ -101,6 +84,20 @@ public class PanzernCommand extends SWCommand {
}.runTaskTimer(BauSystem.getInstance(), 1, 1); }.runTaskTimer(BauSystem.getInstance(), 1, 1);
} }
@ClassGuard(value = Player.class, local = true)
public GuardChecker guardChecker() {
return (commandSender, guardCheckType, strings, s) -> {
Player player = (Player) commandSender;
if (Permission.hasPermission(player, Permission.WORLDEDIT)) {
return GuardResult.ALLOWED;
}
if (guardCheckType != GuardCheckType.TAB_COMPLETE) {
BauSystem.MESSAGE.send("PANZERN_NO_PERM", player);
}
return GuardResult.DENIED;
};
}
@Mapper(value = "block", local = true) @Mapper(value = "block", local = true)
private TypeMapper<Material> blockMapper() { private TypeMapper<Material> blockMapper() {
Set<String> strings = new HashSet<>(); Set<String> strings = new HashSet<>();

Datei anzeigen

@ -34,14 +34,7 @@ public class SmartPlaceCommand extends SWCommand {
super("smartplace", "sp"); super("smartplace", "sp");
} }
@Register(help = true) @Register(description = {"SMART_PLACE_HELP", "SMART_PLACE_INFO"})
public void genericHelp(Player p, String... args) {
BauSystem.MESSAGE.sendPrefixless("COMMAND_HELP_HEAD", p, "Smart Place");
BauSystem.MESSAGE.sendPrefixless("SMART_PLACE_HELP", p);
BauSystem.MESSAGE.sendPrefixless("SMART_PLACE_INFO", p);
}
@Register
public void genericToggle(Player p) { public void genericToggle(Player p) {
boolean smartPlace = Config.getInstance().get(p).getPlainValueOrDefault("smartPlace", false); boolean smartPlace = Config.getInstance().get(p).getPlainValueOrDefault("smartPlace", false);
Config.getInstance().get(p).put("smartPlace", !smartPlace); Config.getInstance().get(p).put("smartPlace", !smartPlace);