Starting with remove Instance-Getter of ProtocolBridge

This commit is contained in:
Finn
2025-11-03 18:31:29 +01:00
parent c9b6d50be6
commit f5afd9c3e7
11 changed files with 176 additions and 112 deletions

View File

@@ -31,13 +31,6 @@ import java.net.Proxy;
* It manages the protocol settings, version, and side instances.
*/
public final class ProtocolBridge {
/**
* The singleton instance of the ProtocolBridge class
*/
@Getter
private static ProtocolBridge instance;
/**
* The protocol settings for the current connection
*/
@@ -115,6 +108,7 @@ public final class ProtocolBridge {
public ProtocolBridge(ProtocolDNSServer protocolDNSServer, ProtocolSettings protocolSettings, ProtocolVersion protocolVersion, File logFolder) throws Exception {
// Assign the parameters to the class fields
this.protocolDNSServer = protocolDNSServer;
this.protocolDNSServer.setProtocolBridge(this);
this.protocolSettings = protocolSettings;
this.protocolVersion = protocolVersion;
@@ -125,9 +119,6 @@ public final class ProtocolBridge {
// Register the appropriate listeners and packets
registerListeners();
registerPackets();
// Set the static instance to this instance
instance = this;
}
/**
@@ -143,6 +134,7 @@ public final class ProtocolBridge {
public ProtocolBridge(ProtocolWebServer protocolWebServer, ProtocolSettings protocolSettings, ProtocolVersion protocolVersion, File logFolder) throws Exception {
// Assign the parameters to the class fields
this.protocolWebServer = protocolWebServer;
this.protocolWebServer.setProtocolBridge(this);
this.protocolSettings = protocolSettings;
this.protocolVersion = protocolVersion;
@@ -153,9 +145,6 @@ public final class ProtocolBridge {
// Register the appropriate listeners and packets
registerListeners();
registerPackets();
// Set the static instance to this instance
instance = this;
}
/**
@@ -171,6 +160,7 @@ public final class ProtocolBridge {
public ProtocolBridge(ProtocolClient protocolClient, ProtocolSettings protocolSettings, ProtocolVersion protocolVersion, File logFolder) throws Exception {
// Assign the parameters to the class fields
this.protocolClient = protocolClient;
this.protocolClient.setProtocolBridge(this);
this.protocolSettings = protocolSettings;
this.protocolVersion = protocolVersion;
@@ -181,9 +171,6 @@ public final class ProtocolBridge {
// Register the appropriate listeners and packets
registerListeners();
registerPackets();
// Set the static instance to this instance
instance = this;
}
/**