From 0a4944877862f38e358c21ab8aa71a2143bc0787 Mon Sep 17 00:00:00 2001 From: jojo Date: Fri, 15 Jan 2021 17:29:15 +0100 Subject: [PATCH 01/10] Add TraceGUI --- .../bausystem/commands/CommandTrace.java | 6 + .../commands/CommandTraceTabCompleter.java | 2 +- .../steamwar/bausystem/gui/GuiTraceShow.java | 134 ++++++++++++++++++ .../tracer/show/ShowModeParameter.java | 16 +++ .../tracer/show/TraceShowManager.java | 5 + 5 files changed, 162 insertions(+), 1 deletion(-) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java index a4594cd..3b30892 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java @@ -21,6 +21,7 @@ package de.steamwar.bausystem.commands; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; +import de.steamwar.bausystem.gui.GuiTraceShow; import de.steamwar.bausystem.tracer.record.RecordStateMachine; import de.steamwar.bausystem.tracer.show.ShowModeParameter; import de.steamwar.bausystem.tracer.show.StoredRecords; @@ -39,6 +40,7 @@ public class CommandTrace implements CommandExecutor { player.sendMessage("§8/§etrace start §8- §7Startet die Aufnahme aller TNT-Positionen"); player.sendMessage("§8/§etrace stop §8- §7Stoppt den TNT-Tracer"); player.sendMessage("§8/§etrace toggleauto §8- §7Automatischer Aufnahmenstart"); + player.sendMessage("§8/§etrace show gui §8- §7Zeigt die Trace show gui"); player.sendMessage("§8/§etrace show §8<§edefault§8|§eadvanced§8> §8<§e-water§8|§e-interpolate-xz§8|§e-interpolate-y§8> §8- §7Zeigt alle TNT-Positionen"); player.sendMessage("§8/§etrace hide §8- §7Versteckt alle TNT-Positionen"); player.sendMessage("§8/§etrace delete §8- §7Löscht alle TNT-Positionen"); @@ -90,6 +92,10 @@ public class CommandTrace implements CommandExecutor { if (args.length < 2) { TraceShowManager.show(player, new Basic(player, new ShowModeParameter())); } else { + if (args[1].equalsIgnoreCase("gui")) { + GuiTraceShow.openGui(player); + return false; + } ShowModeParameter showModeParameter = ShowModeParameter.parseArguments(args, 2); switch (args[1].toLowerCase()) { case "advanced": diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java index 5efe116..e2930a2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java @@ -39,7 +39,7 @@ public class CommandTraceTabCompleter implements TabCompleter { tabCompletes.add(new TabComplete((player, args) -> args.length == 1 && (RecordStateMachine.getRecordStatus() == RecordStatus.IDLE || RecordStateMachine.getRecordStatus() == RecordStatus.IDLE_AUTO), "start")); tabCompletes.add(new TabComplete((player, args) -> args.length == 1 && (RecordStateMachine.getRecordStatus() != RecordStatus.IDLE && RecordStateMachine.getRecordStatus() != RecordStatus.IDLE_AUTO), "stop")); tabCompletes.add(new TabComplete((player, args) -> args.length == 1, "toggleauto", "auto", "show", "hide", "delete", "clear")); - tabCompletes.add(new TabComplete((player, args) -> args.length == 2 && args[0].equalsIgnoreCase("show"), "basic", "advanced")); + tabCompletes.add(new TabComplete((player, args) -> args.length == 2 && args[0].equalsIgnoreCase("show"), "basic", "advanced", "gui")); tabCompletes.add(new TabComplete((player, args) -> args.length > 2 && args[0].equalsIgnoreCase("show") && (args[1].equalsIgnoreCase("basic") || args[1].equalsIgnoreCase("advanced")), "-water")); tabCompletes.add(new TabComplete((player, args) -> args.length > 2 && args[0].equalsIgnoreCase("show") && args[1].equalsIgnoreCase("advanced"), "-interpolate-xz", "-interpolate-y")); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java b/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java new file mode 100644 index 0000000..e8949e9 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java @@ -0,0 +1,134 @@ +/* + * + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * / + */ + +package de.steamwar.bausystem.gui; + +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.tracer.show.ShowMode; +import de.steamwar.bausystem.tracer.show.ShowModeParameter; +import de.steamwar.bausystem.tracer.show.TraceShowManager; +import de.steamwar.bausystem.tracer.show.mode.Advanced; +import de.steamwar.bausystem.tracer.show.mode.Basic; +import de.steamwar.inventory.SWInventory; +import de.steamwar.inventory.SWItem; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +public class GuiTraceShow { + + private static final Map SHOW_MODE_PARAMETER_HASH_MAP = new HashMap<>(); + + public static void openGui(Player player) { + ShowModeParameter playerShowMode = new ShowModeParameter(); + playerShowMode.setInterpolate_Y(false); + playerShowMode.setInterpolate_XZ(false); + SHOW_MODE_PARAMETER_HASH_MAP.put(player, playerShowMode); + + SWInventory swInventory = new SWInventory(player, 9, BauSystem.PREFIX + "ShowGUI"); + swInventory.addCloseCallback(clickType -> SHOW_MODE_PARAMETER_HASH_MAP.remove(player)); + + SWItem trace_show = new SWItem(Material.LIME_CONCRETE, "§aTraces Angezeigt", new ArrayList<>(), false, clickType -> {}); + SWItem trace_hide = new SWItem(Material.RED_CONCRETE, "§cTraces Ausgeblendet", new ArrayList<>(), false, clickType -> {}); + setActiveShow(player, swInventory, trace_show, trace_hide); + + SWItem water = new SWItem(Material.TNT, "§eWasser §7Positionen", Arrays.asList("§7Zeigt alles TNT, welches", "§7im Wasser explodiert ist"), false, clickType -> {}); + swInventory.setItem(5, water); + swInventory.setCallback(5, clickType -> toggleHideTNTinWaterExploded(player, swInventory, water)); + + SWItem interpolateY = new SWItem(Material.QUARTZ_STAIRS, "§eInterpolation §7Y-Achse", Arrays.asList("§7Zeigt die Interpolation", "§7auf der Y-Achse"), false, clickType -> {}); + swInventory.setItem(6, interpolateY); + swInventory.setCallback(6, clickType -> toggleInterpolateYPosition(player, swInventory, interpolateY)); + + SWItem interpolateXZ = new SWItem(Material.QUARTZ_SLAB, "§eInterpolation §7XZ-Achse", Arrays.asList("§7Zeigt die Interpolation", "§7auf der XZ-Achse"), false, clickType -> {}); + swInventory.setItem(7, interpolateXZ); + swInventory.setCallback(7, clickType -> toggleInterpolateXZPosition(player, swInventory, interpolateXZ)); + // Water Bucket (-water) + // TNT (-water-exploded) + // Quartz_Stair (-interpolate-y) + // Quartz_Slab (-interpolate-xz) + swInventory.open(); + } + + private static void setActiveShow(Player player, SWInventory swInventory, SWItem shown, SWItem hidden) { + if (TraceShowManager.hasActiveShow(player)) { + swInventory.setItem(1, shown); + swInventory.setCallback(1, clickType -> { + TraceShowManager.hide(player); + player.sendMessage(BauSystem.PREFIX + "§cAlle TNT-Positionen ausgeblendet"); + setActiveShow(player, swInventory, shown, hidden); + }); + } else { + swInventory.setItem(1, hidden); + swInventory.setCallback(1, clickType -> { + show(player); + player.sendMessage(BauSystem.PREFIX + "§aAlle TNT-Positionen angezeigt"); + setActiveShow(player, swInventory, shown, hidden); + }); + } + } + + private static void toggleHideTNTinWaterExploded(Player player, SWInventory swInventory, SWItem swItem) { + ShowModeParameter showModeParameter = SHOW_MODE_PARAMETER_HASH_MAP.get(player); + showModeParameter.setWater(!showModeParameter.isWater()); + show(player); + + swItem.setEnchanted(showModeParameter.isWater()); + swInventory.setItem(5, swItem); + swInventory.setCallback(5, clickType -> toggleHideTNTinWaterExploded(player, swInventory, swItem)); + } + + private static void toggleInterpolateYPosition(Player player, SWInventory swInventory, SWItem swItem) { + ShowModeParameter showModeParameter = SHOW_MODE_PARAMETER_HASH_MAP.get(player); + showModeParameter.setInterpolate_Y(!showModeParameter.isInterpolate_Y()); + show(player); + + swItem.setEnchanted(showModeParameter.isInterpolate_Y()); + swInventory.setItem(6, swItem); + swInventory.setCallback(6, clickType -> toggleInterpolateYPosition(player, swInventory, swItem)); + } + + private static void toggleInterpolateXZPosition(Player player, SWInventory swInventory, SWItem swItem) { + ShowModeParameter showModeParameter = SHOW_MODE_PARAMETER_HASH_MAP.get(player); + showModeParameter.setInterpolate_XZ(!showModeParameter.isInterpolate_XZ()); + show(player); + + swItem.setEnchanted(showModeParameter.isInterpolate_XZ()); + swInventory.setItem(7, swItem); + swInventory.setCallback(7, clickType -> toggleInterpolateXZPosition(player, swInventory, swItem)); + } + + private static void show(Player player) { + ShowModeParameter showModeParameter = SHOW_MODE_PARAMETER_HASH_MAP.get(player); + ShowMode showMode; + if (showModeParameter.isAdvanced()) { + showMode = new Advanced(player, showModeParameter); + } else { + showMode = new Basic(player, showModeParameter); + } + TraceShowManager.show(player, showMode); + } + +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java index e3ee044..27900a5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java @@ -44,6 +44,22 @@ public class ShowModeParameter { return interpolate_XZ; } + public void setWater(boolean water) { + this.water = water; + } + + public void setInterpolate_Y(boolean interpolate_Y) { + this.interpolate_Y = interpolate_Y; + } + + public void setInterpolate_XZ(boolean interpolate_XZ) { + this.interpolate_XZ = interpolate_XZ; + } + + public boolean isAdvanced() { + return interpolate_Y | interpolate_XZ; + } + public static ShowModeParameter parseArguments(String[] args, int index) { ShowModeParameter showModeParameter = new ShowModeParameter(); for (int i = index; i < args.length; i++) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/TraceShowManager.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/TraceShowManager.java index 70e8afd..21c09f1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/TraceShowManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/TraceShowManager.java @@ -51,4 +51,9 @@ public class TraceShowManager implements Listener { public void onLeave(PlayerQuitEvent event) { showModes.remove(event.getPlayer()); } + + public static boolean hasActiveShow(Player player) { + return showModes.containsKey(player); + } + } From c4867658a609c50e729eb7c0a9e86beaf32b1eb6 Mon Sep 17 00:00:00 2001 From: jojo Date: Sat, 16 Jan 2021 18:20:57 +0100 Subject: [PATCH 02/10] Fix issue with ShowModeParameter --- .../de/steamwar/bausystem/tracer/show/ShowModeParameter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java index 27900a5..153e580 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java @@ -57,7 +57,7 @@ public class ShowModeParameter { } public boolean isAdvanced() { - return interpolate_Y | interpolate_XZ; + return interpolate_Y || interpolate_XZ; } public static ShowModeParameter parseArguments(String[] args, int index) { From 38b545483a7b2f4053a1ddb86874b5d2f76b5509 Mon Sep 17 00:00:00 2001 From: jojo Date: Wed, 20 Jan 2021 19:01:52 +0100 Subject: [PATCH 03/10] Fix PR stuff --- .../src/de/steamwar/bausystem/gui/GuiTraceShow.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java b/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java index e8949e9..48b588b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java @@ -54,15 +54,15 @@ public class GuiTraceShow { SWItem trace_hide = new SWItem(Material.RED_CONCRETE, "§cTraces Ausgeblendet", new ArrayList<>(), false, clickType -> {}); setActiveShow(player, swInventory, trace_show, trace_hide); - SWItem water = new SWItem(Material.TNT, "§eWasser §7Positionen", Arrays.asList("§7Zeigt alles TNT, welches", "§7im Wasser explodiert ist"), false, clickType -> {}); + SWItem water = new SWItem(Material.TNT, "§eWasser §7Positionen", Arrays.asList("§7Zeigt alles TNT, welches", "§7im Wasser explodiert ist."), false, clickType -> {}); swInventory.setItem(5, water); swInventory.setCallback(5, clickType -> toggleHideTNTinWaterExploded(player, swInventory, water)); - SWItem interpolateY = new SWItem(Material.QUARTZ_STAIRS, "§eInterpolation §7Y-Achse", Arrays.asList("§7Zeigt die Interpolation", "§7auf der Y-Achse"), false, clickType -> {}); + SWItem interpolateY = new SWItem(Material.QUARTZ_STAIRS, "§eInterpolation §7Y-Achse", Arrays.asList("§7Zeigt die Interpolation", "§7auf der Y-Achse."), false, clickType -> {}); swInventory.setItem(6, interpolateY); swInventory.setCallback(6, clickType -> toggleInterpolateYPosition(player, swInventory, interpolateY)); - SWItem interpolateXZ = new SWItem(Material.QUARTZ_SLAB, "§eInterpolation §7XZ-Achse", Arrays.asList("§7Zeigt die Interpolation", "§7auf der XZ-Achse"), false, clickType -> {}); + SWItem interpolateXZ = new SWItem(Material.QUARTZ_SLAB, "§eInterpolation §7XZ-Achse", Arrays.asList("§7Zeigt die Interpolation", "§7auf der XZ-Achse."), false, clickType -> {}); swInventory.setItem(7, interpolateXZ); swInventory.setCallback(7, clickType -> toggleInterpolateXZPosition(player, swInventory, interpolateXZ)); // Water Bucket (-water) From 41c5b3dd551a20ce43bb6da457c732c4b6d999af Mon Sep 17 00:00:00 2001 From: jojo Date: Tue, 26 Jan 2021 12:06:01 +0100 Subject: [PATCH 04/10] Rename GuiTraceShow inventory name --- .../steamwar/bausystem/gui/GuiTraceShow.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java b/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java index 48b588b..dc13bbd 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java @@ -39,16 +39,20 @@ import java.util.Map; public class GuiTraceShow { - private static final Map SHOW_MODE_PARAMETER_HASH_MAP = new HashMap<>(); + private static final Map ShowModeParameterMap = new HashMap<>(); + + private GuiTraceShow() { + + } public static void openGui(Player player) { ShowModeParameter playerShowMode = new ShowModeParameter(); playerShowMode.setInterpolate_Y(false); playerShowMode.setInterpolate_XZ(false); - SHOW_MODE_PARAMETER_HASH_MAP.put(player, playerShowMode); + ShowModeParameterMap.put(player, playerShowMode); - SWInventory swInventory = new SWInventory(player, 9, BauSystem.PREFIX + "ShowGUI"); - swInventory.addCloseCallback(clickType -> SHOW_MODE_PARAMETER_HASH_MAP.remove(player)); + SWInventory swInventory = new SWInventory(player, 9, "Trace Show GUI"); + swInventory.addCloseCallback(clickType -> ShowModeParameterMap.remove(player)); SWItem trace_show = new SWItem(Material.LIME_CONCRETE, "§aTraces Angezeigt", new ArrayList<>(), false, clickType -> {}); SWItem trace_hide = new SWItem(Material.RED_CONCRETE, "§cTraces Ausgeblendet", new ArrayList<>(), false, clickType -> {}); @@ -91,7 +95,7 @@ public class GuiTraceShow { } private static void toggleHideTNTinWaterExploded(Player player, SWInventory swInventory, SWItem swItem) { - ShowModeParameter showModeParameter = SHOW_MODE_PARAMETER_HASH_MAP.get(player); + ShowModeParameter showModeParameter = ShowModeParameterMap.get(player); showModeParameter.setWater(!showModeParameter.isWater()); show(player); @@ -101,7 +105,7 @@ public class GuiTraceShow { } private static void toggleInterpolateYPosition(Player player, SWInventory swInventory, SWItem swItem) { - ShowModeParameter showModeParameter = SHOW_MODE_PARAMETER_HASH_MAP.get(player); + ShowModeParameter showModeParameter = ShowModeParameterMap.get(player); showModeParameter.setInterpolate_Y(!showModeParameter.isInterpolate_Y()); show(player); @@ -111,7 +115,7 @@ public class GuiTraceShow { } private static void toggleInterpolateXZPosition(Player player, SWInventory swInventory, SWItem swItem) { - ShowModeParameter showModeParameter = SHOW_MODE_PARAMETER_HASH_MAP.get(player); + ShowModeParameter showModeParameter = ShowModeParameterMap.get(player); showModeParameter.setInterpolate_XZ(!showModeParameter.isInterpolate_XZ()); show(player); @@ -121,7 +125,7 @@ public class GuiTraceShow { } private static void show(Player player) { - ShowModeParameter showModeParameter = SHOW_MODE_PARAMETER_HASH_MAP.get(player); + ShowModeParameter showModeParameter = ShowModeParameterMap.get(player); ShowMode showMode; if (showModeParameter.isAdvanced()) { showMode = new Advanced(player, showModeParameter); From 28b818f799f7ec7be59f38a101b6643a1daf4cb7 Mon Sep 17 00:00:00 2001 From: jojo Date: Tue, 26 Jan 2021 15:22:53 +0100 Subject: [PATCH 05/10] Fix pr stuff --- .../steamwar/bausystem/gui/GuiTraceShow.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java b/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java index dc13bbd..6fd07be 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java @@ -53,10 +53,7 @@ public class GuiTraceShow { SWInventory swInventory = new SWInventory(player, 9, "Trace Show GUI"); swInventory.addCloseCallback(clickType -> ShowModeParameterMap.remove(player)); - - SWItem trace_show = new SWItem(Material.LIME_CONCRETE, "§aTraces Angezeigt", new ArrayList<>(), false, clickType -> {}); - SWItem trace_hide = new SWItem(Material.RED_CONCRETE, "§cTraces Ausgeblendet", new ArrayList<>(), false, clickType -> {}); - setActiveShow(player, swInventory, trace_show, trace_hide); + setActiveShow(player, swInventory); SWItem water = new SWItem(Material.TNT, "§eWasser §7Positionen", Arrays.asList("§7Zeigt alles TNT, welches", "§7im Wasser explodiert ist."), false, clickType -> {}); swInventory.setItem(5, water); @@ -76,21 +73,21 @@ public class GuiTraceShow { swInventory.open(); } - private static void setActiveShow(Player player, SWInventory swInventory, SWItem shown, SWItem hidden) { + private static void setActiveShow(Player player, SWInventory swInventory) { if (TraceShowManager.hasActiveShow(player)) { - swInventory.setItem(1, shown); - swInventory.setCallback(1, clickType -> { + SWItem shown = new SWItem(Material.LIME_CONCRETE, "§aTraces angezeigt", new ArrayList<>(), false, clickType -> { TraceShowManager.hide(player); player.sendMessage(BauSystem.PREFIX + "§cAlle TNT-Positionen ausgeblendet"); - setActiveShow(player, swInventory, shown, hidden); + setActiveShow(player, swInventory); }); + swInventory.setItem(1, shown); } else { - swInventory.setItem(1, hidden); - swInventory.setCallback(1, clickType -> { + SWItem hidden = new SWItem(Material.RED_CONCRETE, "§cTraces ausgeblendet", new ArrayList<>(), false, clickType -> { show(player); player.sendMessage(BauSystem.PREFIX + "§aAlle TNT-Positionen angezeigt"); - setActiveShow(player, swInventory, shown, hidden); + setActiveShow(player, swInventory); }); + swInventory.setItem(1, hidden); } } From 1a72a39b33aa165be8749389bb17332230b8bc78 Mon Sep 17 00:00:00 2001 From: jojo Date: Wed, 27 Jan 2021 13:53:35 +0100 Subject: [PATCH 06/10] Merge Basic ShowMode and Advanced ShowMode to EntityShowMode Add EntityShowMode --- .../bausystem/commands/CommandTrace.java | 13 +- .../commands/CommandTraceTabCompleter.java | 5 +- .../steamwar/bausystem/gui/GuiTraceShow.java | 13 +- .../tracer/show/ShowModeParameter.java | 25 ++-- .../bausystem/tracer/show/mode/Advanced.java | 85 ------------- .../bausystem/tracer/show/mode/Basic.java | 54 -------- .../tracer/show/mode/EntityShowMode.java | 119 ++++++++++++++++++ 7 files changed, 140 insertions(+), 174 deletions(-) delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Basic.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/EntityShowMode.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java index 3b30892..8ca73f4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java @@ -26,8 +26,7 @@ import de.steamwar.bausystem.tracer.record.RecordStateMachine; import de.steamwar.bausystem.tracer.show.ShowModeParameter; import de.steamwar.bausystem.tracer.show.StoredRecords; import de.steamwar.bausystem.tracer.show.TraceShowManager; -import de.steamwar.bausystem.tracer.show.mode.Advanced; -import de.steamwar.bausystem.tracer.show.mode.Basic; +import de.steamwar.bausystem.tracer.show.mode.EntityShowMode; import de.steamwar.bausystem.world.Welt; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -90,14 +89,16 @@ public class CommandTrace implements CommandExecutor { break; case "show": if (args.length < 2) { - TraceShowManager.show(player, new Basic(player, new ShowModeParameter())); + TraceShowManager.show(player, new EntityShowMode(player, new ShowModeParameter())); + // TraceShowManager.show(player, new Basic(player, new ShowModeParameter())); } else { if (args[1].equalsIgnoreCase("gui")) { GuiTraceShow.openGui(player); return false; } - ShowModeParameter showModeParameter = ShowModeParameter.parseArguments(args, 2); - switch (args[1].toLowerCase()) { + ShowModeParameter showModeParameter = ShowModeParameter.parseArguments(args, 1); + TraceShowManager.show(player, new EntityShowMode(player, showModeParameter)); + /*switch (args[1].toLowerCase()) { case "advanced": TraceShowManager.show(player, new Advanced(player, showModeParameter)); break; @@ -106,7 +107,7 @@ public class CommandTrace implements CommandExecutor { default: TraceShowManager.show(player, new Basic(player, showModeParameter)); break; - } + }*/ } player.sendMessage(BauSystem.PREFIX + "§aAlle TNT-Positionen angezeigt"); break; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java index e2930a2..609a936 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java @@ -39,9 +39,8 @@ public class CommandTraceTabCompleter implements TabCompleter { tabCompletes.add(new TabComplete((player, args) -> args.length == 1 && (RecordStateMachine.getRecordStatus() == RecordStatus.IDLE || RecordStateMachine.getRecordStatus() == RecordStatus.IDLE_AUTO), "start")); tabCompletes.add(new TabComplete((player, args) -> args.length == 1 && (RecordStateMachine.getRecordStatus() != RecordStatus.IDLE && RecordStateMachine.getRecordStatus() != RecordStatus.IDLE_AUTO), "stop")); tabCompletes.add(new TabComplete((player, args) -> args.length == 1, "toggleauto", "auto", "show", "hide", "delete", "clear")); - tabCompletes.add(new TabComplete((player, args) -> args.length == 2 && args[0].equalsIgnoreCase("show"), "basic", "advanced", "gui")); - tabCompletes.add(new TabComplete((player, args) -> args.length > 2 && args[0].equalsIgnoreCase("show") && (args[1].equalsIgnoreCase("basic") || args[1].equalsIgnoreCase("advanced")), "-water")); - tabCompletes.add(new TabComplete((player, args) -> args.length > 2 && args[0].equalsIgnoreCase("show") && args[1].equalsIgnoreCase("advanced"), "-interpolate-xz", "-interpolate-y")); + tabCompletes.add(new TabComplete((player, args) -> args.length == 2 && args[0].equalsIgnoreCase("show"), "gui", "-interpolate-xz", "-interpolate-y", "-water", "-advanced")); + tabCompletes.add(new TabComplete((player, args) -> args.length > 2 && args[0].equalsIgnoreCase("show") && !args[1].equalsIgnoreCase("gui"), "-interpolate-xz", "-interpolate-y", "-water", "-advanced")); } @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java b/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java index 6fd07be..78e7a8a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/gui/GuiTraceShow.java @@ -22,11 +22,9 @@ package de.steamwar.bausystem.gui; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.tracer.show.ShowMode; import de.steamwar.bausystem.tracer.show.ShowModeParameter; import de.steamwar.bausystem.tracer.show.TraceShowManager; -import de.steamwar.bausystem.tracer.show.mode.Advanced; -import de.steamwar.bausystem.tracer.show.mode.Basic; +import de.steamwar.bausystem.tracer.show.mode.EntityShowMode; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; import org.bukkit.Material; @@ -122,14 +120,7 @@ public class GuiTraceShow { } private static void show(Player player) { - ShowModeParameter showModeParameter = ShowModeParameterMap.get(player); - ShowMode showMode; - if (showModeParameter.isAdvanced()) { - showMode = new Advanced(player, showModeParameter); - } else { - showMode = new Basic(player, showModeParameter); - } - TraceShowManager.show(player, showMode); + TraceShowManager.show(player, new EntityShowMode(player, ShowModeParameterMap.get(player))); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java index 153e580..e88c2c9 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java @@ -24,9 +24,8 @@ package de.steamwar.bausystem.tracer.show; public class ShowModeParameter { private boolean water = false; - private boolean interpolate_SET = false; - private boolean interpolate_Y = true; - private boolean interpolate_XZ = true; + private boolean interpolate_Y = false; + private boolean interpolate_XZ = false; public ShowModeParameter() { @@ -71,12 +70,7 @@ public class ShowModeParameter { case "-interpolate-y": case "-interpolate_y": case "-y": - if (showModeParameter.interpolate_SET) { - showModeParameter.interpolate_Y = true; - } else { - showModeParameter.interpolate_XZ = false; - showModeParameter.interpolate_SET = true; - } + showModeParameter.interpolate_Y = true; break; case "-interpolatex": case "-interpolate-x": @@ -90,12 +84,13 @@ public class ShowModeParameter { case "-interpolate-xz": case "-interpolate_xz": case "-xz": - if (showModeParameter.interpolate_SET) { - showModeParameter.interpolate_XZ = true; - } else { - showModeParameter.interpolate_Y = false; - showModeParameter.interpolate_SET = true; - } + showModeParameter.interpolate_XZ = true; + break; + case "-advanced": + showModeParameter.interpolate_Y = true; + showModeParameter.interpolate_XZ = true; + break; + default: break; } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java deleted file mode 100644 index 49b5704..0000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * - * This file is a part of the SteamWar software. - * - * Copyright (C) 2020 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * / - */ - -package de.steamwar.bausystem.tracer.show.mode; - -import de.steamwar.bausystem.tracer.AbstractTraceEntity; -import de.steamwar.bausystem.tracer.RoundedTNTPosition; -import de.steamwar.bausystem.tracer.TNTPosition; -import de.steamwar.bausystem.tracer.show.ShowModeParameter; -import org.bukkit.entity.Player; -import org.bukkit.util.Consumer; -import org.bukkit.util.Vector; - -import java.util.HashMap; -import java.util.Map; - -public class Advanced extends Basic { - - private final Map updateEntityMap = new HashMap<>(); - - public Advanced(Player player, ShowModeParameter showModeParameter) { - super(player, showModeParameter); - } - - @Override - public void show(TNTPosition position) { - super.show(position); - - if (!showModeParameter.isWater() && position.isExploded() && checkWater(position.getLocation())) { - for(TNTPosition pos : position.getRecord().getPositions()){ - applyOnPosition(pos, updatePointPosition -> - updateEntityMap.computeIfPresent(new RoundedTNTPosition(updatePointPosition), (p, point) -> point.hide(player, false) ? null : point)); - } - return; - } - - applyOnPosition(position, updatePointPosition -> - updateEntityMap.computeIfAbsent(new RoundedTNTPosition(updatePointPosition), pos -> createEntity(updatePointPosition, false)) - .display(player, position.isExploded())); - } - - @Override - public void hide() { - super.hide(); - updateEntityMap.forEach((roundedTNTPosition, abstractTraceEntity) -> abstractTraceEntity.hide(player, true)); - updateEntityMap.clear(); - } - - private void applyOnPosition(TNTPosition position, Consumer function){ - if (position.getPreviousLocation() == null) return; - - if (showModeParameter.isInterpolate_Y()) { - Vector updatePointY = position.getPreviousLocation().clone().setY(position.getLocation().getY()); - if(!position.getLocation().equals(updatePointY)) - function.accept(updatePointY); - } - - if (showModeParameter.isInterpolate_XZ()){ - Vector movement = position.getLocation().clone().subtract(position.getPreviousLocation()); - Vector updatePointXZ = Math.abs(movement.getX()) > Math.abs(movement.getZ()) - ? position.getLocation().clone().setZ(position.getPreviousLocation().getZ()) - : position.getLocation().clone().setX(position.getPreviousLocation().getX()); - if(!position.getLocation().equals(updatePointXZ)) - function.accept(updatePointXZ); - } - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Basic.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Basic.java deleted file mode 100644 index 475445e..0000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Basic.java +++ /dev/null @@ -1,54 +0,0 @@ -package de.steamwar.bausystem.tracer.show.mode; - -import de.steamwar.bausystem.tracer.*; -import de.steamwar.bausystem.tracer.show.ShowMode; -import de.steamwar.bausystem.tracer.show.ShowModeParameter; -import de.steamwar.core.VersionedCallable; -import org.bukkit.entity.Player; -import org.bukkit.util.Vector; - -import java.util.HashMap; -import java.util.Map; - -public class Basic implements ShowMode { - - protected final Player player; - protected final ShowModeParameter showModeParameter; - - private final Map tntEntityMap = new HashMap<>(); - - public Basic(Player player, ShowModeParameter showModeParameter) { - this.player = player; - this.showModeParameter = showModeParameter; - } - - @Override - public void show(TNTPosition position) { - if (!showModeParameter.isWater() && position.isExploded() && checkWater(position.getLocation())) { - for(TNTPosition pos : position.getRecord().getPositions()){ - RoundedTNTPosition roundedTNTPosition = new RoundedTNTPosition(pos); - tntEntityMap.computeIfPresent(roundedTNTPosition, (p, tnt) -> tnt.hide(player, false) ? null : tnt); - } - return; - } - RoundedTNTPosition roundedTNTPosition = new RoundedTNTPosition(position); - AbstractTraceEntity entity = tntEntityMap.computeIfAbsent(roundedTNTPosition, pos -> createEntity(position.getLocation(), true)); - entity.display(player, position.isExploded()); - } - - protected boolean checkWater(Vector position) { - return VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.inWater(player.getWorld(), position), 8), - new VersionedCallable<>(() -> TNTTracer_15.inWater(player.getWorld(), position), 14)); - } - - protected AbstractTraceEntity createEntity(Vector position, boolean tnt) { - return VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.create(player.getWorld(), position, tnt), 8), - new VersionedCallable<>(() -> TNTTracer_15.create(player.getWorld(), position, tnt), 14)); - } - - @Override - public void hide() { - tntEntityMap.forEach((roundedTNTPosition, abstractTraceEntity) -> abstractTraceEntity.hide(player, true)); - tntEntityMap.clear(); - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/EntityShowMode.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/EntityShowMode.java new file mode 100644 index 0000000..bd7e8d7 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/EntityShowMode.java @@ -0,0 +1,119 @@ +/* + * + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * / + */ + +package de.steamwar.bausystem.tracer.show.mode; + +import de.steamwar.bausystem.tracer.*; +import de.steamwar.bausystem.tracer.show.ShowMode; +import de.steamwar.bausystem.tracer.show.ShowModeParameter; +import de.steamwar.core.VersionedCallable; +import org.bukkit.entity.Player; +import org.bukkit.util.Consumer; +import org.bukkit.util.Vector; + +import java.util.HashMap; +import java.util.Map; + +public class EntityShowMode implements ShowMode { + + protected final Player player; + protected final ShowModeParameter showModeParameter; + + private final Map tntEntityMap = new HashMap<>(); + private final Map updateEntityMap = new HashMap<>(); + + public EntityShowMode(Player player, ShowModeParameter showModeParameter) { + this.player = player; + this.showModeParameter = showModeParameter; + } + + @Override + public void show(TNTPosition position) { + if (!showModeParameter.isWater() && position.isExploded() && checkWater(position.getLocation())) { + // Basic + for (TNTPosition pos : position.getRecord().getPositions()) { + RoundedTNTPosition roundedTNTPosition = new RoundedTNTPosition(pos); + tntEntityMap.computeIfPresent(roundedTNTPosition, (p, tnt) -> { + return tnt.hide(player, false) ? null : tnt; + }); + } + // Advanced + for (TNTPosition pos : position.getRecord().getPositions()) { + applyOnPosition(pos, updatePointPosition -> { + updateEntityMap.computeIfPresent(new RoundedTNTPosition(updatePointPosition), (p, point) -> { + return point.hide(player, false) ? null : point; + }); + }); + } + return; + } + + RoundedTNTPosition roundedTNTPosition = new RoundedTNTPosition(position); + AbstractTraceEntity entity = tntEntityMap.computeIfAbsent(roundedTNTPosition, pos -> createEntity(position.getLocation(), true)); + entity.display(player, position.isExploded()); + + applyOnPosition(position, updatePointPosition -> { + updateEntityMap.computeIfAbsent(new RoundedTNTPosition(updatePointPosition), pos -> { + return createEntity(updatePointPosition, false); + }).display(player, position.isExploded()); + }); + } + + private boolean checkWater(Vector position) { + return VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.inWater(player.getWorld(), position), 8), + new VersionedCallable<>(() -> TNTTracer_15.inWater(player.getWorld(), position), 14)); + } + + private AbstractTraceEntity createEntity(Vector position, boolean tnt) { + return VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.create(player.getWorld(), position, tnt), 8), + new VersionedCallable<>(() -> TNTTracer_15.create(player.getWorld(), position, tnt), 14)); + } + + private void applyOnPosition(TNTPosition position, Consumer function) { + if (position.getPreviousLocation() == null) return; + + if (showModeParameter.isInterpolate_Y()) { + Vector updatePointY = position.getPreviousLocation().clone().setY(position.getLocation().getY()); + if (!position.getLocation().equals(updatePointY)) { + function.accept(updatePointY); + } + } + + if (showModeParameter.isInterpolate_XZ()) { + Vector movement = position.getLocation().clone().subtract(position.getPreviousLocation()); + Vector updatePointXZ = Math.abs(movement.getX()) > Math.abs(movement.getZ()) + ? position.getLocation().clone().setZ(position.getPreviousLocation().getZ()) + : position.getLocation().clone().setX(position.getPreviousLocation().getX()); + if (!position.getLocation().equals(updatePointXZ)) { + function.accept(updatePointXZ); + } + } + } + + @Override + public void hide() { + tntEntityMap.forEach((roundedTNTPosition, abstractTraceEntity) -> abstractTraceEntity.hide(player, true)); + tntEntityMap.clear(); + updateEntityMap.forEach((roundedTNTPosition, abstractTraceEntity) -> abstractTraceEntity.hide(player, true)); + updateEntityMap.clear(); + } + +} From 7f55dddd8ffbb6d2d2397adf12b919dd8ba9fd15 Mon Sep 17 00:00:00 2001 From: jojo Date: Wed, 27 Jan 2021 13:56:40 +0100 Subject: [PATCH 07/10] Add '-a' as alias for '-advanced' to ShowModeParameter parsing --- .../src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java index e88c2c9..ad571d6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java @@ -87,6 +87,7 @@ public class ShowModeParameter { showModeParameter.interpolate_XZ = true; break; case "-advanced": + case "-a": showModeParameter.interpolate_Y = true; showModeParameter.interpolate_XZ = true; break; From c7584cd9520ed0eccaabe10ffd5193f5825eac12 Mon Sep 17 00:00:00 2001 From: jojo Date: Wed, 27 Jan 2021 15:26:06 +0100 Subject: [PATCH 08/10] Fix pr stuff --- .../de/steamwar/bausystem/commands/CommandTrace.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java index 8ca73f4..3d30f71 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java @@ -90,7 +90,6 @@ public class CommandTrace implements CommandExecutor { case "show": if (args.length < 2) { TraceShowManager.show(player, new EntityShowMode(player, new ShowModeParameter())); - // TraceShowManager.show(player, new Basic(player, new ShowModeParameter())); } else { if (args[1].equalsIgnoreCase("gui")) { GuiTraceShow.openGui(player); @@ -98,16 +97,6 @@ public class CommandTrace implements CommandExecutor { } ShowModeParameter showModeParameter = ShowModeParameter.parseArguments(args, 1); TraceShowManager.show(player, new EntityShowMode(player, showModeParameter)); - /*switch (args[1].toLowerCase()) { - case "advanced": - TraceShowManager.show(player, new Advanced(player, showModeParameter)); - break; - case "basic": - case "default": - default: - TraceShowManager.show(player, new Basic(player, showModeParameter)); - break; - }*/ } player.sendMessage(BauSystem.PREFIX + "§aAlle TNT-Positionen angezeigt"); break; From 440717f1f5450e021636cf54245d757021a3e6ab Mon Sep 17 00:00:00 2001 From: jojo Date: Sat, 30 Jan 2021 11:22:43 +0100 Subject: [PATCH 09/10] Add ShowModeParameter 'advanced' --- .../steamwar/bausystem/commands/CommandTraceTabCompleter.java | 2 +- .../de/steamwar/bausystem/tracer/show/ShowModeParameter.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java index 609a936..47e9912 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java @@ -39,7 +39,7 @@ public class CommandTraceTabCompleter implements TabCompleter { tabCompletes.add(new TabComplete((player, args) -> args.length == 1 && (RecordStateMachine.getRecordStatus() == RecordStatus.IDLE || RecordStateMachine.getRecordStatus() == RecordStatus.IDLE_AUTO), "start")); tabCompletes.add(new TabComplete((player, args) -> args.length == 1 && (RecordStateMachine.getRecordStatus() != RecordStatus.IDLE && RecordStateMachine.getRecordStatus() != RecordStatus.IDLE_AUTO), "stop")); tabCompletes.add(new TabComplete((player, args) -> args.length == 1, "toggleauto", "auto", "show", "hide", "delete", "clear")); - tabCompletes.add(new TabComplete((player, args) -> args.length == 2 && args[0].equalsIgnoreCase("show"), "gui", "-interpolate-xz", "-interpolate-y", "-water", "-advanced")); + tabCompletes.add(new TabComplete((player, args) -> args.length == 2 && args[0].equalsIgnoreCase("show"), "gui", "-interpolate-xz", "-interpolate-y", "-water", "-advanced", "advanced")); tabCompletes.add(new TabComplete((player, args) -> args.length > 2 && args[0].equalsIgnoreCase("show") && !args[1].equalsIgnoreCase("gui"), "-interpolate-xz", "-interpolate-y", "-water", "-advanced")); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java index ad571d6..7c4722d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java @@ -86,6 +86,7 @@ public class ShowModeParameter { case "-xz": showModeParameter.interpolate_XZ = true; break; + case "advanced": case "-advanced": case "-a": showModeParameter.interpolate_Y = true; From 88b9ae0ec4b74ad4e563983ddb954343b2260b9b Mon Sep 17 00:00:00 2001 From: jojo Date: Wed, 3 Feb 2021 11:12:27 +0100 Subject: [PATCH 10/10] Fix tnt spawning on redstone sources --- .../de/steamwar/bausystem/commands/CommandFreeze.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandFreeze.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandFreeze.java index c158459..8ab7445 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandFreeze.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandFreeze.java @@ -19,7 +19,9 @@ package de.steamwar.bausystem.commands; -import de.steamwar.bausystem.world.Region; +import de.steamwar.bausystem.BauSystem; +import org.bukkit.Bukkit; +import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; import org.bukkit.event.block.*; @@ -53,6 +55,11 @@ public class CommandFreeze extends ToggleCommand { @EventHandler public void onEntitySpawn(EntitySpawnEvent e) { e.setCancelled(true); + if (e.getEntityType() == EntityType.PRIMED_TNT) { + Bukkit.getScheduler().runTaskLater(BauSystem.getPlugin(), () -> { + e.getLocation().getBlock().setType(Material.TNT, false); + }, 1); + } } @EventHandler