mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-12-12 15:07:22 +01:00
Unfortunately can't compile locally atm
This commit is contained in:
parent
0c0129a116
commit
c2d7bf96b3
@ -2,6 +2,7 @@ package me.libraryaddict.disguise.utilities.params;
|
||||
|
||||
import me.libraryaddict.disguise.utilities.parser.DisguiseParseException;
|
||||
import me.libraryaddict.disguise.utilities.translations.TranslateType;
|
||||
import org.bukkit.Keyed;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
@ -44,8 +45,14 @@ public abstract class ParamInfo<T> {
|
||||
|
||||
this.possibleValues = new LinkedHashMap<>();
|
||||
|
||||
for (T anEnum : possibleValues) {
|
||||
this.getValues().put(((Enum) anEnum).name(), anEnum);
|
||||
if (paramClass.isEnum()) {
|
||||
for (T anEnum : possibleValues) {
|
||||
this.getValues().put(((Enum) anEnum).name(), anEnum);
|
||||
}
|
||||
} else {
|
||||
for (T anEnum : possibleValues) {
|
||||
this.getValues().put(((Keyed) anEnum).getKey().getKey(), anEnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ public class ParamInfoTypes {
|
||||
}
|
||||
|
||||
if (NmsVersion.v1_20_R4.isSupported()) {
|
||||
// paramInfos.add(new ParamInfoEnum(Wolf.Variant.class, "Wolf Variant", "The variant of a wolf"));
|
||||
paramInfos.add(new ParamInfoEnum(Wolf.Variant.class, "Wolf Variant", "The variant of a wolf"));
|
||||
}
|
||||
|
||||
if (NmsVersion.v1_21_R1.isSupported()) {
|
||||
|
@ -2,6 +2,8 @@ package me.libraryaddict.disguise.utilities.params.types;
|
||||
|
||||
import me.libraryaddict.disguise.utilities.params.ParamInfo;
|
||||
import me.libraryaddict.disguise.utilities.parser.DisguiseParseException;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Keyed;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -10,7 +12,8 @@ import java.util.Map;
|
||||
*/
|
||||
public class ParamInfoEnum<T> extends ParamInfo<T> {
|
||||
public ParamInfoEnum(Class<T> paramClass, String name, String description) {
|
||||
super(paramClass, name, name, description, paramClass.getEnumConstants());
|
||||
super(paramClass, name, name, description,
|
||||
paramClass.isEnum() ? paramClass.getEnumConstants() : (T[]) Bukkit.getRegistry((Class<Keyed>) paramClass).stream().toArray());
|
||||
}
|
||||
|
||||
public ParamInfoEnum(Class paramClass, String name, String valueType, String description, T[] possibleValues) {
|
||||
|
Loading…
Reference in New Issue
Block a user