Geyser/api/src/main/java/org/geysermc/api/AuthType.java

30 lines
675 B
Java

package org.geysermc.api;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum AuthType {
OFFLINE("offline"),
ONLINE("online"),
FLOODGATE("floodgate");
public static final AuthType[] VALUES = values();
private String name;
public static AuthType getById(int id) {
return id < VALUES.length ? VALUES[id] : OFFLINE;
}
public static AuthType getByName(String name) {
String lowerCase = name.toLowerCase();
for (AuthType type : VALUES) {
if (type.getName().equals(lowerCase)) {
return type;
}
}
return OFFLINE;
}
}