From 260f7f575aaf1b589c80b042e9c17a2c1d427d16 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sat, 7 Sep 2019 17:03:04 -0400 Subject: [PATCH] ServerInfo is now comparable --- .../com/velocitypowered/api/proxy/server/ServerInfo.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/com/velocitypowered/api/proxy/server/ServerInfo.java b/api/src/main/java/com/velocitypowered/api/proxy/server/ServerInfo.java index e1317f9e8..83e5e33e1 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/server/ServerInfo.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/server/ServerInfo.java @@ -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 * for concurrent access. */ -public final class ServerInfo { +public final class ServerInfo implements Comparable { private final String name; private final InetSocketAddress address; @@ -58,4 +58,9 @@ public final class ServerInfo { public final int hashCode() { return Objects.hash(name, address); } + + @Override + public int compareTo(ServerInfo o) { + return this.name.compareTo(o.getName()); + } }