mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-12-16 15:38:14 +01:00
Fixed is assignable for the disguise options
This commit is contained in:
parent
16f73be312
commit
352c53c96e
@ -147,15 +147,15 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
|
||||
Class<?>[] types = method.getParameterTypes();
|
||||
if (types.length == 1) {
|
||||
Class param = types[0];
|
||||
if ((param.isAssignableFrom(Float.class) || param.isAssignableFrom(Integer.class) || param
|
||||
.isAssignableFrom(Double.class))) {
|
||||
if (Float.class.isAssignableFrom(param) || Double.class.isAssignableFrom(param)
|
||||
|| Integer.class.isAssignableFrom(param)) {
|
||||
if (isDouble(valueString)) {
|
||||
value = param.cast(Float.parseFloat(valueString));
|
||||
} else {
|
||||
throw new Exception(ChatColor.RED + "Expected a number, received " + valueString
|
||||
+ " instead for " + methodName);
|
||||
}
|
||||
} else if (param.isAssignableFrom(boolean.class)) {
|
||||
} else if (Boolean.class.isAssignableFrom(param)) {
|
||||
try {
|
||||
Boolean.parseBoolean(valueString);
|
||||
} catch (Exception ex) {
|
||||
|
@ -48,10 +48,10 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
|
||||
String valueType = null;
|
||||
if (c == String.class)
|
||||
valueType = "String";
|
||||
else if (c.isAssignableFrom(Boolean.class))
|
||||
else if (Boolean.class.isAssignableFrom(c))
|
||||
valueType = "True/False";
|
||||
else if (c.isAssignableFrom(Float.class) || c.isAssignableFrom(Double.class)
|
||||
|| c.isAssignableFrom(Integer.class)) {
|
||||
else if (Float.class.isAssignableFrom(c) || Double.class.isAssignableFrom(c)
|
||||
|| Integer.class.isAssignableFrom(c)) {
|
||||
valueType = "Number";
|
||||
}
|
||||
if (valueType != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user