From 2e863245445037abaf0da850545304f126fcf5ac Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 11 Jun 2022 20:54:26 +0200 Subject: [PATCH] Add auto trace back to the gui Signed-off-by: yoyosource --- .../features/simulator/gui/TNTSimulatorGui.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 d959aae0..f09832cf 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 @@ -20,6 +20,7 @@ package de.steamwar.bausystem.features.simulator.gui; import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.configplayer.Config; import de.steamwar.bausystem.features.simulator.TNTSimulator; import de.steamwar.bausystem.features.simulator.tnt.SimulatorElement; import de.steamwar.bausystem.features.simulator.tnt.TNTElement; @@ -67,9 +68,15 @@ public class TNTSimulatorGui { inv.setItem(47, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("SIMULATOR_BACK", player), clickType -> back.run())); } if (currentTntSimulator != null) { - inv.setItem(49, new SWItem(Material.MAGENTA_GLAZED_TERRACOTTA, BauSystem.MESSAGE.parse("SIMULATOR_GUI_MOVE_ALL", player), clickType -> { + inv.setItem(50, new SWItem(Material.MAGENTA_GLAZED_TERRACOTTA, BauSystem.MESSAGE.parse("SIMULATOR_GUI_MOVE_ALL", player), clickType -> { moveAll(player, currentTntSimulator, () -> open(player, currentTntSimulator, currentTntGroup, simulatorElements, back)); })); + + boolean simulatorAutoTrace = Config.getInstance().get(player).getPlainValueOrDefault("simulatorAutoTrace", false); + inv.setItem(48, new SWItem(simulatorAutoTrace ? Material.CHAIN_COMMAND_BLOCK : Material.COMMAND_BLOCK, BauSystem.MESSAGE.parse("SIMULATOR_GUI_AUTO_TRACE", player, simulatorAutoTrace), clickType -> { + Config.getInstance().get(player).put("simulatorAutoTrace", !simulatorAutoTrace); + open(player, currentTntSimulator, currentTntGroup, simulatorElements, back); + })); } if (currentTntGroup != null) { Runnable editObserver = () -> {