diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTElementGUI.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTElementGUI.java index 26ed07d7..24a1a3a7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTElementGUI.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTElementGUI.java @@ -74,6 +74,7 @@ public class TNTElementGUI { locationLore.add(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_POSITION_Y", player, tntElement.getPosition().getY())); locationLore.add(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_POSITION_Z", player, tntElement.getPosition().getZ())); inv.setItem(20, new SWItem(Material.PAPER, BauSystem.MESSAGE.parse("SIMULATOR_EDIT_LOCATION", player), locationLore, false, clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; editLocation(player, tntElement, () -> open(player, tntElement, back)); recalculate.set(true); })); @@ -88,6 +89,7 @@ public class TNTElementGUI { propertiesLore.add(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_VELOCITY_Y", player, active(player, tntElement.isYVelocity()))); propertiesLore.add(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_VELOCITY_Z", player, active(player, tntElement.isZVelocity()))); inv.setItem(22, new SWItem(Material.TNT, BauSystem.MESSAGE.parse("SIMULATOR_EDIT_PROPERTIES", player), propertiesLore, false, clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; editProperties(player, tntElement, () -> open(player, tntElement, back)); recalculate.set(true); })); @@ -101,12 +103,14 @@ public class TNTElementGUI { otherLore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_DISABLED", player)); } inv.setItem(24, new SWItem(Material.ANVIL, BauSystem.MESSAGE.parse("SIMULATOR_EDIT_OTHER", player), otherLore, false, clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; editOther(player, tntElement, () -> open(player, tntElement, back)); recalculate.set(true); })); // Delete tnt inv.setItem(44, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_REMOVE_TNT", player), clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); tntSimulator.remove(tntElement); player.closeInventory(); @@ -137,6 +141,7 @@ public class TNTElementGUI { // Alignment inv.setItem(23, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_NEGATIVE_Z", player), clickType -> { // Z negative + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); tntSimulator.hide(tntElement); Vector position = tntElement.getPosition(); @@ -146,6 +151,7 @@ public class TNTElementGUI { tntElement.change(); })); inv.setItem(25, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_POSITIVE_Z", player), clickType -> { // Z positive + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); tntSimulator.hide(tntElement); Vector position = tntElement.getPosition(); @@ -155,6 +161,7 @@ public class TNTElementGUI { tntElement.change(); })); inv.setItem(15, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_POSITIVE_X", player), clickType -> { // X positive + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); tntSimulator.hide(tntElement); Vector position = tntElement.getPosition(); @@ -164,6 +171,7 @@ public class TNTElementGUI { tntElement.change(); })); inv.setItem(33, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_NEGATIVE_X", player), clickType -> { // X negative + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); tntSimulator.hide(tntElement); Vector position = tntElement.getPosition(); @@ -173,6 +181,7 @@ public class TNTElementGUI { tntElement.change(); })); inv.setItem(24, new SWItem(Material.SUNFLOWER, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_CENTER", player), clickType -> { // CENTER + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); tntSimulator.hide(tntElement); Vector position = tntElement.getPosition(); @@ -237,6 +246,7 @@ public class TNTElementGUI { tntElement.change(); }))); SWItem countItem = new SWItem(Material.TNT, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_COUNT", player, tntElement.getCount()), lore, false, clickType -> changeCount(player, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_COUNT_ANVIL_GUI_NAME", player), tntElement.getCount(), c -> { + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); tntElement.setCount(c); tntElement.change(); @@ -259,6 +269,7 @@ public class TNTElementGUI { tntElement.change(); }))); SWItem tickItem = new SWItem(SWItem.getMaterial("DIODE"), BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_TICK", player, tntElement.getTickOffset()), lore, false, clickType -> changeCount(player, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_TICK_ANVIL_GUI_NAME", player), tntElement.getTickOffset(), tick -> { + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); tntElement.setTickOffset(tick - tntElement.getParentTickOffset()); tntElement.change(); @@ -281,6 +292,7 @@ public class TNTElementGUI { tntElement.change(); }))); SWItem fuseTickItem = new SWItem(Material.CLOCK, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_FUSE", player, tntElement.getFuseTicks()), lore, false, clickType -> changeCount(player, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_FUSE_ANVIL_GUI_NAME", player), tntElement.getFuseTicks(), tick -> { + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); tntElement.setFuseTicks(tick); tntElement.change(); @@ -297,6 +309,7 @@ public class TNTElementGUI { // Velocity Settings inv.setItem(24, Material.TNT, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_VELOCITY_NAME", player), clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); if (tntElement.isXVelocity() || tntElement.isYVelocity() || tntElement.isZVelocity()) { tntElement.setXVelocity(false); @@ -310,16 +323,19 @@ public class TNTElementGUI { tntElement.change(); }); inv.setItem(32, new SWItem(getWool(tntElement.isXVelocity()), getColor(tntElement.isXVelocity()), BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_VELOCITY_X", player, active(player, tntElement.isXVelocity())), clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); tntElement.setXVelocity(!tntElement.isXVelocity()); tntElement.change(); })); inv.setItem(15, new SWItem(getWool(tntElement.isYVelocity()), getColor(tntElement.isYVelocity()), BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_VELOCITY_Y", player, active(player, tntElement.isYVelocity())), clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); tntElement.setYVelocity(!tntElement.isYVelocity()); tntElement.change(); })); inv.setItem(34, new SWItem(getWool(tntElement.isZVelocity()), getColor(tntElement.isZVelocity()), BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_VELOCITY_Z", player, active(player, tntElement.isZVelocity())), clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); tntElement.setZVelocity(!tntElement.isZVelocity()); tntElement.change(); @@ -347,6 +363,7 @@ public class TNTElementGUI { AtomicBoolean recalculate = new AtomicBoolean(false); Runnable editObserver = () -> { inv.setItem(19, new SWItem(tntElement.getOrder(), BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ACTIVATED_NAME", player), OrderUtils.orderList(tntElement.getOrder(), player), false, clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); if (clickType.isShiftClick()) { tntElement.setOrder(OrderUtils.previous(tntElement.getOrder())); @@ -361,6 +378,7 @@ public class TNTElementGUI { if (!tntElement.hasParent()) { inv.setItem(24, new SWItem(Material.TNT, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE", player), Arrays.asList(), false, clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); // Create TNTGroup tntSimulator.getTntElementList().remove(tntElement); @@ -390,6 +408,7 @@ public class TNTElementGUI { } inv.setItem(25, new SWItem(Material.DISPENSER, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ADD_TNT", player), clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); Vector vector = tntElement.getOwnPosition().clone(); TNTElement newElement = new TNTElement(vector); @@ -407,6 +426,7 @@ public class TNTElementGUI { // Delete tnt inv.setItem(44, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_REMOVE_TNT", player), clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); tntSimulator.remove(tntElement); player.closeInventory(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTGroupEditGUI.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTGroupEditGUI.java index 9ab1b561..7d1d604c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTGroupEditGUI.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTGroupEditGUI.java @@ -33,6 +33,7 @@ import de.steamwar.inventory.SWItem; import lombok.experimental.UtilityClass; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; import org.bukkit.util.Consumer; import java.util.Arrays; @@ -70,11 +71,13 @@ public class TNTGroupEditGUI { // Change TickOffset inv.setItem(16, new SWItem(SWItem.getDye(10), plusOneName, plusOneFiveShiftLore, false, clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); tntGroup.setTickOffset(tntGroup.getTickOffset() + (clickType.isShiftClick() ? 5 : 1)); tntGroup.change(); })); SWItem tickItem = new SWItem(SWItem.getMaterial("DIODE"), BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_TICK", player, tntGroup.getTickOffset()), lore, false, clickType -> changeCount(player, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_TICK_ANVIL_GUI_NAME", player), tntGroup.getTickOffset(), tick -> { + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); tntGroup.setTickOffset(tick); tntGroup.change(); @@ -83,6 +86,7 @@ public class TNTGroupEditGUI { tickItem.getItemStack().setAmount(Math.max(tntGroup.getTickOffset(), 1)); inv.setItem(25, tickItem); inv.setItem(34, new SWItem(SWItem.getDye(1), minusOneName, minusOneFiveShiftLore, false, clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; recalculate.set(true); tntGroup.setTickOffset(tntGroup.getTickOffset() - (clickType.isShiftClick() ? 5 : 1)); tntGroup.change(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTSimulatorGui.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTSimulatorGui.java index 7bb551b8..fb32e42f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTSimulatorGui.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTSimulatorGui.java @@ -33,6 +33,7 @@ import de.steamwar.inventory.SWListInv; import lombok.experimental.UtilityClass; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; import org.bukkit.util.Vector; import java.util.ArrayList; @@ -158,6 +159,7 @@ public class TNTSimulatorGui { // X Position inv.setItem(12, new SWItem(SWItem.getDye(10), plusOneName, plusOnePixelShiftLore, false, clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; tntSimulator.hide(); moveAll(tntSimulator, clickType.isShiftClick() ? X_VECTOR : FX_VECTOR); tntSimulator.show(); @@ -165,6 +167,7 @@ public class TNTSimulatorGui { })); inv.setItem(21, new SWItem(Material.PAPER, BauSystem.MESSAGE.parse("SIMULATOR_POSITION_X", player), lore, false, clickType -> {})); inv.setItem(30, new SWItem(SWItem.getDye(1), minusOneName, minusOnePixelShiftLore, false, clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; tntSimulator.hide(); moveAll(tntSimulator, (clickType.isShiftClick() ? X_VECTOR : FX_VECTOR).clone().multiply(-1)); tntSimulator.show(); @@ -173,6 +176,7 @@ public class TNTSimulatorGui { // Y Position inv.setItem(13, new SWItem(SWItem.getDye(10), plusOneName, plusOnePixelShiftLore, false, clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; tntSimulator.hide(); moveAll(tntSimulator, clickType.isShiftClick() ? Y_VECTOR : FY_VECTOR); tntSimulator.show(); @@ -180,6 +184,7 @@ public class TNTSimulatorGui { })); inv.setItem(22, new SWItem(Material.PAPER, BauSystem.MESSAGE.parse("SIMULATOR_POSITION_Y", player), lore, false, clickType -> {})); inv.setItem(31, new SWItem(SWItem.getDye(1), minusOneName, minusOnePixelShiftLore, false, clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; tntSimulator.hide(); moveAll(tntSimulator, (clickType.isShiftClick() ? Y_VECTOR : FY_VECTOR).clone().multiply(-1)); tntSimulator.show(); @@ -188,6 +193,7 @@ public class TNTSimulatorGui { // Z Position inv.setItem(14, new SWItem(SWItem.getDye(10), plusOneName, plusOnePixelShiftLore, false, clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; tntSimulator.hide(); moveAll(tntSimulator, clickType.isShiftClick() ? Z_VECTOR : FZ_VECTOR); tntSimulator.show(); @@ -195,6 +201,7 @@ public class TNTSimulatorGui { })); inv.setItem(23, new SWItem(Material.PAPER, BauSystem.MESSAGE.parse("SIMULATOR_POSITION_Z", player), lore, false, clickType -> {})); inv.setItem(32, new SWItem(SWItem.getDye(1), minusOneName, minusOnePixelShiftLore, false, clickType -> { + if (clickType == ClickType.DOUBLE_CLICK) return; tntSimulator.hide(); moveAll(tntSimulator, (clickType.isShiftClick() ? Z_VECTOR : FZ_VECTOR).clone().multiply(-1)); tntSimulator.show();