From 658f2a3fc319ee6d168fcd355bb365e3f134e3be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 12 Apr 2020 01:23:13 +0200 Subject: [PATCH] Finalize entity type categorisation --- .../plotsquared/bukkit/util/BukkitUtil.java | 23 ++++++++++++++++++- .../plotsquared/plot/commands/Debug.java | 3 +++ .../plot/util/entity/EntityCategories.java | 17 +++++++------- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java index eddd3473c..38205b5e9 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java @@ -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); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java index 92b701dd9..150c34a0b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java @@ -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; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/entity/EntityCategories.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/entity/EntityCategories.java index 78a518715..f40854cea 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/entity/EntityCategories.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/entity/EntityCategories.java @@ -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);