From 9587b9e1fdda6d1580c1740a31fec63542d15b0c Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Sat, 21 Mar 2026 09:46:20 +0100 Subject: [PATCH] Fix Laufbau double click --- .../simulator/gui/SimulatorObserverGui.java | 2 ++ .../gui/SimulatorObserverPhaseSettingsGui.java | 5 +++++ .../simulator/gui/SimulatorObserverSettingsGui.java | 9 +++++++++ .../simulator/gui/SimulatorRedstoneGui.java | 2 ++ .../gui/SimulatorRedstonePhaseSettingsGui.java | 7 +++++++ .../simulator/gui/SimulatorRedstoneSettingsGui.java | 9 +++++++++ .../features/simulator/gui/SimulatorTNTGui.java | 2 ++ .../simulator/gui/SimulatorTNTPhaseSettingsGui.java | 13 +++++++++++++ .../simulator/gui/SimulatorTNTSettingsGui.java | 9 +++++++++ 9 files changed, 58 insertions(+) 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));