Fix SimulatorTNTGui for 1.19

This commit is contained in:
2025-06-26 13:52:01 +02:00
parent 4eb40581f2
commit 75c4966e37
@@ -29,6 +29,7 @@ import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.core.Core;
import de.steamwar.data.CMDs; import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
@@ -101,14 +102,16 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
tnt.setDisabled(!tnt.isDisabled()); tnt.setDisabled(!tnt.isDisabled());
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED)); }).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
inventory.setItem(49, new SWItem(Material.CALIBRATED_SCULK_SENSOR, "§eCreate Stab", click -> { if (Core.getVersion() > 19) {
new SimulatorAnvilGui<>(player, "Depth Limit", "", Integer::parseInt, depthLimit -> { inventory.setItem(49, new SWItem(Material.CALIBRATED_SCULK_SENSOR, "§eCreate Stab", click -> {
if (depthLimit <= 0) return false; new SimulatorAnvilGui<>(player, "Depth Limit", "", Integer::parseInt, depthLimit -> {
simulator.setStabGenerator(new SimulatorStabGenerator(Region.getRegion(player.getLocation()), simulator, tnt, depthLimit)); if (depthLimit <= 0) return false;
SimulatorWatcher.update(simulator); simulator.setStabGenerator(new SimulatorStabGenerator(Region.getRegion(player.getLocation()), simulator, tnt, depthLimit));
return true; SimulatorWatcher.update(simulator);
}, null).open(); return true;
}).setCustomModelData(CMDs.Simulator.CREATE_STAB)); }, null).open();
}).setCustomModelData(CMDs.Simulator.CREATE_STAB));
}
inventory.setItem(50, new SWItem(Material.CHEST, parent.getElements().size() == 1 ? "§eMake Group" : "§eAdd another TNT to Group", clickType -> { inventory.setItem(50, new SWItem(Material.CHEST, parent.getElements().size() == 1 ? "§eMake Group" : "§eAdd another TNT to Group", clickType -> {
TNTElement tntElement = new TNTElement(tnt.getPosition().clone()); TNTElement tntElement = new TNTElement(tnt.getPosition().clone());
tntElement.add(new TNTPhase()); tntElement.add(new TNTPhase());