diff --git a/BauSystem/BauSystem_21/src/de/steamwar/bausystem/utils/TickManager21.java b/BauSystem/BauSystem_21/src/de/steamwar/bausystem/utils/TickManager21.java
index af3792f7..ad6ca6c2 100644
--- a/BauSystem/BauSystem_21/src/de/steamwar/bausystem/utils/TickManager21.java
+++ b/BauSystem/BauSystem_21/src/de/steamwar/bausystem/utils/TickManager21.java
@@ -100,7 +100,6 @@ public class TickManager21 implements TickManager {
manager.setFrozen(true);
bukkitTask.cancel();
}, 1, 1);
- manager.tick();
}
@Override
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/design/endstone/DesignEndStone.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/design/endstone/DesignEndStone.java
index fe529864..ad4afc56 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/design/endstone/DesignEndStone.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/design/endstone/DesignEndStone.java
@@ -31,10 +31,7 @@ import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
import java.util.stream.Collectors;
public class DesignEndStone {
@@ -56,11 +53,10 @@ public class DesignEndStone {
this.maxY = region.getBuildArea().getMaxPoint(false).getY();
this.maxZ = region.getBuildArea().getMaxPoint(false).getZ();
- limited = region.getGameModeConfig().Schematic.Limited
- .entrySet()
- .stream()
- .filter(entry -> entry.getValue() == 0)
- .flatMap(entry -> entry.getKey().stream())
+ limited = Arrays.stream(Material.values())
+ .filter(Material::isBlock)
+ .filter(material -> !material.isLegacy())
+ .filter(material -> material.getBlastResistance() > region.getGameModeConfig().Schematic.MaxDesignBlastResistance)
.collect(Collectors.toSet());
calculateFromBottom = region.getGameModeConfig().Arena.NoFloor;
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/dev/CreateKitCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/dev/CreateKitCommand.java
new file mode 100644
index 00000000..8008dc25
--- /dev/null
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/dev/CreateKitCommand.java
@@ -0,0 +1,63 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2026 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.bausystem.features.dev;
+
+import de.steamwar.bausystem.BauSystem;
+import de.steamwar.command.SWCommand;
+import de.steamwar.linkage.Linked;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.entity.Player;
+
+import java.io.File;
+import java.io.IOException;
+
+@Linked
+public class CreateKitCommand extends SWCommand {
+
+ public CreateKitCommand() {
+ super("createkit");
+ if (!BauSystem.DEV_SERVER) unregister();
+ }
+
+ @Register
+ public void onCommand(Player player, String name) {
+ YamlConfiguration yaml = new YamlConfiguration();
+
+ yaml.set("Items", player.getInventory().getContents());
+ yaml.set("Armor", player.getInventory().getArmorContents());
+ yaml.set("Effects", player.getActivePotionEffects());
+ yaml.set("LeaderAllowed", true);
+ yaml.set("MemberAllowed", true);
+ yaml.set("EnterStage", 0);
+ yaml.set("TNT", true);
+
+ YamlConfiguration kits = new YamlConfiguration();
+
+ kits.set("Kits." + name, yaml);
+
+ try {
+ kits.save(new File("new.kits.yaml"));
+
+ player.sendMessage("Kit created!");
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java
index 7222acab..91a9d650 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java
@@ -46,6 +46,16 @@ import org.bukkit.event.player.PlayerInteractEvent;
@Linked
public class FreezeListener implements Listener, ScoreboardElement {
+ @EventHandler
+ public void onBlockExplode(BlockExplodeEvent e) {
+ if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
+ e.setCancelled(true);
+ BlockState state = e.getBlock().getState();
+ Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
+ state.update(true, false);
+ }, 1L);
+ }
+
@EventHandler
public void onEntitySpawn(EntitySpawnEvent e) {
if (Region.getRegion(e.getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverGui.java
index adfec3a5..b6ad62a0 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverGui.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverGui.java
@@ -150,11 +150,13 @@ public class SimulatorObserverGui extends SimulatorScrollGui {
Consumer setter = observerPhase::setTickOffset;
return new SWItem[] {
new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
observer,
new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverPhaseSettingsGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverPhaseSettingsGui.java
index d7d54981..16f036b0 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverPhaseSettingsGui.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverPhaseSettingsGui.java
@@ -32,6 +32,7 @@ import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
import java.util.Arrays;
@@ -97,6 +98,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
//Tick Offset
int offset = observer.getTickOffset();
inventory.setItem(10, new SWItem(SWItem.getDye(offset < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
observer.setTickOffset(Math.min(max, offset + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -113,6 +115,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
inventory.setItem(19, offsetItem);
inventory.setItem(28, new SWItem(SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
observer.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
@@ -120,6 +123,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
//Order
int order = observer.getOrder();
inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
observer.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -138,6 +142,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
inventory.setItem(22, orderItem);
inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
observer.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverSettingsGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverSettingsGui.java
index c31687f5..cd424170 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverSettingsGui.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverSettingsGui.java
@@ -28,6 +28,7 @@ import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
import java.util.Arrays;
@@ -67,6 +68,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
// Base Tick
int baseTicks = observer.getBaseTick();
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
observer.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -81,6 +83,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
inventory.setItem(18, baseTick);
inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
observer.changeBaseTicks(-baseTicks);
} else {
@@ -91,6 +94,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
//Pos X
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
observer.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -102,12 +106,14 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
}, this).open();
}));
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
observer.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Pos Y
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
observer.move(0, clickType.isShiftClick() ? 5 : 1, 0);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
@@ -119,12 +125,14 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
}, this).open();
}));
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
observer.move(0, clickType.isShiftClick() ? -5 : -1, 0);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Pos Z
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
observer.move(0, 0, clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
@@ -136,6 +144,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
}, this).open();
}));
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
observer.move(0, 0, clickType.isShiftClick() ? -5 : -1);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstoneGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstoneGui.java
index 847ba882..fcaecd9a 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstoneGui.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstoneGui.java
@@ -165,11 +165,13 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui setter = redstoneSubPhase.place ? redstoneSubPhase.phase::setTickOffset : redstoneSubPhase.phase::setLifetime;
return new SWItem[] {
new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
redstone,
new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstonePhaseSettingsGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstonePhaseSettingsGui.java
index 37825397..cf7726bd 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstonePhaseSettingsGui.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstonePhaseSettingsGui.java
@@ -31,6 +31,7 @@ import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
import java.util.Arrays;
@@ -98,6 +99,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
//Tick Offset
int offset = redstone.getTickOffset();
inventory.setItem(10, new SWItem(SWItem.getDye(offset < maxOffset ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
redstone.setTickOffset(Math.min(maxOffset, offset + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -114,6 +116,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
inventory.setItem(19, offsetItem);
inventory.setItem(28, new SWItem(SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
redstone.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
@@ -121,6 +124,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
//Lifetime
int lifetime = redstone.getLifetime();
inventory.setItem(11, new SWItem(SWItem.getDye(lifetime < maxLifetime ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
redstone.setLifetime(Math.min(maxLifetime, lifetime + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -137,6 +141,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
inventory.setItem(20, lifetimeItem);
inventory.setItem(29, new SWItem(SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
redstone.setLifetime(Math.max(0, lifetime - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
@@ -144,6 +149,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
//Order
int order = redstone.getOrder();
inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
redstone.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -162,6 +168,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
inventory.setItem(22, orderItem);
inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
redstone.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstoneSettingsGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstoneSettingsGui.java
index 23206e27..a2901797 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstoneSettingsGui.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstoneSettingsGui.java
@@ -28,6 +28,7 @@ import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
import java.util.Arrays;
@@ -66,6 +67,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
// Base Tick
int baseTicks = redstone.getBaseTick();
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
redstone.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -80,6 +82,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
inventory.setItem(18, baseTick);
inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
redstone.changeBaseTicks(-baseTicks);
} else {
@@ -90,6 +93,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
//Pos X
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
redstone.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -101,12 +105,14 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
}, this).open();
}));
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
redstone.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Pos Y
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
redstone.move(0, clickType.isShiftClick() ? 5 : 1, 0);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -118,12 +124,14 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
}, this).open();
}));
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
redstone.move(0, clickType.isShiftClick() ? -5 : -1, 0);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Pos Z
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
redstone.move(0, 0, clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -135,6 +143,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
}, this).open();
}));
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
redstone.move(0, 0, clickType.isShiftClick() ? -5 : -1);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTGui.java
index a089f806..08d3628d 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTGui.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTGui.java
@@ -138,11 +138,13 @@ public class SimulatorTNTGui extends SimulatorScrollGui {
return new SWItem[]{
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tntSetting.setCount(tntSetting.getCount() + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
tnt,
new SWItem(SWItem.getDye(tntSetting.getCount() > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tntSetting.setCount(Math.max(1, tntSetting.getCount() - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTPhaseSettingsGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTPhaseSettingsGui.java
index d1850fc9..e66449fb 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTPhaseSettingsGui.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTPhaseSettingsGui.java
@@ -31,6 +31,7 @@ import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
import java.util.Arrays;
@@ -78,6 +79,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
//Count
int count = tnt.getCount();
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.setCount(count + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -94,6 +96,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
inventory.setItem(18, countItem);
inventory.setItem(27, new SWItem(SWItem.getDye(count > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.setCount(Math.max(1, count - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
@@ -101,6 +104,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
//Tick Offset
int offset = tnt.getTickOffset();
inventory.setItem(10, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.setTickOffset(offset + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -117,6 +121,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
inventory.setItem(19, offsetItem);
inventory.setItem(28, new SWItem(SWItem.getDye(offset > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.setTickOffset(Math.max(0, offset - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
@@ -124,6 +129,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
//Lifetime
int lifetime = tnt.getLifetime();
inventory.setItem(11, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.setLifetime(lifetime + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -140,6 +146,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
inventory.setItem(20, lifetimeItem);
inventory.setItem(29, new SWItem(SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.setLifetime(Math.max(1, lifetime - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
@@ -147,6 +154,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
//Order
int order = tnt.getOrder();
inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -165,30 +173,35 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
inventory.setItem(22, orderItem);
inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Jump
SWItem jumpX = new SWItem(tnt.isXJump() ? Material.LIME_WOOL : Material.RED_WOOL, "§7TNT §eJump X§8: " + (tnt.isZJump() ? "§aon" : "§coff"), clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.setXJump(!tnt.isXJump());
SimulatorWatcher.update(simulator);
});
inventory.setItem(33, jumpX);
SWItem jumpY = new SWItem(tnt.isYJump() ? Material.LIME_WOOL : Material.RED_WOOL, "§7TNT §eJump Y§8: " + (tnt.isYJump() ? "§aon" : "§coff"), clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.setYJump(!tnt.isYJump());
SimulatorWatcher.update(simulator);
});
inventory.setItem(16, jumpY);
SWItem jumpZ = new SWItem(tnt.isZJump() ? Material.LIME_WOOL : Material.RED_WOOL, "§7TNT §eJump Z§8: " + (tnt.isZJump() ? "§aon" : "§coff"), clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.setZJump(!tnt.isZJump());
SimulatorWatcher.update(simulator);
});
inventory.setItem(35, jumpZ);
SWItem jumpAll = new SWItem(Material.TNT, "§7TNT §eJump §8: " + (tnt.hasJump() ? "§aon" : "§coff"), clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.setJump(!tnt.hasJump());
SimulatorWatcher.update(simulator);
});
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTSettingsGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTSettingsGui.java
index e835ba43..9640b066 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTSettingsGui.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTSettingsGui.java
@@ -28,6 +28,7 @@ import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
import java.util.ArrayList;
import java.util.Arrays;
@@ -75,6 +76,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
// Base Tick
int baseTicks = tnt.getBaseTick();
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -89,6 +91,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
inventory.setItem(18, baseTick);
inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
tnt.changeBaseTicks(-baseTicks);
} else {
@@ -136,6 +139,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
// Pos X
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.move(clickType.isShiftClick() ? 0.0625 : 1, 0, 0);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -147,12 +151,14 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
}, this).open();
}));
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.move(clickType.isShiftClick() ? -0.0625 : -1, 0, 0);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
// Pos Y
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.move(0, clickType.isShiftClick() ? 0.0625 : 1, 0);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -164,12 +170,14 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
}, this).open();
}));
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.move(0, clickType.isShiftClick() ? -0.0625 : -1, 0);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
// Pos Z
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.move(0, 0, clickType.isShiftClick() ? 0.0625 : 1);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
@@ -181,6 +189,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
}, this).open();
}));
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
+ if (clickType == ClickType.DOUBLE_CLICK) return;
tnt.move(0, 0, clickType.isShiftClick() ? -0.0625 : -1);
SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BlockBoundingBox.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BlockBoundingBox.java
index 223cdfe6..ee9d48f4 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BlockBoundingBox.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BlockBoundingBox.java
@@ -101,7 +101,7 @@ public class BlockBoundingBox {
addPixel(Material.END_STONE.createBlockData(), 0, 0, 0, 16, 16, 16, null);
addPixel(NMSWrapper.impl.pathMaterial().createBlockData(), 0, 0, 0, 16, 15, 16, createItem("LAUFBAU_BLOCK_GRASS_PATH", NMSWrapper.impl.pathMaterial()));
- addPixel(Material.SOUL_SAND.createBlockData(), 0, 0, 0, 16, 14, 16, createItem("LAUFBAU_BLOCK_SOUL_SAND", Material.SOUL_SAND));
+ addPixel(Material.MUD.createBlockData(), 0, 0, 0, 16, 14, 16, createItem("LAUFBAU_BLOCK_SOUL_SAND", Material.SOUL_SAND));
Cocoa cocoaNorth = (Cocoa) Material.COCOA.createBlockData();
cocoaNorth.setAge(2);
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauCommand.java
index 9c568a56..42ed812d 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauCommand.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauCommand.java
@@ -25,12 +25,14 @@ import de.steamwar.bausystem.shared.Pair;
import de.steamwar.bausystem.utils.WorldEditUtils;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
+import de.steamwar.linkage.MinVersion;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@Linked
+@MinVersion(19)
public class LaufbauCommand extends SWCommand {
public LaufbauCommand() {
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java
index 3e1dff3e..05fdcda0 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java
@@ -135,7 +135,7 @@ public abstract class ViewFlag {
}
Location secoundLocation;
- if (previousVelocity.getX() >= previousVelocity.getZ()) {
+ if (Math.abs(previousVelocity.getX()) >= Math.abs(previousVelocity.getZ())) {
secoundLocation = previous.getLocation().clone().add(delta.getX(), delta.getY(), 0);
} else {
secoundLocation = previous.getLocation().clone().add(0, delta.getY(), delta.getZ());
@@ -198,6 +198,16 @@ public abstract class ViewFlag {
}
};
+ public static ViewFlag HIGHLIGHT = new ViewFlag(true, false, "highlight", "h") {
+ @Override
+ public void modify(REntityServer server, List entities) {
+ for (TraceEntity entity : entities) {
+ entity.setGlowing(true);
+ }
+ }
+
+ };
+
/**
* Name of the flag
*/
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/SelectAdjacent.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/SelectAdjacent.java
deleted file mode 100644
index 3f6ca8f2..00000000
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/SelectAdjacent.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2025 SteamWar.de-Serverteam
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.steamwar.bausystem.features.worldedit;
-
-import de.steamwar.bausystem.BauSystem;
-import de.steamwar.bausystem.region.Point;
-import de.steamwar.bausystem.region.Region;
-import de.steamwar.bausystem.utils.FlatteningWrapper;
-import de.steamwar.core.SWPlayer;
-import de.steamwar.core.WorldEditRenderer;
-import de.steamwar.linkage.Linked;
-import de.steamwar.linkage.MinVersion;
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.block.Action;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.scheduler.BukkitTask;
-import org.bukkit.util.Vector;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.function.Predicate;
-
-@Linked
-@MinVersion(20)
-public class SelectAdjacent implements Listener {
-
- private Vector[] FACES = {
- new Vector(1, 0, 0),
- new Vector(-1, 0, 0),
- new Vector(0, 1, 0),
- new Vector(0, -1, 0),
- new Vector(0, 0, 1),
- new Vector(0, 0, -1),
-
- new Vector(1, 1, 0),
- new Vector(1, -1, 0),
- new Vector(1, 0, 1),
- new Vector(1, 0, -1),
- new Vector(-1, 1, 0),
- new Vector(-1, -1, 0),
- new Vector(-1, 0, 1),
- new Vector(-1, 0, -1),
- new Vector(0, 1, 1),
- new Vector(0, 1, -1),
- new Vector(0, -1, 1),
- new Vector(0, -1, -1),
- };
-
- @EventHandler
- public void onPlayerInteract(PlayerInteractEvent event) {
- if (!event.hasItem()) return;
- if (event.getItem().getType() != Material.WOODEN_AXE) return;
- if (!event.getPlayer().isSneaking()) return;
- if (event.getAction() != Action.LEFT_CLICK_BLOCK) return;
- Material material = event.getPlayer().getInventory().getItemInOffHand().getType();
- Selector selector;
- if (material.isAir()) {
- selector = new Selector(event.getClickedBlock(), event.getPlayer(), __ -> true);
- } else {
- selector = new Selector(event.getClickedBlock(), event.getPlayer(), type -> type == material);
- }
- SWPlayer.of(event.getPlayer()).setComponent(selector);
- }
-
- private class Selector implements SWPlayer.Component {
-
- private static final int MAX_BLOCKS = 500_000;
-
- private int minX;
- private int minY;
- private int minZ;
- private int maxX;
- private int maxY;
- private int maxZ;
-
- private BukkitTask bukkitTask;
- private Predicate predicate;
- private Set seen = new HashSet<>();
- private Set toCalc = new HashSet<>();
-
- private Region.Area area;
-
- public Selector(Block block, Player player, Predicate predicate) {
- this.predicate = predicate;
- toCalc.add(block.getLocation());
- minX = block.getX();
- minY = block.getY();
- minZ = block.getZ();
- maxX = block.getX();
- maxY = block.getY();
- maxZ = block.getZ();
-
- Region region = Region.getRegion(block.getLocation());
- area = Region.Area.EMPTY;
- if (region.getBuildArea().inRegion(block.getLocation(), true)) {
- area = region.getBuildArea();
- } else if (region.getTestblockArea().inRegion(block.getLocation(), true)) {
- area = region.getTestblockArea();
- } else if (region.getArea().inRegion(block.getLocation(), true)) {
- area = region.getArea();
- }
-
- bukkitTask = Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> {
- run();
-
- long volume = (long)(maxX - minX + 1) * (long)(maxY - minY + 1) * (long)(maxZ - minZ + 1);
- player.sendTitle("", "§e" + volume + " §7Blocks", 0, 5, 0);
-
- Point minPoint = new Point(minX, minY, minZ);
- Point maxPoint = new Point(maxX, maxY, maxZ);
-
- FlatteningWrapper.impl.setSelection(player, minPoint, maxPoint);
- WorldEditRenderer.renderPlayer(player);
-
- // boolean finished = toCalc.stream().allMatch(location -> {
- // return location.getBlockX() >= minX && location.getBlockY() >= minY && location.getBlockZ() >= minZ &&
- // location.getBlockX() <= maxX && location.getBlockY() <= maxY && location.getBlockZ() <= maxZ;
- // });
-
- if (toCalc.isEmpty() || seen.size() > MAX_BLOCKS) {
- bukkitTask.cancel();
- player.sendTitle("§aDone", "§e" + volume + " §7Blocks", 0, 20, 5);
- SWPlayer.of(player).removeComponent(Selector.class);
- }
- }, 1, 1);
- }
-
- private void cancel() {
- bukkitTask.cancel();
- }
-
- private void run() {
- Set current = toCalc;
- toCalc = new HashSet<>();
-
- for (Location location : current) {
- Block block = location.getBlock();
- if (block.isEmpty() || block.isLiquid()) continue;
- if (!predicate.test(block.getType())) continue;
- seen.add(location);
- if (!area.inRegion(block.getLocation(), true)) continue;
-
- minX = Math.min(minX, location.getBlockX());
- maxX = Math.max(maxX, location.getBlockX());
- minY = Math.min(minY, location.getBlockY());
- maxY = Math.max(maxY, location.getBlockY());
- minZ = Math.min(minZ, location.getBlockZ());
- maxZ = Math.max(maxZ, location.getBlockZ());
-
- for (Vector face : FACES) {
- Block next = block.getRelative(face.getBlockX(), face.getBlockY(), face.getBlockZ());
- if (next.isEmpty() || next.isLiquid()) continue;
- if (!predicate.test(next.getType())) continue;
- Location loc = next.getLocation();
- if (seen.contains(loc)) continue;
- toCalc.add(loc);
- }
- }
- }
-
- @Override
- public void onUnmount(SWPlayer player) {
- cancel();
- }
- }
-}
diff --git a/CommonCore/SQL/src/de/steamwar/sql/BannedUserIPs.kt b/CommonCore/SQL/src/de/steamwar/sql/BannedUserIPs.kt
index a3c3bae3..4ad7efbe 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/BannedUserIPs.kt
+++ b/CommonCore/SQL/src/de/steamwar/sql/BannedUserIPs.kt
@@ -35,7 +35,11 @@ import java.time.Instant
object BannedUserIPsTable: CompositeIdTable("BannedUserIPs") {
val userId = reference("UserID", SteamwarUserTable).index()
val timestamp = timestamp("Timestamp").index()
- val ip = varchar("IP", 45).index()
+ val ip = varchar("IP", 45).entityId()
+
+ init {
+ addIdColumn(userId)
+ }
override val primaryKey = PrimaryKey(userId, ip)
}
diff --git a/CommonCore/SQL/src/de/steamwar/sql/EventGroup.kt b/CommonCore/SQL/src/de/steamwar/sql/EventGroup.kt
index 75f55c30..b889ef1a 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/EventGroup.kt
+++ b/CommonCore/SQL/src/de/steamwar/sql/EventGroup.kt
@@ -94,7 +94,7 @@ class EventGroup(id: EntityID) : IntEntity(id) {
set(value) {
groupPointsPerDraw = value
}
- val dependents by lazy { EventRelation.getGroupRelations(this).toList() }
+ val dependents by lazy { EventRelation.getGroupRelations(this) }
val lastFight by lazy { Optional.ofNullable(fights.maxByOrNull { it.startTime }) }
fun getId() = id.value
diff --git a/CommonCore/SQL/src/de/steamwar/sql/EventRelation.kt b/CommonCore/SQL/src/de/steamwar/sql/EventRelation.kt
index b832b914..5b12b3aa 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/EventRelation.kt
+++ b/CommonCore/SQL/src/de/steamwar/sql/EventRelation.kt
@@ -51,11 +51,11 @@ class EventRelation(id: EntityID) : IntEntity(id) {
@JvmStatic
fun getFightRelations(fight: EventFight) =
- useDb { find { (EventRelationTable.fromId eq fight.id.value) and (EventRelationTable.fromType eq FromType.FIGHT) } }
+ useDb { find { (EventRelationTable.fromId eq fight.id.value) and (EventRelationTable.fromType eq FromType.FIGHT) }.toList() }
@JvmStatic
fun getGroupRelations(group: EventGroup) =
- useDb { find { (EventRelationTable.fromId eq group.id.value) and (EventRelationTable.fromType eq FromType.GROUP) } }
+ useDb { find { (EventRelationTable.fromId eq group.id.value) and (EventRelationTable.fromType eq FromType.GROUP) }.toList() }
@JvmStatic
fun create(fight: EventFight, fightTeam: FightTeam, fromType: FromType, fromId: Int, fromPlace: Int) = useDb {
diff --git a/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java b/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java
index 2a737508..906a9c87 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java
+++ b/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java
@@ -52,6 +52,10 @@ public final class GameModeConfig {
private static final Map> byGameName;
private static final Map> bySchematicType;
+ public static Collection> getAll() {
+ return (Collection) byFileName.values();
+ }
+
public static GameModeConfig getByFileName(File file) {
return (GameModeConfig) byFileName.get(file.getName());
}
@@ -87,8 +91,24 @@ public final class GameModeConfig {
byFileName = new HashMap<>();
byGameName = new HashMap<>();
bySchematicType = new HashMap<>();
- SchematicType.values();
DEFAULTS = SQLWrapper.impl.loadGameModeConfig(null);
+ init();
+ }
+
+ public static void init() {
+ byFileName.clear();
+ byGameName.clear();
+ bySchematicType.clear();
+
+ File folder = SQLWrapper.impl.getSchemTypesFolder();
+ if (!folder.exists()) return;
+ if (!folder.isDirectory()) return;
+
+ for (File file : Objects.requireNonNull(folder.listFiles())) {
+ if (!file.getName().endsWith(".yml")) continue;
+ if (file.getName().endsWith(".kits.yml")) continue;
+ SQLWrapper.impl.loadGameModeConfig(file);
+ }
byFileName.values().forEach(gameModeConfig -> {
List subTypes = Collections.unmodifiableList(gameModeConfig.Schematic.SubTypesStrings.stream()
@@ -402,6 +422,13 @@ public final class GameModeConfig {
*/
public final int WaterDepth;
+ /**
+ * If TNT should break blocks even underwater
+ *
+ * @implSpec {@code true} by default
+ */
+ public final boolean WaterDamage;
+
/**
* The outer border of the arena, measured in blocks around the schematic areas
*/
@@ -433,6 +460,13 @@ public final class GameModeConfig {
*/
public final boolean DisableSnowMelt;
+ /**
+ * Disable ice forming
+ *
+ * @implSpec {@code false} by default
+ */
+ public final boolean DisableIceForm;
+
/**
* Allow leaving the arena area as spectator
*
@@ -457,11 +491,13 @@ public final class GameModeConfig {
private ArenaConfig(YMLWrapper loader, SchematicConfig.SizeConfig Size, List EnterStages) {
loaded = loader.canLoad();
WaterDepth = loader.getInt("WaterDepth", 0);
+ WaterDamage = loader.getBoolean("WaterDamage", true);
Schem2Border = new Schem2BorderConfig(loader.with("Schem2Border"));
SpawnOffset = new SpawnOffsetConfig(loader.with("SpawnOffset"), Size);
BorderFromSchematic = loader.getInt("BorderFromSchematic", 21);
GroundWalkable = loader.getBoolean("GroundWalkable", true);
DisableSnowMelt = loader.getBoolean("DisableSnowMelt", false);
+ DisableIceForm = loader.getBoolean("DisableIceForm", false);
Leaveable = loader.getBoolean("Leaveable", false);
AllowMissiles = loader.getBoolean("AllowMissiles", !EnterStages.isEmpty());
NoFloor = loader.getBoolean("NoFloor", false);
@@ -597,18 +633,18 @@ public final class GameModeConfig {
public final boolean IgnorePublicOnly;
/**
- * If obsidian and bedrock should be replaced during PRE_RUNNING
+ * Replacements that should be done during PRE_RUNNING with no block updates
*
- * @implSpec {@code false} by default
+ * @implSpec {@code {}} by default
*/
- public final boolean ReplaceObsidianBedrock;
+ public final Map ReplacementsWithoutBlockUpdates;
/**
- * If the replacement should happen with block updates
+ * Replacements that should be done during PRE_RUNNING with block updates
*
- * @implSpec {@code false} by default
+ * @implSpec {@code {}} by default
*/
- public final boolean ReplaceWithBlockupdates;
+ public final Map ReplacementsWithBlockUpdates;
/**
* If the schematic perparation arena mode is time limited
@@ -641,7 +677,7 @@ public final class GameModeConfig {
/**
* Maximal blast resistance for the design blocks
*
- * @implSpec {@code Double.MAX_VALUE} by default
+ * @implSpec {@link SchematicConfig#MaxBlastResistance} by default
*/
public final double MaxDesignBlastResistance;
@@ -655,9 +691,9 @@ public final class GameModeConfig {
loaded = loader.canLoad();
Size = new SizeConfig(loader.with("Size"));
Inset = new InsetConfig(loader.with("Inset"));
- Type = loader.getSchematicType("Type", "Normal");
+ Type = null;
SubTypesStrings = loader.getStringList("SubTypes");
- SubTypes = loader.getSchematicTypeList("SubTypes");
+ SubTypes = new ArrayList<>();
Shortcut = loader.getString("Shortcut", "");
Material = loader.getMaterial("Material", "STONE_BUTTON");
ManualCheck = loader.getBoolean("ManualCheck", true);
@@ -665,13 +701,11 @@ public final class GameModeConfig {
PasteAligned = loader.getBoolean("PasteAligned", false);
OnlyPublicSchematics = loader.getBoolean("OnlyPublicSchematics", false);
IgnorePublicOnly = loader.getBoolean("IgnorePublicOnly", false);
- ReplaceObsidianBedrock = loader.getBoolean("ReplaceObsidianBedrock", false);
- ReplaceWithBlockupdates = loader.getBoolean("ReplaceWithBlockupdates", false);
UnlimitedPrepare = loader.getBoolean("UnlimitedPrepare", false);
MaxBlocks = loader.getInt("MaxBlocks", 0);
MaxDispenserItems = loader.getInt("MaxDispenserItems", 128);
MaxBlastResistance = loader.getDouble("MaxBlastResistance", Double.MAX_VALUE);
- MaxDesignBlastResistance = loader.getDouble("MaxDesignBlastResistance", Double.MAX_VALUE);
+ MaxDesignBlastResistance = loader.getDouble("MaxDesignBlastResistance", MaxBlastResistance);
Map, Integer> Limited = new HashMap<>();
for (Map, ?> entry : loader.getMapList("Limited")) {
@@ -690,6 +724,9 @@ public final class GameModeConfig {
Limited.put(Collections.singleton((M) material), 0);
});
this.Limited = Collections.unmodifiableMap(Limited);
+
+ this.ReplacementsWithoutBlockUpdates = loader.getMap("ReplacementsWithoutBlockUpdates", loader.materialMapper, loader.materialMapper);
+ this.ReplacementsWithBlockUpdates = loader.getMap("ReplacementsWithBlockUpdates", loader.materialMapper, loader.materialMapper);
}
@ToString
diff --git a/CommonCore/SQL/src/de/steamwar/sql/NodeData.kt b/CommonCore/SQL/src/de/steamwar/sql/NodeData.kt
index f9d47793..83a94680 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/NodeData.kt
+++ b/CommonCore/SQL/src/de/steamwar/sql/NodeData.kt
@@ -88,8 +88,6 @@ class NodeData(id: EntityID): CompositeEntity(id) {
schemData.inputStream.let { if(decompress) GZIPInputStream(it) else it }
}
- fun schemData() = schemData(true)
-
override fun delete() = useDb { super.delete() }
enum class SchematicFormat(val fileEnding: String) {
diff --git a/CommonCore/SQL/src/de/steamwar/sql/NodeMember.kt b/CommonCore/SQL/src/de/steamwar/sql/NodeMember.kt
index 0adaecb5..c346df97 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/NodeMember.kt
+++ b/CommonCore/SQL/src/de/steamwar/sql/NodeMember.kt
@@ -95,7 +95,7 @@ class NodeMember(id: EntityID) : CompositeEntity(id) {
{ Optional.ofNullable(it?.value) })
private set
- fun setParentId(id: Int?) {
+ fun setParentId(id: Int?) = useDb {
parent = Optional.ofNullable(id)
}
diff --git a/CommonCore/SQL/src/de/steamwar/sql/SQLWrapper.java b/CommonCore/SQL/src/de/steamwar/sql/SQLWrapper.java
index 47331406..f049f680 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/SQLWrapper.java
+++ b/CommonCore/SQL/src/de/steamwar/sql/SQLWrapper.java
@@ -36,8 +36,5 @@ public interface SQLWrapper {
return Collections.emptyList();
}
- default void processSchematicType(GameModeConfig, String> gameModeConfig) {
- }
-
void additionalExceptionMetadata(StringBuilder builder);
}
diff --git a/CommonCore/SQL/src/de/steamwar/sql/SchematicNode.kt b/CommonCore/SQL/src/de/steamwar/sql/SchematicNode.kt
index 5730ff53..841f8ace 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/SchematicNode.kt
+++ b/CommonCore/SQL/src/de/steamwar/sql/SchematicNode.kt
@@ -150,7 +150,91 @@ class SchematicNode(id: EntityID) : IntEntity(id) {
@JvmStatic
fun parentsOfNode(user: SteamwarUser, id: Int) = fromSql(
- "WITH RECURSIVE R AS (SELECT NodeId, ParentNode FROM EffectiveSchematicNode WHERE NodeId = ? UNION SELECT E.NodeId, E.ParentNode FROM R, EffectiveSchematicNode E WHERE R.ParentNode = E.NodeId AND E.EffectiveOwner = ?) SELECT SN.NodeId, SN.NodeOwner, SN.NodeName, R.ParentNode, SN.LastUpdate, SN.NodeItem, SN.NodeType, SN.NodeRank, SN.Config FROM R INNER JOIN SchematicNode SN ON SN.NodeId = R.NodeId",
+ """
+ WITH RECURSIVE
+ ESN_R AS (
+ SELECT SchematicNode.NodeId AS NodeId,
+ NM.UserId AS EffectiveOwner,
+ NM.ParentId AS ParentNode
+ FROM SchematicNode
+ INNER JOIN NodeMember NM ON NM.NodeId = SchematicNode.NodeId
+ UNION ALL
+ SELECT S.NodeId AS NodeId,
+ ESN_R.EffectiveOwner AS EffectiveOwner,
+ S.ParentNode AS ParentNode
+ FROM SchematicNode S
+ INNER JOIN ESN_R ON S.ParentNode = ESN_R.NodeId
+ ),
+ ESN_R2 AS (
+ SELECT SchematicNode.NodeId AS NodeId,
+ NM.UserId AS UserId,
+ SchematicNode.NodeOwner AS EffectiveOwner,
+ SchematicNode.ParentNode AS ParentNode
+ FROM SchematicNode
+ INNER JOIN NodeMember NM ON NM.NodeId = SchematicNode.NodeId
+ UNION ALL
+ SELECT S.NodeId AS NodeId,
+ ESN_R2.EffectiveOwner AS EffectiveOwner,
+ ESN_R2.UserId AS UserId,
+ S.ParentNode AS ParentNode
+ FROM SchematicNode S
+ INNER JOIN ESN_R2 ON S.ParentNode = ESN_R2.NodeId
+ WHERE S.NodeOwner <> ESN_R2.EffectiveOwner
+ ),
+ ESN_R3 AS (
+ SELECT SchematicNode.NodeId AS NodeId,
+ SchematicNode.NodeOwner AS NodeOwner,
+ SchematicNode.NodeOwner AS EffectiveOwner,
+ SchematicNode.ParentNode AS ParentNode
+ FROM SchematicNode
+ UNION ALL
+ SELECT S.NodeId AS NodeId,
+ S.NodeOwner AS NodeOwner,
+ ESN_R3.EffectiveOwner AS EffectiveOwner,
+ S.ParentNode AS ParentNode
+ FROM SchematicNode S
+ INNER JOIN ESN_R3 ON S.ParentNode = ESN_R3.NodeId
+ WHERE ESN_R3.NodeOwner <> S.NodeOwner
+ ),
+ ResolvedNodes AS (
+ SELECT ESN_R.NodeId AS NodeId,
+ ESN_R.EffectiveOwner AS EffectiveOwner,
+ ESN_R.ParentNode AS ParentNode
+ FROM ESN_R
+ UNION
+ SELECT ESN_R2.NodeId AS NodeId,
+ ESN_R2.UserId AS EffectiveOwner,
+ ESN_R2.ParentNode AS ParentNode
+ FROM ESN_R2
+ INNER JOIN SchematicNode SN2 ON ESN_R2.NodeId = SN2.NodeId
+ WHERE ESN_R2.ParentNode IS NOT NULL
+ AND SN2.NodeOwner <> ESN_R2.EffectiveOwner
+ UNION
+ SELECT ESN_R3.NodeId AS NodeId,
+ ESN_R3.EffectiveOwner AS EffectiveOwner,
+ ESN_R3.ParentNode AS ParentNode
+ FROM ESN_R3
+ WHERE ESN_R3.NodeOwner <> ESN_R3.EffectiveOwner
+ UNION
+ SELECT SchematicNode.NodeId AS NodeId,
+ SchematicNode.NodeOwner AS EffectiveOwner,
+ SchematicNode.ParentNode AS ParentNode
+ FROM SchematicNode
+ ),
+ R AS (
+ SELECT NodeId, ParentNode
+ FROM ResolvedNodes
+ WHERE NodeId = ?
+ UNION
+ SELECT E.NodeId, E.ParentNode
+ FROM R
+ INNER JOIN ResolvedNodes E ON R.ParentNode = E.NodeId
+ WHERE E.EffectiveOwner = ?
+ )
+ SELECT SN.NodeId, SN.NodeOwner, SN.NodeName, R.ParentNode, SN.LastUpdate, SN.NodeItem, SN.NodeType, SN.NodeRank, SN.Config
+ FROM R
+ INNER JOIN SchematicNode SN ON SN.NodeId = R.NodeId
+ """.trimIndent(),
listOf(
IntegerColumnType() to id,
IntegerColumnType() to user.getId()
@@ -288,7 +372,7 @@ class SchematicNode(id: EntityID) : IntEntity(id) {
val list = mutableListOf()
if (s.contains("/")) {
val preTab = s.take(s.lastIndexOf("/") + 1)
- val pa = getNodeFromPath(user, preTab) ?: return emptyList()
+ val pa = getNodeFromPath(user, preTab) ?: return mutableListOf()
val nodes: List = list(user, pa.getId())
val br = pa.generateBreadcrumbs(user)
nodes.forEach(Consumer { node: SchematicNode? -> list.add((if (sws) "/" else "") + br + node!!.name + (if (node.isDir()) "/" else "")) })
diff --git a/CommonCore/SQL/src/de/steamwar/sql/SchematicType.kt b/CommonCore/SQL/src/de/steamwar/sql/SchematicType.kt
index b7f7d5be..d4abc36c 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/SchematicType.kt
+++ b/CommonCore/SQL/src/de/steamwar/sql/SchematicType.kt
@@ -19,11 +19,7 @@
package de.steamwar.sql
-import java.io.File
import java.util.*
-import java.util.Locale
-import java.util.Locale.getDefault
-import java.util.stream.Collectors
data class SchematicType(
val name: String,
@@ -47,58 +43,65 @@ data class SchematicType(
@JvmField
val Normal = SchematicType("Normal", "", Type.NORMAL, null, "STONE_BUTTON", false)
- private val types: List
- private val fromDB: Map?
+ private val types: MutableList = mutableListOf()
+ private val fromDB: MutableMap = mutableMapOf()
init {
- val tmpTypes = mutableListOf()
- val tmpFromDB = mutableMapOf()
-
- tmpTypes.add(Normal)
- tmpFromDB[Normal.toDB()] = Normal
-
- val folder = SQLWrapper.impl.schemTypesFolder
- if (folder.exists()) {
- for (configFile in Arrays.stream(folder.listFiles { _, name ->
- name.endsWith(
- ".yml"
- ) && !name.endsWith(".kits.yml")
- }).sorted().collect(Collectors.toList())) {
- val gameModeConfig = SQLWrapper.impl.loadGameModeConfig(configFile)
- if (gameModeConfig.Schematic.Type == null) continue
- if (tmpFromDB.containsKey(gameModeConfig.Schematic.Type.toDB())) continue
- val current = gameModeConfig.Schematic.Type
- if (gameModeConfig.CheckQuestions.isNotEmpty()) {
- val checkType = current.checkType
- tmpTypes.add(checkType!!)
- tmpFromDB[checkType.toDB()] = checkType
- }
- tmpTypes.add(current)
- tmpFromDB[current.toDB()] = current
- SQLWrapper.impl.processSchematicType(gameModeConfig)
- }
- }
-
- types = tmpTypes.toList()
- fromDB = tmpFromDB.toMap()
+ GameModeConfig.init()
+ init()
}
@JvmStatic
- fun values() = types
+ fun init() {
+ types.clear()
+ fromDB.clear()
+
+ types.add(Normal)
+ fromDB[Normal.toDB()] = Normal
+
+ for (gameModeConfig in GameModeConfig.getAll()) {
+ val type = gameModeConfig.Schematic.Type
+ ?: continue
+ if (fromDB.containsKey(type.toDB())) continue
+
+ types.add(type)
+ fromDB[type.toDB()] = type
+ if (gameModeConfig.CheckQuestions.isNotEmpty() && type.checkType != null) {
+ types.add(type.checkType)
+ fromDB[type.checkType.toDB()] = type.checkType
+ }
+ }
+ }
@JvmStatic
- fun fromDB(value: String) = fromDB?.let { it[value.lowercase()] }
+ fun values() =
+ types
+
+ @JvmStatic
+ fun fromDB(value: String) =
+ fromDB[value.lowercase()]
}
- fun name() = name
- fun toDB() = name.lowercase()
+ fun name() =
+ name
- fun check() = type == Type.CHECK_TYPE
- fun fightType() = type == Type.FIGHT_TYPE
- fun writeable() = type == Type.NORMAL
+ fun toDB() =
+ name.lowercase()
- fun checkType() = if (manualCheck) checkType else this
- fun isAssignable() = type == Type.NORMAL || (type == Type.FIGHT_TYPE && checkType != null) || !manualCheck
+ fun check() =
+ type == Type.CHECK_TYPE
+
+ fun fightType() =
+ type == Type.FIGHT_TYPE
+
+ fun writeable() =
+ type == Type.NORMAL
+
+ fun checkType() =
+ if (manualCheck) checkType else this
+
+ fun isAssignable() =
+ type == Type.NORMAL || (type == Type.FIGHT_TYPE && checkType != null) || !manualCheck
enum class Type {
NORMAL,
diff --git a/CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.kt b/CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.kt
index fc238237..2c27d5d3 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.kt
+++ b/CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.kt
@@ -186,10 +186,10 @@ class SteamwarUser(id: EntityID): IntEntity(id) {
val salt = ByteArray(16)
random.nextBytes(salt)
- val saltString = Base64.getEncoder().encode(salt)
+ val saltString = Base64.getEncoder().encodeToString(salt)
val hash = generateHash(value, salt)
- val hashString = Base64.getEncoder().encode(hash)
+ val hashString = Base64.getEncoder().encodeToString(hash)
useDb {
passwordInternal = "$hashString:$saltString"
diff --git a/CommonCore/SQL/src/de/steamwar/sql/Team.kt b/CommonCore/SQL/src/de/steamwar/sql/Team.kt
index c6d63759..acf9891b 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/Team.kt
+++ b/CommonCore/SQL/src/de/steamwar/sql/Team.kt
@@ -32,8 +32,6 @@ object TeamTable : IntIdTable("Team", "TeamID") {
val color = char("TeamColor", 1).default("8")
val name = varchar("TeamName", 16).index()
val deleted = bool("TeamDeleted").default(false)
- val address = text("Address").nullable()
- val port = ushort("Port").default(25565u)
}
class Team(id: EntityID) : IntEntity(id) {
@@ -67,8 +65,6 @@ class Team(id: EntityID) : IntEntity(id) {
private var name by TeamTable.name
var deleted by TeamTable.deleted
private set
- private var teamAddress by TeamTable.address
- private var teamPort by TeamTable.port
val members by lazy { useDb { SteamwarUserTable.select(SteamwarUserTable.id).where { SteamwarUserTable.team eq teamId }.map { it[SteamwarUserTable.id].value } } }
fun size() = useDb { SteamwarUser.find { SteamwarUserTable.team eq teamId }.count().toInt() }
@@ -96,16 +92,4 @@ class Team(id: EntityID) : IntEntity(id) {
set(value) = useDb {
name = value
}
-
- var address: String?
- get() = teamAddress
- set(value) = useDb {
- teamAddress = value
- }
-
- var port: Int
- get() = teamPort.toInt()
- set(value) = useDb {
- teamPort = value.toUShort()
- }
}
\ No newline at end of file
diff --git a/CommonCore/SQL/src/de/steamwar/sql/YMLWrapper.java b/CommonCore/SQL/src/de/steamwar/sql/YMLWrapper.java
index 5a5f62aa..39eff9bb 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/YMLWrapper.java
+++ b/CommonCore/SQL/src/de/steamwar/sql/YMLWrapper.java
@@ -24,10 +24,7 @@ import org.yaml.snakeyaml.Yaml;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -160,6 +157,22 @@ final class YMLWrapper {
}
}
+ public Map getMap(String path, Function keyFunction, Function valueFunction) {
+ Object data = this.document.get(path);
+ if (data instanceof Map) {
+ Map result = new HashMap<>();
+ ((Map) data).forEach((keyString, valueString) -> {
+ K key = keyFunction.apply(keyString.toUpperCase());
+ V value = valueFunction.apply(valueString.toUpperCase());
+ if (key == null || value == null) return;
+ result.put(key, value);
+ });
+ return Collections.unmodifiableMap(result);
+ } else {
+ return Collections.emptyMap();
+ }
+ }
+
public List