Fix disguises still being visible as usable. And classes existing when they don't.
This commit is contained in:
parent
86d728f90d
commit
e41b80ebc0
@ -14,10 +14,6 @@ import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Horse.Color;
|
|
||||||
import org.bukkit.entity.Horse.Style;
|
|
||||||
import org.bukkit.entity.Ocelot.Type;
|
|
||||||
import org.bukkit.entity.Villager.Profession;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
@ -36,6 +32,9 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
|
|||||||
if (perm.startsWith(permissionNode)) {
|
if (perm.startsWith(permissionNode)) {
|
||||||
perm = perm.substring(permissionNode.length());
|
perm = perm.substring(permissionNode.length());
|
||||||
for (DisguiseType type : DisguiseType.values()) {
|
for (DisguiseType type : DisguiseType.values()) {
|
||||||
|
if (type.getEntityType() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String name = type.name().toLowerCase();
|
String name = type.name().toLowerCase();
|
||||||
if (perm.split("\\.")[0].equals("*") && permission.getValue()) {
|
if (perm.split("\\.")[0].equals("*") && permission.getValue()) {
|
||||||
if (!names.contains(name))
|
if (!names.contains(name))
|
||||||
@ -51,8 +50,11 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// This does the disguises for ops.
|
// This does the disguises for OP's.
|
||||||
for (DisguiseType type : DisguiseType.values()) {
|
for (DisguiseType type : DisguiseType.values()) {
|
||||||
|
if (type.getEntityType() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!names.contains(type.name().toLowerCase())) {
|
if (!names.contains(type.name().toLowerCase())) {
|
||||||
if (sender.hasPermission(permissionNode + "*")
|
if (sender.hasPermission(permissionNode + "*")
|
||||||
|| sender.hasPermission(permissionNode + type.name().toLowerCase())) {
|
|| sender.hasPermission(permissionNode + type.name().toLowerCase())) {
|
||||||
@ -289,30 +291,31 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
value = items;
|
value = items;
|
||||||
// Parse to horse color
|
// Parse to horse color
|
||||||
} else if (param == Color.class) {
|
} else if (param.getSimpleName().equals("Color")) {
|
||||||
try {
|
try {
|
||||||
value = Color.valueOf(valueString.toUpperCase());
|
|
||||||
|
value = param.getClass().getMethod("valueOf", String.class).invoke(valueString.toUpperCase());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw parseToException("horse color", valueString, methodName);
|
throw parseToException("horse color", valueString, methodName);
|
||||||
}
|
}
|
||||||
// Parse to horse style
|
// Parse to horse style
|
||||||
} else if (param == Style.class) {
|
} else if (param.getSimpleName().equals("Style")) {
|
||||||
try {
|
try {
|
||||||
value = Style.valueOf(valueString.toUpperCase());
|
value = param.getClass().getMethod("valueOf", String.class).invoke(valueString.toUpperCase());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw parseToException("horse style", valueString, methodName);
|
throw parseToException("horse style", valueString, methodName);
|
||||||
}
|
}
|
||||||
// Parse to villager profession
|
// Parse to villager profession
|
||||||
} else if (param == Profession.class) {
|
} else if (param.getSimpleName().equals("Profession")) {
|
||||||
try {
|
try {
|
||||||
value = Profession.valueOf(valueString.toUpperCase());
|
value = param.getClass().getMethod("valueOf", String.class).invoke(valueString.toUpperCase());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw parseToException("villager profession", valueString, methodName);
|
throw parseToException("villager profession", valueString, methodName);
|
||||||
}
|
}
|
||||||
// Parse to ocelot type
|
// Parse to ocelot type
|
||||||
} else if (param == Type.class) {
|
} else if (param.getSimpleName().equals("Type")) {
|
||||||
try {
|
try {
|
||||||
value = Type.valueOf(valueString.toUpperCase());
|
value = param.getClass().getMethod("valueOf", String.class).invoke(valueString.toUpperCase());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw parseToException("ocelot type", valueString, methodName);
|
throw parseToException("ocelot type", valueString, methodName);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user