From cc7cd81abe26ea50445f374e9132a56f29bafd71 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 15 Jun 2022 23:33:44 +0200 Subject: [PATCH] Fix shift clicking Signed-off-by: yoyosource --- .../features/simulator/gui/TNTElementGUI.java | 22 +++++++++---------- .../gui/components/ChangePosition.java | 12 +++++----- 2 files changed, 17 insertions(+), 17 deletions(-) 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 3772e458..d34982c7 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 @@ -114,7 +114,7 @@ public class TNTElementGUI { ChangePosition.show(inv, player, tntSimulator, tntElement, tntElement::getOwnPosition, x -> x - tntElement.getParentPosition().getX(), y -> y - tntElement.getParentPosition().getY(), z -> z - tntElement.getParentPosition().getZ(), () -> editLocation(player, tntElement, back)); // Alignment - inv.setItem(23, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_NEGATIVE_Z", player), clickType -> { // Z negative + inv.setItem(23, new SWItem(Material.OAK_BUTTON, "§a" + BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_NEGATIVE_Z", player), clickType -> { // Z negative if (tntSimulator != null) tntSimulator.hide(tntElement); Vector position = tntElement.getPosition(); align(position, new Vector(0, 0, 0.49)); @@ -122,7 +122,7 @@ public class TNTElementGUI { if (tntSimulator != null) tntSimulator.show(tntElement); tntElement.change(); })); - inv.setItem(25, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_POSITIVE_Z", player), clickType -> { // Z positive + inv.setItem(25, new SWItem(Material.OAK_BUTTON, "§b" + BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_POSITIVE_Z", player), clickType -> { // Z positive if (tntSimulator != null) tntSimulator.hide(tntElement); Vector position = tntElement.getPosition(); align(position, new Vector(0, 0, 0.51)); @@ -130,7 +130,7 @@ public class TNTElementGUI { if (tntSimulator != null) tntSimulator.show(tntElement); tntElement.change(); })); - inv.setItem(15, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_POSITIVE_X", player), clickType -> { // X positive + inv.setItem(15, new SWItem(Material.OAK_BUTTON, "§c" + BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_POSITIVE_X", player), clickType -> { // X positive if (tntSimulator != null) tntSimulator.hide(tntElement); Vector position = tntElement.getPosition(); align(position, new Vector(0.51, 0, 0)); @@ -138,7 +138,7 @@ public class TNTElementGUI { if (tntSimulator != null) tntSimulator.show(tntElement); tntElement.change(); })); - inv.setItem(33, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_NEGATIVE_X", player), clickType -> { // X negative + inv.setItem(33, new SWItem(Material.OAK_BUTTON, "§e" + BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_NEGATIVE_X", player), clickType -> { // X negative if (tntSimulator != null) tntSimulator.hide(tntElement); Vector position = tntElement.getPosition(); align(position, new Vector(0.49, 0, 0)); @@ -146,7 +146,7 @@ public class TNTElementGUI { if (tntSimulator != null) tntSimulator.show(tntElement); tntElement.change(); })); - inv.setItem(24, new SWItem(Material.SUNFLOWER, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_CENTER", player), clickType -> { // CENTER + inv.setItem(24, new SWItem(Material.SUNFLOWER, "§f" + BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_CENTER", player), clickType -> { // CENTER if (tntSimulator != null) tntSimulator.hide(tntElement); Vector position = tntElement.getPosition(); align(position, new Vector(0.5, 0, 0.5)); @@ -196,7 +196,7 @@ public class TNTElementGUI { Runnable editObserver = () -> { // Change Count of spawned TNT - inv.setItem(10, new SWItem(SWItem.getDye(10), plusOneName, plusOneFiveShiftLore, false, clickType -> { + inv.setItem(10, new SWItem(SWItem.getDye(10), "§a" + plusOneName, plusOneFiveShiftLore, false, clickType -> { tntElement.setCount(tntElement.getCount() + ((clickType.isShiftClick()) ? 5 : 1)); tntElement.change(); })); @@ -207,13 +207,13 @@ public class TNTElementGUI { }, () -> editProperties(player, tntElement, back))); countItem.getItemStack().setAmount(tntElement.getCount()); inv.setItem(19, countItem); - inv.setItem(28, new SWItem(SWItem.getDye(1), minusOneName, minusOneFiveShiftLore, false, clickType -> { + inv.setItem(28, new SWItem(SWItem.getDye(1), "§a" + minusOneName, minusOneFiveShiftLore, false, clickType -> { tntElement.setCount(tntElement.getCount() - ((clickType.isShiftClick()) ? 5 : 1)); tntElement.change(); })); // Change TickOffset - inv.setItem(11, new SWItem(SWItem.getDye(10), plusOneName, plusOneFiveShiftLore, false, clickType -> { + inv.setItem(11, new SWItem(SWItem.getDye(10), "§b" + plusOneName, plusOneFiveShiftLore, false, clickType -> { tntElement.setTickOffset(tntElement.getOwnTickOffset() + (clickType.isShiftClick() ? 5 : 1)); tntElement.change(); })); @@ -224,13 +224,13 @@ public class TNTElementGUI { }, () -> editProperties(player, tntElement, back))); tickItem.getItemStack().setAmount(Math.max(tntElement.getTickOffset(), 1)); inv.setItem(20, tickItem); - inv.setItem(29, new SWItem(SWItem.getDye(1), minusOneName, minusOneFiveShiftLore, false, clickType -> { + inv.setItem(29, new SWItem(SWItem.getDye(1), "§b" + minusOneName, minusOneFiveShiftLore, false, clickType -> { tntElement.setTickOffset(tntElement.getOwnTickOffset() - (clickType.isShiftClick() ? 5 : 1)); tntElement.change(); })); // Change FuseTicks - inv.setItem(12, new SWItem(SWItem.getDye(10), plusOneName, plusOneFiveShiftLore, false, clickType -> { + inv.setItem(12, new SWItem(SWItem.getDye(10), "§c" + plusOneName, plusOneFiveShiftLore, false, clickType -> { tntElement.setFuseTicks(tntElement.getFuseTicks() + (clickType.isShiftClick() ? 5 : 1)); tntElement.change(); })); @@ -241,7 +241,7 @@ public class TNTElementGUI { }, () -> editProperties(player, tntElement, back))); fuseTickItem.getItemStack().setAmount(Math.max(tntElement.getFuseTicks(), 1)); inv.setItem(21, fuseTickItem); - inv.setItem(30, new SWItem(SWItem.getDye(1), minusOneName, minusOneFiveShiftLore, false, clickType -> { + inv.setItem(30, new SWItem(SWItem.getDye(1), "§c" + minusOneName, minusOneFiveShiftLore, false, clickType -> { tntElement.setFuseTicks(tntElement.getFuseTicks() - (clickType.isShiftClick() ? 5 : 1)); tntElement.change(); })); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/components/ChangePosition.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/components/ChangePosition.java index 19156b9f..36cc57ff 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/components/ChangePosition.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/components/ChangePosition.java @@ -56,7 +56,7 @@ public class ChangePosition { List lore = Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_LORE", player)); // X Position - inv.setItem(10, new SWItem(SWItem.getDye(10), plusOneName, plusOnePixelShiftLore, false, clickType -> { + inv.setItem(10, new SWItem(SWItem.getDye(10), "§a" + plusOneName, plusOnePixelShiftLore, false, clickType -> { if (tntSimulator != null) tntSimulator.hide(simulatorElement); toChangeVector.get().add(clickType.isShiftClick() ? X_VECTOR : FX_VECTOR); if (tntSimulator != null) tntSimulator.show(simulatorElement); @@ -71,7 +71,7 @@ public class ChangePosition { back.run(); }, back); })); - inv.setItem(28, new SWItem(SWItem.getDye(1), minusOneName, minusOnePixelShiftLore, false, clickType -> { + inv.setItem(28, new SWItem(SWItem.getDye(1), "§a" + minusOneName, minusOnePixelShiftLore, false, clickType -> { if (tntSimulator != null) tntSimulator.hide(simulatorElement); toChangeVector.get().subtract(clickType.isShiftClick() ? X_VECTOR : FX_VECTOR); if (tntSimulator != null) tntSimulator.show(simulatorElement); @@ -79,7 +79,7 @@ public class ChangePosition { })); // Y Position - inv.setItem(11, new SWItem(SWItem.getDye(10), plusOneName, plusOnePixelShiftLore, false, clickType -> { + inv.setItem(11, new SWItem(SWItem.getDye(10), "§b" + plusOneName, plusOnePixelShiftLore, false, clickType -> { if (tntSimulator != null) tntSimulator.hide(simulatorElement); toChangeVector.get().add(clickType.isShiftClick() ? Y_VECTOR : FY_VECTOR); if (tntSimulator != null) tntSimulator.show(simulatorElement); @@ -94,7 +94,7 @@ public class ChangePosition { back.run(); }, back); })); - inv.setItem(29, new SWItem(SWItem.getDye(1), minusOneName, minusOnePixelShiftLore, false, clickType -> { + inv.setItem(29, new SWItem(SWItem.getDye(1), "§b" + minusOneName, minusOnePixelShiftLore, false, clickType -> { if (tntSimulator != null) tntSimulator.hide(simulatorElement); toChangeVector.get().subtract(clickType.isShiftClick() ? Y_VECTOR : FY_VECTOR); if (tntSimulator != null) tntSimulator.show(simulatorElement); @@ -102,7 +102,7 @@ public class ChangePosition { })); // Z Position - inv.setItem(12, new SWItem(SWItem.getDye(10), plusOneName, plusOnePixelShiftLore, false, clickType -> { + inv.setItem(12, new SWItem(SWItem.getDye(10), "§c" + plusOneName, plusOnePixelShiftLore, false, clickType -> { if (tntSimulator != null) tntSimulator.hide(simulatorElement); toChangeVector.get().add(clickType.isShiftClick() ? Z_VECTOR : FZ_VECTOR); if (tntSimulator != null) tntSimulator.show(simulatorElement); @@ -117,7 +117,7 @@ public class ChangePosition { back.run(); }, back); })); - inv.setItem(30, new SWItem(SWItem.getDye(1), minusOneName, minusOnePixelShiftLore, false, clickType -> { + inv.setItem(30, new SWItem(SWItem.getDye(1), "§c" + minusOneName, minusOnePixelShiftLore, false, clickType -> { if (tntSimulator != null) tntSimulator.hide(simulatorElement); toChangeVector.get().subtract(clickType.isShiftClick() ? Z_VECTOR : FZ_VECTOR); if (tntSimulator != null) tntSimulator.show(simulatorElement);