block & replace logics and bugfix

This commit is contained in:
sirjonasxx 2018-11-06 20:46:11 +01:00
parent e141cf0f2c
commit 02f2384374
3 changed files with 11 additions and 1 deletions

View File

@ -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

View File

@ -53,6 +53,7 @@ public class UiLoggerController implements Initializable {
initialized = true;
if (!appendLater.isEmpty()) {
appendLog(appendLater);
appendLater.clear();
}
}

View File

@ -28,6 +28,7 @@ public class UiLogger implements PacketLogger {
for (Elem elem : appendLater) {
controller.appendMessage(elem.packet, elem.types);
}
appendLater.clear();
}
stage = new Stage();