diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java index c64f8f80..8120bd85 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java @@ -27,10 +27,7 @@ import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.utils.ItemUtils; import de.steamwar.bausystem.utils.RayTraceUtils; import org.bukkit.Bukkit; -import org.bukkit.FluidCollisionMode; -import org.bukkit.GameMode; import org.bukkit.Location; -import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -39,9 +36,7 @@ import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.player.*; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; -import org.bukkit.util.BoundingBox; import org.bukkit.util.RayTraceResult; -import org.bukkit.util.Vector; import java.util.function.Function; 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 48bbd49b..1426d3fc 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 @@ -133,7 +133,7 @@ public class TNTElementGUI { ChangePosition.show(inv, player, recalculate, 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, "§a" + BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_NEGATIVE_Z", player), clickType -> { // Z negative + inv.setItem(23, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_NEGATIVE_Z", player), clickType -> { // Z negative recalculate.set(true); tntSimulator.hide(tntElement); Vector position = tntElement.getPosition(); @@ -142,7 +142,7 @@ public class TNTElementGUI { tntSimulator.show(tntElement); tntElement.change(); })); - inv.setItem(25, new SWItem(Material.OAK_BUTTON, "§b" + BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_POSITIVE_Z", player), clickType -> { // Z positive + inv.setItem(25, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_POSITIVE_Z", player), clickType -> { // Z positive recalculate.set(true); tntSimulator.hide(tntElement); Vector position = tntElement.getPosition(); @@ -151,7 +151,7 @@ public class TNTElementGUI { tntSimulator.show(tntElement); tntElement.change(); })); - inv.setItem(15, new SWItem(Material.OAK_BUTTON, "§c" + BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_POSITIVE_X", player), clickType -> { // X positive + inv.setItem(15, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_POSITIVE_X", player), clickType -> { // X positive recalculate.set(true); tntSimulator.hide(tntElement); Vector position = tntElement.getPosition(); @@ -160,7 +160,7 @@ public class TNTElementGUI { tntSimulator.show(tntElement); tntElement.change(); })); - inv.setItem(33, new SWItem(Material.OAK_BUTTON, "§e" + BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_NEGATIVE_X", player), clickType -> { // X negative + inv.setItem(33, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_NEGATIVE_X", player), clickType -> { // X negative recalculate.set(true); tntSimulator.hide(tntElement); Vector position = tntElement.getPosition(); @@ -169,7 +169,7 @@ public class TNTElementGUI { tntSimulator.show(tntElement); tntElement.change(); })); - inv.setItem(24, new SWItem(Material.SUNFLOWER, "§f" + BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_CENTER", player), clickType -> { // CENTER + inv.setItem(24, new SWItem(Material.SUNFLOWER, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_CENTER", player), clickType -> { // CENTER recalculate.set(true); tntSimulator.hide(tntElement); Vector position = tntElement.getPosition(); @@ -227,7 +227,7 @@ public class TNTElementGUI { AtomicBoolean recalculate = new AtomicBoolean(false); Runnable editObserver = () -> { // Change Count of spawned TNT - inv.setItem(10, new SWItem(SWItem.getDye(10), "§a" + plusOneName, plusOneFiveShiftLore, false, clickType -> { + inv.setItem(10, new SWItem(SWItem.getDye(10), plusOneName, plusOneFiveShiftLore, false, clickType -> { recalculate.set(true); tntElement.setCount(tntElement.getCount() + ((clickType.isShiftClick()) ? 5 : 1)); tntElement.change(); @@ -240,14 +240,14 @@ public class TNTElementGUI { }, () -> editProperties(player, tntElement, back))); countItem.getItemStack().setAmount(tntElement.getCount()); inv.setItem(19, countItem); - inv.setItem(28, new SWItem(SWItem.getDye(1), "§a" + minusOneName, minusOneFiveShiftLore, false, clickType -> { + inv.setItem(28, new SWItem(SWItem.getDye(1), minusOneName, minusOneFiveShiftLore, false, clickType -> { recalculate.set(true); tntElement.setCount(tntElement.getCount() - ((clickType.isShiftClick()) ? 5 : 1)); tntElement.change(); })); // Change TickOffset - inv.setItem(11, new SWItem(SWItem.getDye(10), "§b" + plusOneName, plusOneFiveShiftLore, false, clickType -> { + inv.setItem(11, new SWItem(SWItem.getDye(10), plusOneName, plusOneFiveShiftLore, false, clickType -> { recalculate.set(true); tntElement.setTickOffset(tntElement.getOwnTickOffset() + (clickType.isShiftClick() ? 5 : 1)); tntElement.change(); @@ -260,14 +260,14 @@ 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), "§b" + minusOneName, minusOneFiveShiftLore, false, clickType -> { + inv.setItem(29, new SWItem(SWItem.getDye(1), minusOneName, minusOneFiveShiftLore, false, clickType -> { recalculate.set(true); tntElement.setTickOffset(tntElement.getOwnTickOffset() - (clickType.isShiftClick() ? 5 : 1)); tntElement.change(); })); // Change FuseTicks - inv.setItem(12, new SWItem(SWItem.getDye(10), "§c" + plusOneName, plusOneFiveShiftLore, false, clickType -> { + inv.setItem(12, new SWItem(SWItem.getDye(10), plusOneName, plusOneFiveShiftLore, false, clickType -> { recalculate.set(true); tntElement.setFuseTicks(tntElement.getFuseTicks() + (clickType.isShiftClick() ? 5 : 1)); tntElement.change(); @@ -280,7 +280,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), "§c" + minusOneName, minusOneFiveShiftLore, false, clickType -> { + inv.setItem(30, new SWItem(SWItem.getDye(1), minusOneName, minusOneFiveShiftLore, false, clickType -> { recalculate.set(true); 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 cd40c30a..88476cc4 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), "§a" + plusOneName, plusOnePixelShiftLore, false, clickType -> { + inv.setItem(10, new SWItem(SWItem.getDye(10), plusOneName, plusOnePixelShiftLore, false, clickType -> { recalculate.set(true); if (tntSimulator != null) tntSimulator.hide(simulatorElement); toChangeVector.get().add(clickType.isShiftClick() ? X_VECTOR : FX_VECTOR); @@ -73,7 +73,7 @@ public class ChangePosition { back.run(); }, back); })); - inv.setItem(28, new SWItem(SWItem.getDye(1), "§a" + minusOneName, minusOnePixelShiftLore, false, clickType -> { + inv.setItem(28, new SWItem(SWItem.getDye(1), minusOneName, minusOnePixelShiftLore, false, clickType -> { recalculate.set(true); if (tntSimulator != null) tntSimulator.hide(simulatorElement); toChangeVector.get().subtract(clickType.isShiftClick() ? X_VECTOR : FX_VECTOR); @@ -82,7 +82,7 @@ public class ChangePosition { })); // Y Position - inv.setItem(11, new SWItem(SWItem.getDye(10), "§b" + plusOneName, plusOnePixelShiftLore, false, clickType -> { + inv.setItem(11, new SWItem(SWItem.getDye(10), plusOneName, plusOnePixelShiftLore, false, clickType -> { recalculate.set(true); if (tntSimulator != null) tntSimulator.hide(simulatorElement); toChangeVector.get().add(clickType.isShiftClick() ? Y_VECTOR : FY_VECTOR); @@ -99,7 +99,7 @@ public class ChangePosition { back.run(); }, back); })); - inv.setItem(29, new SWItem(SWItem.getDye(1), "§b" + minusOneName, minusOnePixelShiftLore, false, clickType -> { + inv.setItem(29, new SWItem(SWItem.getDye(1), minusOneName, minusOnePixelShiftLore, false, clickType -> { recalculate.set(true); if (tntSimulator != null) tntSimulator.hide(simulatorElement); toChangeVector.get().subtract(clickType.isShiftClick() ? Y_VECTOR : FY_VECTOR); @@ -108,7 +108,7 @@ public class ChangePosition { })); // Z Position - inv.setItem(12, new SWItem(SWItem.getDye(10), "§c" + plusOneName, plusOnePixelShiftLore, false, clickType -> { + inv.setItem(12, new SWItem(SWItem.getDye(10), plusOneName, plusOnePixelShiftLore, false, clickType -> { recalculate.set(true); if (tntSimulator != null) tntSimulator.hide(simulatorElement); toChangeVector.get().add(clickType.isShiftClick() ? Z_VECTOR : FZ_VECTOR); @@ -125,7 +125,7 @@ public class ChangePosition { back.run(); }, back); })); - inv.setItem(30, new SWItem(SWItem.getDye(1), "§c" + minusOneName, minusOnePixelShiftLore, false, clickType -> { + inv.setItem(30, new SWItem(SWItem.getDye(1), minusOneName, minusOnePixelShiftLore, false, clickType -> { recalculate.set(true); if (tntSimulator != null) tntSimulator.hide(simulatorElement); toChangeVector.get().subtract(clickType.isShiftClick() ? Z_VECTOR : FZ_VECTOR); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/tnt/TNTElement.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/tnt/TNTElement.java index 5806b2f0..29fcd778 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/tnt/TNTElement.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/tnt/TNTElement.java @@ -221,7 +221,7 @@ public class TNTElement implements SimulatorElement { } public void setCount(int count) { - if (count < 0) count = 1; + if (count < 0) count = 0; if (count > 400) count = 400; this.count = count; }