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.block.data.type.WallSign;
import org.bukkit.entity.Ambient; import org.bukkit.entity.Ambient;
import org.bukkit.entity.Animals; import org.bukkit.entity.Animals;
import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.ArmorStand; import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Boss; import org.bukkit.entity.Boss;
import org.bukkit.entity.EnderCrystal; import org.bukkit.entity.EnderCrystal;
import org.bukkit.entity.EnderSignal;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; 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.Ghast;
import org.bukkit.entity.Golem; import org.bukkit.entity.Golem;
import org.bukkit.entity.Hanging; import org.bukkit.entity.Hanging;
import org.bukkit.entity.Item;
import org.bukkit.entity.LightningStrike;
import org.bukkit.entity.Monster; import org.bukkit.entity.Monster;
import org.bukkit.entity.NPC; import org.bukkit.entity.NPC;
import org.bukkit.entity.Phantom; import org.bukkit.entity.Phantom;
@ -594,8 +603,20 @@ public class BukkitUtil extends WorldUtil {
case "projectile": { case "projectile": {
allowedInterfaces.add(Projectile.class); allowedInterfaces.add(Projectile.class);
} break; } break;
case "decoration": { case "other": {
allowedInterfaces.add(ArmorStand.class); 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; } break;
default: { default: {
PlotSquared.log(Captions.PREFIX + "Unknown entity category requested: " + category); PlotSquared.log(Captions.PREFIX + "Unknown entity category requested: " + category);

View File

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

View File

@ -37,7 +37,8 @@ public class EntityCategories {
public static final EntityCategory HANGING = register("hanging"); public static final EntityCategory HANGING = register("hanging");
public static final EntityCategory VILLAGER = register("villager"); public static final EntityCategory VILLAGER = register("villager");
public static final EntityCategory PROJECTILE = register("projectile"); public static final EntityCategory PROJECTILE = register("projectile");
public static final EntityCategory DECORATION = register("decoration"); public static final EntityCategory OTHER = register("other");
public static final EntityCategory PLAYER = register("player");
public static EntityCategory register(final String id) { public static EntityCategory register(final String id) {
final EntityCategory entityCategory = new EntityCategory(id); final EntityCategory entityCategory = new EntityCategory(id);