Finalize entity type categorisation

This commit is contained in:
Alexander Söderberg 2020-04-12 01:23:13 +02:00
parent 6e536f81ac
commit 658f2a3fc3
3 changed files with 34 additions and 9 deletions

View File

@ -60,14 +60,23 @@ import org.bukkit.block.data.Directional;
import org.bukkit.block.data.type.WallSign;
import org.bukkit.entity.Ambient;
import org.bukkit.entity.Animals;
import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Boss;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.entity.EnderSignal;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.EvokerFangs;
import org.bukkit.entity.ExperienceOrb;
import org.bukkit.entity.Explosive;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.Golem;
import org.bukkit.entity.Hanging;
import org.bukkit.entity.Item;
import org.bukkit.entity.LightningStrike;
import org.bukkit.entity.Monster;
import org.bukkit.entity.NPC;
import org.bukkit.entity.Phantom;
@ -594,8 +603,20 @@ public class BukkitUtil extends WorldUtil {
case "projectile": {
allowedInterfaces.add(Projectile.class);
} break;
case "decoration": {
case "other": {
allowedInterfaces.add(ArmorStand.class);
allowedInterfaces.add(FallingBlock.class);
allowedInterfaces.add(Item.class);
allowedInterfaces.add(Explosive.class);
allowedInterfaces.add(AreaEffectCloud.class);
allowedInterfaces.add(EvokerFangs.class);
allowedInterfaces.add(LightningStrike.class);
allowedInterfaces.add(ExperienceOrb.class);
allowedInterfaces.add(EnderSignal.class);
allowedInterfaces.add(Firework.class);
} break;
case "player": {
allowedInterfaces.add(Player.class);
} break;
default: {
PlotSquared.log(Captions.PREFIX + "Unknown entity category requested: " + category);

View File

@ -82,6 +82,9 @@ public class Debug extends SubCommand {
.stream()
.filter(category -> category.contains(entityType))
.count();
if (categoryCount > 0) {
return;
}
player.sendMessage(Captions.PREFIX.getTranslated() + entityType.getName() + " is in " + categoryCount + " categories");
});
return true;

View File

@ -30,14 +30,15 @@ package com.github.intellectualsites.plotsquared.plot.util.entity;
*/
public class EntityCategories {
public static final EntityCategory ANIMAL = register("animal");
public static final EntityCategory TAMEABLE = register("tameable");
public static final EntityCategory VEHICLE = register("vehicle");
public static final EntityCategory HOSTILE = register("hostile");
public static final EntityCategory HANGING = register("hanging");
public static final EntityCategory VILLAGER = register("villager");
public static final EntityCategory PROJECTILE = register("projectile");
public static final EntityCategory DECORATION = register("decoration");
public static final EntityCategory ANIMAL = register("animal");
public static final EntityCategory TAMEABLE = register("tameable");
public static final EntityCategory VEHICLE = register("vehicle");
public static final EntityCategory HOSTILE = register("hostile");
public static final EntityCategory HANGING = register("hanging");
public static final EntityCategory VILLAGER = register("villager");
public static final EntityCategory PROJECTILE = register("projectile");
public static final EntityCategory OTHER = register("other");
public static final EntityCategory PLAYER = register("player");
public static EntityCategory register(final String id) {
final EntityCategory entityCategory = new EntityCategory(id);