- Small bug fixing
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>me.finn.unlegitlibrary</groupId>
|
<groupId>me.finn.unlegitlibrary</groupId>
|
||||||
<artifactId>unlegitlibrary</artifactId>
|
<artifactId>unlegitlibrary</artifactId>
|
||||||
<version>1.6.0</version>
|
<version>1.6.1</version>
|
||||||
<url>https://unlegitdqrk.dev/UnlegitLibrary/</url>
|
<url>https://unlegitdqrk.dev/UnlegitLibrary/</url>
|
||||||
<description>Just a big library</description>
|
<description>Just a big library</description>
|
||||||
|
|
||||||
|
@@ -5,6 +5,7 @@ import me.finn.unlegitlibrary.network.system.client.events.*;
|
|||||||
import me.finn.unlegitlibrary.network.system.packets.Packet;
|
import me.finn.unlegitlibrary.network.system.packets.Packet;
|
||||||
import me.finn.unlegitlibrary.network.system.packets.PacketHandler;
|
import me.finn.unlegitlibrary.network.system.packets.PacketHandler;
|
||||||
import me.finn.unlegitlibrary.network.system.packets.impl.ClientIDPacket;
|
import me.finn.unlegitlibrary.network.system.packets.impl.ClientIDPacket;
|
||||||
|
import me.finn.unlegitlibrary.network.system.server.ConnectionHandler;
|
||||||
import me.finn.unlegitlibrary.network.utils.PemUtils;
|
import me.finn.unlegitlibrary.network.utils.PemUtils;
|
||||||
import me.finn.unlegitlibrary.utils.DefaultMethodsOverrider;
|
import me.finn.unlegitlibrary.utils.DefaultMethodsOverrider;
|
||||||
import me.finn.unlegitlibrary.utils.Logger;
|
import me.finn.unlegitlibrary.utils.Logger;
|
||||||
@@ -174,6 +175,12 @@ public final class NetworkClient {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (!(obj instanceof NetworkClient target)) return false;
|
||||||
|
return target.getClientID() == clientID;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean sendPacket(Packet packet) throws IOException, ClassNotFoundException {
|
public boolean sendPacket(Packet packet) throws IOException, ClassNotFoundException {
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
boolean sent = packetHandler.sendPacket(packet, outputStream);
|
boolean sent = packetHandler.sendPacket(packet, outputStream);
|
||||||
|
@@ -19,6 +19,12 @@ public class ConnectionHandler {
|
|||||||
private ObjectInputStream inputStream;
|
private ObjectInputStream inputStream;
|
||||||
private final NetworkServer server;
|
private final NetworkServer server;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (!(obj instanceof ConnectionHandler target)) return false;
|
||||||
|
return target.getClientID() == clientID;
|
||||||
|
}
|
||||||
|
|
||||||
public SSLSocket getSocket() {
|
public SSLSocket getSocket() {
|
||||||
return socket;
|
return socket;
|
||||||
}
|
}
|
||||||
|
@@ -33,6 +33,17 @@ public final class NetworkServer {
|
|||||||
return connectionHandlers;
|
return connectionHandlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ConnectionHandler getConnectionHandlerByID(int clientID) {
|
||||||
|
for (ConnectionHandler connectionHandler : connectionHandlers) if (connectionHandler.getClientID() == clientID) return connectionHandler;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (!(obj instanceof NetworkServer target)) return false;
|
||||||
|
return super.equals(obj);
|
||||||
|
}
|
||||||
|
|
||||||
public int getPort() {
|
public int getPort() {
|
||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
@@ -53,7 +64,7 @@ public final class NetworkServer {
|
|||||||
return eventManager;
|
return eventManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean requireClientCert;
|
private final boolean requireClientCert;
|
||||||
|
|
||||||
private NetworkServer(int port, PacketHandler packetHandler, EventManager eventManager,
|
private NetworkServer(int port, PacketHandler packetHandler, EventManager eventManager,
|
||||||
Logger logger, int timeout, SSLServerSocketFactory factory, boolean requireClientCert) {
|
Logger logger, int timeout, SSLServerSocketFactory factory, boolean requireClientCert) {
|
||||||
|
Reference in New Issue
Block a user