From 02f2384374db9dace6c52b23ea9a3e3e26c27d1d Mon Sep 17 00:00:00 2001 From: sirjonasxx <36828922+sirjonasxx@users.noreply.github.com> Date: Tue, 6 Nov 2018 20:46:11 +0100 Subject: [PATCH] block & replace logics and bugfix --- .../blockreplacepackets/BlockAndReplacePackets.java | 10 +++++++++- .../src/main/java/gearth/ui/UiLoggerController.java | 1 + .../java/gearth/ui/logger/loggerdisplays/UiLogger.java | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Extensions/BlockReplacePackets/src/main/java/extensions/blockreplacepackets/BlockAndReplacePackets.java b/Extensions/BlockReplacePackets/src/main/java/extensions/blockreplacepackets/BlockAndReplacePackets.java index db62f0b..0e7337c 100644 --- a/Extensions/BlockReplacePackets/src/main/java/extensions/blockreplacepackets/BlockAndReplacePackets.java +++ b/Extensions/BlockReplacePackets/src/main/java/extensions/blockreplacepackets/BlockAndReplacePackets.java @@ -2,6 +2,7 @@ package extensions.blockreplacepackets; import extensions.blockreplacepackets.rules.BlockReplaceRule; import extensions.blockreplacepackets.rules.RuleFactory; +import gearth.extensions.Extension; import gearth.protocol.HMessage; import gearth.protocol.HPacket; import gearth.ui.GEarthController; @@ -173,7 +174,14 @@ public class BlockAndReplacePackets extends ExtensionForm { @Override protected void initExtension() { - intercept(HMessage.Side.TOSERVER, message -> System.out.println("just testing")); + Extension.MessageListener messageListener = message -> { + for (BlockReplaceRule rule : rules) { + rule.appendRuleToMessage(message); + } + }; + + intercept(HMessage.Side.TOSERVER, messageListener); + intercept(HMessage.Side.TOCLIENT, messageListener); } @Override diff --git a/G-Earth/src/main/java/gearth/ui/UiLoggerController.java b/G-Earth/src/main/java/gearth/ui/UiLoggerController.java index 327d5b8..8ae1a11 100644 --- a/G-Earth/src/main/java/gearth/ui/UiLoggerController.java +++ b/G-Earth/src/main/java/gearth/ui/UiLoggerController.java @@ -53,6 +53,7 @@ public class UiLoggerController implements Initializable { initialized = true; if (!appendLater.isEmpty()) { appendLog(appendLater); + appendLater.clear(); } } diff --git a/G-Earth/src/main/java/gearth/ui/logger/loggerdisplays/UiLogger.java b/G-Earth/src/main/java/gearth/ui/logger/loggerdisplays/UiLogger.java index 2855660..aea5c64 100644 --- a/G-Earth/src/main/java/gearth/ui/logger/loggerdisplays/UiLogger.java +++ b/G-Earth/src/main/java/gearth/ui/logger/loggerdisplays/UiLogger.java @@ -28,6 +28,7 @@ public class UiLogger implements PacketLogger { for (Elem elem : appendLater) { controller.appendMessage(elem.packet, elem.types); } + appendLater.clear(); } stage = new Stage();