Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 08:30:09 +01: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:
Ursprung
8bec05ed38
Commit
824ff375d4
@ -24,6 +24,7 @@ package com.viaversion.viaversion.api.minecraft;
|
|||||||
|
|
||||||
public enum GameMode {
|
public enum GameMode {
|
||||||
|
|
||||||
|
NOT_SET(""),
|
||||||
SURVIVAL("Survival Mode"),
|
SURVIVAL("Survival Mode"),
|
||||||
CREATIVE("Creative Mode"),
|
CREATIVE("Creative Mode"),
|
||||||
ADVENTURE("Adventure Mode"),
|
ADVENTURE("Adventure Mode"),
|
||||||
@ -41,11 +42,11 @@ public enum GameMode {
|
|||||||
|
|
||||||
public static GameMode getById(int id) {
|
public static GameMode getById(int id) {
|
||||||
return switch (id) {
|
return switch (id) {
|
||||||
case 0 -> SURVIVAL;
|
case -1 -> NOT_SET;
|
||||||
case 1 -> CREATIVE;
|
case 1 -> CREATIVE;
|
||||||
case 2 -> ADVENTURE;
|
case 2 -> ADVENTURE;
|
||||||
case 3 -> SPECTATOR;
|
case 3 -> SPECTATOR;
|
||||||
default -> throw new IllegalArgumentException("Unknown gamemode id: " + id);
|
default /*0*/ -> SURVIVAL;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren