Fix GameMode integer ids.
This commit is contained in:
parent
d3c025b288
commit
bbf974f348
@ -28,10 +28,32 @@ public class TypeGameMode extends TypeEnum<GameMode>
|
||||
{
|
||||
Set<String> ret = new MassiveSet<String>(super.getIdsInner(value));
|
||||
|
||||
String id = String.valueOf(value.ordinal());
|
||||
ret.add(id);
|
||||
int idInt = getIntegerId(value);
|
||||
String idString = String.valueOf(idInt);
|
||||
ret.add(idString);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// UTIL
|
||||
// -------------------------------------------- //
|
||||
// The reason we can not simply do ".ordinal()" is Survival and Creative has the wrong order.
|
||||
|
||||
public static int getIntegerId(GameMode gameMode)
|
||||
{
|
||||
if (gameMode == null) throw new NullPointerException("gameMode");
|
||||
|
||||
switch (gameMode)
|
||||
{
|
||||
case SURVIVAL: return 0;
|
||||
case CREATIVE: return 1;
|
||||
case ADVENTURE: return 2;
|
||||
case SPECTATOR: return 3;
|
||||
}
|
||||
|
||||
return gameMode.ordinal();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user