Fix ChatColor not turnable into a string

This commit is contained in:
libraryaddict 2021-08-01 13:17:44 +12:00
parent 99227518ac
commit 8ff92e2760
3 changed files with 22 additions and 1 deletions

View File

@ -58,6 +58,10 @@ public class ParamInfoManager {
} }
public static ParamInfo getParamInfo(Class c) { public static ParamInfo getParamInfo(Class c) {
if (c.isAnonymousClass()) {
c = c.getSuperclass();
}
for (ParamInfo info : getParamInfos()) { for (ParamInfo info : getParamInfos()) {
if (!info.isParam(c)) { if (!info.isParam(c)) {
continue; continue;

View File

@ -133,7 +133,7 @@ public class ParamInfoTypes {
"Set how long the disguise lasts, <Num><Time><Num>... where <Time> is (s/sec)(m/min)(h/hour)(d/day) " + "Set how long the disguise lasts, <Num><Time><Num>... where <Time> is (s/sec)(m/min)(h/hour)(d/day) " +
"etc. 30m20secs = 30 minutes, 20 seconds")); "etc. 30m20secs = 30 minutes, 20 seconds"));
paramInfos.add(new ParamInfoEnum(ChatColor.class, "ChatColor", "A chat color")); paramInfos.add(new ParamInfoChatColor(ChatColor.class, "ChatColor", "A chat color"));
paramInfos.add(new ParamInfoEnum(GolemCrack.class, "Golem Cracked", "The stage a golem has been cracked")); paramInfos.add(new ParamInfoEnum(GolemCrack.class, "Golem Cracked", "The stage a golem has been cracked"));
// Register base types // Register base types

View File

@ -0,0 +1,17 @@
package me.libraryaddict.disguise.utilities.params.types.custom;
import me.libraryaddict.disguise.utilities.params.types.ParamInfoEnum;
/**
* Created by libraryaddict on 1/08/2021.
*/
public class ParamInfoChatColor extends ParamInfoEnum {
public ParamInfoChatColor(Class<? extends Enum> paramClass, String name, String description) {
super(paramClass, name, description);
}
@Override
public String toString(Object object) {
return ((Enum) object).name();
}
}