Do the changes for the base disguise command

This commit is contained in:
libraryaddict 2013-11-24 08:53:25 +13:00
parent e48c8db360
commit f2755fcb8b

View File

@ -19,6 +19,7 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
public abstract class BaseDisguiseCommand implements CommandExecutor { public abstract class BaseDisguiseCommand implements CommandExecutor {
protected ArrayList<String> getAllowedDisguises(CommandSender sender) { protected ArrayList<String> getAllowedDisguises(CommandSender sender) {
String permissionNode = "libsdisguises." + getClass().getSimpleName().replace("Command", "").toLowerCase() + "."; String permissionNode = "libsdisguises." + getClass().getSimpleName().replace("Command", "").toLowerCase() + ".";
return getAllowedDisguises(sender, permissionNode); return getAllowedDisguises(sender, permissionNode);
@ -203,6 +204,18 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
} }
} }
} }
if (miscId != -1) {
if (disguiseType == DisguiseType.FALLING_BLOCK) {
usedOptions.add("setblock");
doCheck(optionPermissions, usedOptions);
} else if (disguiseType == DisguiseType.PAINTING) {
usedOptions.add("setpainting");
doCheck(optionPermissions, usedOptions);
} else if (disguiseType == DisguiseType.SPLASH_POTION) {
usedOptions.add("setpotionid");
doCheck(optionPermissions, usedOptions);
}
}
// Construct the disguise // Construct the disguise
disguise = new MiscDisguise(disguiseType, miscId, miscData); disguise = new MiscDisguise(disguiseType, miscId, miscData);
} }
@ -313,6 +326,13 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
throw parseToException("villager profession", valueString, methodName); throw parseToException("villager profession", valueString, methodName);
} }
// Parse to ocelot type // Parse to ocelot type
} else if (param.getSimpleName().equals("Art")) {
try {
value = param.getClass().getMethod("valueOf", String.class).invoke(valueString.toUpperCase());
} catch (Exception ex) {
throw parseToException("painting", valueString, methodName);
}
// Parse to ocelot type
} else if (param.getSimpleName().equals("Type")) { } else if (param.getSimpleName().equals("Type")) {
try { try {
value = param.getClass().getMethod("valueOf", String.class).invoke(valueString.toUpperCase()); value = param.getClass().getMethod("valueOf", String.class).invoke(valueString.toUpperCase());