Don't include entity class in usable params, allow people to use a EntityType as well
This commit is contained in:
		| @@ -15,6 +15,7 @@ import org.bukkit.ChatColor; | |||||||
| import org.bukkit.command.Command; | import org.bukkit.command.Command; | ||||||
| import org.bukkit.command.CommandSender; | import org.bukkit.command.CommandSender; | ||||||
| import org.bukkit.entity.Entity; | import org.bukkit.entity.Entity; | ||||||
|  | import org.bukkit.entity.EntityType; | ||||||
| import org.bukkit.entity.LivingEntity; | import org.bukkit.entity.LivingEntity; | ||||||
| import org.bukkit.entity.Player; | import org.bukkit.entity.Player; | ||||||
|  |  | ||||||
| @@ -29,6 +30,7 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand { | |||||||
|                 validClasses.add(c); |                 validClasses.add(c); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         validClasses.remove(Entity.class); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
| @@ -57,6 +59,7 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand { | |||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|         Class entityClass = Entity.class; |         Class entityClass = Entity.class; | ||||||
|  |         EntityType type = null; | ||||||
|         int starting = 0; |         int starting = 0; | ||||||
|         if (!isNumeric(args[0])) { |         if (!isNumeric(args[0])) { | ||||||
|             for (Class c : validClasses) { |             for (Class c : validClasses) { | ||||||
| @@ -67,8 +70,14 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand { | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             if (starting == 0) { |             if (starting == 0) { | ||||||
|                 sender.sendMessage(ChatColor.RED + "Unrecognised EntityType " + args[0]); |                 try { | ||||||
|                 return true; |                     type = EntityType.valueOf(args[0].toUpperCase()); | ||||||
|  |                 } catch (Exception ex) { | ||||||
|  |                 } | ||||||
|  |                 if (type == null) { | ||||||
|  |                     sender.sendMessage(ChatColor.RED + "Unrecognised EntityType " + args[0]); | ||||||
|  |                     return true; | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         if (args.length == starting + 1) { |         if (args.length == starting + 1) { | ||||||
| @@ -103,7 +112,7 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand { | |||||||
|         for (Entity entity : ((Player) sender).getNearbyEntities(radius, radius, radius)) { |         for (Entity entity : ((Player) sender).getNearbyEntities(radius, radius, radius)) { | ||||||
|             if (entity == sender) |             if (entity == sender) | ||||||
|                 continue; |                 continue; | ||||||
|             if (entityClass.isAssignableFrom(entity.getClass())) { |             if (type != null ? entity.getType() == type : entityClass.isAssignableFrom(entity.getClass())) { | ||||||
|                 if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled() |                 if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled() | ||||||
|                         && entity instanceof LivingEntity) { |                         && entity instanceof LivingEntity) { | ||||||
|                     miscDisguises++; |                     miscDisguises++; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user