mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-30 04:00:50 +01:00
it did
This commit is contained in:
parent
3735799629
commit
2512678eb4
@ -22,7 +22,7 @@ public abstract class ExtensionBase extends IExtension {
|
||||
protected final Map<Integer, List<MessageListener>> incomingMessageListeners = new HashMap<>();
|
||||
protected final Map<Integer, List<MessageListener>> outgoingMessageListeners = new HashMap<>();
|
||||
|
||||
protected PacketInfoManager packetInfoManager = new PacketInfoManager(new ArrayList<>()); // empty
|
||||
volatile PacketInfoManager packetInfoManager = PacketInfoManager.EMPTY;
|
||||
|
||||
/**
|
||||
* Register a listener on a specific packet Type
|
||||
@ -131,7 +131,7 @@ public abstract class ExtensionBase extends IExtension {
|
||||
return onConnectionObservable;
|
||||
}
|
||||
|
||||
protected void setPacketInfoManager(PacketInfoManager packetInfoManager) {
|
||||
void setPacketInfoManager(PacketInfoManager packetInfoManager) {
|
||||
this.packetInfoManager = packetInfoManager;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package gearth.extensions;
|
||||
|
||||
import gearth.services.packet_info.PacketInfoManager;
|
||||
import javafx.application.Platform;
|
||||
import javafx.stage.Stage;
|
||||
import gearth.protocol.HMessage;
|
||||
@ -47,6 +48,11 @@ public abstract class ExtensionForm extends ExtensionBase {
|
||||
extension.onConnect(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketInfoManager getPacketInfoManager() {
|
||||
return extension.getPacketInfoManager();
|
||||
}
|
||||
|
||||
protected void onShow(){};
|
||||
protected void onHide(){};
|
||||
|
||||
|
@ -68,9 +68,7 @@ public class BlockAndReplacePackets extends ExtensionForm {
|
||||
txt_replacement.textProperty().addListener(event -> Platform.runLater(this::refreshOptions));
|
||||
txt_value.textProperty().addListener(event -> Platform.runLater(this::refreshOptions));
|
||||
|
||||
refreshOptions();
|
||||
cmb_type.requestFocus();
|
||||
|
||||
}
|
||||
|
||||
private String getVal() {
|
||||
@ -80,8 +78,8 @@ public class BlockAndReplacePackets extends ExtensionForm {
|
||||
|
||||
if (type.endsWith("packet")) {
|
||||
HMessage.Direction dir = side.equals("Outgoing") ? HMessage.Direction.TOSERVER : HMessage.Direction.TOCLIENT;
|
||||
PacketInfo fromName = packetInfoManager.getPacketInfoFromName(dir, val);
|
||||
PacketInfo fromHash = packetInfoManager.getPacketInfoFromHash(dir, val);
|
||||
PacketInfo fromName = getPacketInfoManager().getPacketInfoFromName(dir, val);
|
||||
PacketInfo fromHash = getPacketInfoManager().getPacketInfoFromHash(dir, val);
|
||||
if (fromName != null) {
|
||||
val = fromName.getHeaderId() +"";
|
||||
}
|
||||
@ -208,6 +206,8 @@ public class BlockAndReplacePackets extends ExtensionForm {
|
||||
|
||||
intercept(HMessage.Direction.TOSERVER, messageListener);
|
||||
intercept(HMessage.Direction.TOCLIENT, messageListener);
|
||||
|
||||
refreshOptions();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -231,7 +231,7 @@ public class BlockAndReplacePackets extends ExtensionForm {
|
||||
|
||||
public void click_btnAddRule(ActionEvent actionEvent) {
|
||||
BlockReplaceRule rule = RuleFactory.getRule(cmb_type.getSelectionModel().getSelectedItem(),
|
||||
cmb_side.getSelectionModel().getSelectedItem(), getVal(), txt_replacement.getText(), packetInfoManager);
|
||||
cmb_side.getSelectionModel().getSelectedItem(), getVal(), txt_replacement.getText(), getPacketInfoManager());
|
||||
rules.add(rule);
|
||||
rule.onDelete(observable -> rules.remove(rule));
|
||||
new RuleContainer(rule, vbox);
|
||||
|
@ -111,7 +111,7 @@ public class PacketInfoExplorer extends ExtensionForm {
|
||||
@Override
|
||||
protected void initExtension() {
|
||||
onConnect((host, port, hotelversion, clientIdentifier, clientType) -> {
|
||||
init(packetInfoManager);
|
||||
init(getPacketInfoManager());
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user