made ProtocolVersion comparable
This commit is contained in:
parent
555f5ab65c
commit
69b72ef90d
@ -3,6 +3,7 @@ package fr.pandacube.lib.core.mc_version;
|
||||
import fr.pandacube.lib.core.json.Json;
|
||||
import fr.pandacube.lib.util.Log;
|
||||
import fr.pandacube.lib.util.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
@ -13,7 +14,6 @@ import java.net.http.HttpResponse;
|
||||
import java.net.http.HttpResponse.BodyHandlers;
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
@ -28,7 +28,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
* An instance of this class provides information related to a protocol version
|
||||
* (the protocol version number and all the corresponding Minecraft versions).
|
||||
*/
|
||||
public class ProtocolVersion {
|
||||
public class ProtocolVersion implements Comparable<ProtocolVersion> {
|
||||
|
||||
private static final String ONLINE_DATA_URL = "https://api.pandacube.fr/rest/mcversion";
|
||||
|
||||
@ -215,4 +215,9 @@ public class ProtocolVersion {
|
||||
public int hashCode() {
|
||||
return protocolVersionNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull ProtocolVersion o) {
|
||||
return Integer.compare(protocolVersionNumber, o.protocolVersionNumber);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user