3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-07-03 22:18:04 +02:00

Fix GameMode#getById behaviour in 1.8->1.9 (#3947)

Vanilla fallbacks to SURVIVAL and doesn't throw any errors,
also NOT_SET was missing previously.
Dieser Commit ist enthalten in:
EnZaXD 2024-06-16 22:28:50 +02:00 committet von GitHub
Ursprung 8bec05ed38
Commit 824ff375d4
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194

Datei anzeigen

@ -24,6 +24,7 @@ package com.viaversion.viaversion.api.minecraft;
public enum GameMode {
NOT_SET(""),
SURVIVAL("Survival Mode"),
CREATIVE("Creative Mode"),
ADVENTURE("Adventure Mode"),
@ -41,11 +42,11 @@ public enum GameMode {
public static GameMode getById(int id) {
return switch (id) {
case 0 -> SURVIVAL;
case -1 -> NOT_SET;
case 1 -> CREATIVE;
case 2 -> ADVENTURE;
case 3 -> SPECTATOR;
default -> throw new IllegalArgumentException("Unknown gamemode id: " + id);
default /*0*/ -> SURVIVAL;
};
}
}