3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

ServerInfo is now comparable

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-09-07 17:03:04 -04:00
Ursprung 983f3012a6
Commit 260f7f575a

Datei anzeigen

@ -9,7 +9,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
* ServerInfo represents a server that a player can connect to. This object is immutable and safe * ServerInfo represents a server that a player can connect to. This object is immutable and safe
* for concurrent access. * for concurrent access.
*/ */
public final class ServerInfo { public final class ServerInfo implements Comparable<ServerInfo> {
private final String name; private final String name;
private final InetSocketAddress address; private final InetSocketAddress address;
@ -58,4 +58,9 @@ public final class ServerInfo {
public final int hashCode() { public final int hashCode() {
return Objects.hash(name, address); return Objects.hash(name, address);
} }
@Override
public int compareTo(ServerInfo o) {
return this.name.compareTo(o.getName());
}
} }