Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Smudgge committed Mar 11, 2024
1 parent 1d3c07d commit 96a8c03
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/github/kerbity/kerb/server/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ public byte[] getHashedPassword(byte[] salt) {
return this.connectionList;
}

private void cleanConnectionList() {
public void cleanConnectionList() {
this.connectionList.remove(null);
if (this.connectionList.contains(null)) this.cleanConnectionList();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ public void removeDuplicateNames() {
if (!serverConnection.getName().equals(this.getName())) continue;
serverConnection.disconnect();
}
this.server.cleanConnectionList();
}

private boolean validate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import com.github.minemaniauk.developertools.console.Logger;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;

/**
* Represents the list command.
* Used to list the connected clients to the server.
Expand All @@ -47,6 +49,12 @@ public void execute(@NotNull Server server, @NotNull String command) {
logger.log("&rServer Connections &e" + server.getConnectionList().size());

for (ServerConnection connection : server.getConnectionList()) {

if (connection == null) {
logger.warn("Something went wrong! One of the connections returned null.");
continue;
}

RegisteredClient client = connection.getRegisteredClient();
logger.log("&7{identifier} &r{name} &7is_valid:&7{is_valid}"
.replace("{identifier}", client.getIdentifier())
Expand Down

0 comments on commit 96a8c03

Please sign in to comment.