mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Add more entity categories
This commit is contained in:
parent
dd9450d36a
commit
6e536f81ac
@ -58,17 +58,25 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Sign;
|
||||
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.ArmorStand;
|
||||
import org.bukkit.entity.Boss;
|
||||
import org.bukkit.entity.EnderCrystal;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Ghast;
|
||||
import org.bukkit.entity.Golem;
|
||||
import org.bukkit.entity.Hanging;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.NPC;
|
||||
import org.bukkit.entity.Phantom;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.entity.WaterMob;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -560,6 +568,8 @@ public class BukkitUtil extends WorldUtil {
|
||||
case "animal": {
|
||||
allowedInterfaces.add(Golem.class);
|
||||
allowedInterfaces.add(Animals.class);
|
||||
allowedInterfaces.add(WaterMob.class);
|
||||
allowedInterfaces.add(Ambient.class);
|
||||
} break;
|
||||
case "tameable": {
|
||||
allowedInterfaces.add(Tameable.class);
|
||||
@ -571,10 +581,22 @@ public class BukkitUtil extends WorldUtil {
|
||||
allowedInterfaces.add(Monster.class);
|
||||
allowedInterfaces.add(Boss.class);
|
||||
allowedInterfaces.add(Slime.class);
|
||||
allowedInterfaces.add(Ghast.class);
|
||||
allowedInterfaces.add(Phantom.class);
|
||||
allowedInterfaces.add(EnderCrystal.class);
|
||||
} break;
|
||||
case "hanging": {
|
||||
allowedInterfaces.add(Hanging.class);
|
||||
} break;
|
||||
case "villager": {
|
||||
allowedInterfaces.add(NPC.class);
|
||||
} break;
|
||||
case "projectile": {
|
||||
allowedInterfaces.add(Projectile.class);
|
||||
} break;
|
||||
case "decoration": {
|
||||
allowedInterfaces.add(ArmorStand.class);
|
||||
} break;
|
||||
default: {
|
||||
PlotSquared.log(Captions.PREFIX + "Unknown entity category requested: " + category);
|
||||
} break;
|
||||
|
@ -37,6 +37,7 @@ import com.github.intellectualsites.plotsquared.plot.util.entity.EntityCategorie
|
||||
import com.github.intellectualsites.plotsquared.plot.util.entity.EntityCategory;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
|
||||
@CommandDeclaration(command = "debug",
|
||||
@ -74,6 +75,15 @@ public class Debug extends SubCommand {
|
||||
}
|
||||
player.sendMessage(Captions.PREFIX.getTranslated() + builder.toString());
|
||||
});
|
||||
EntityType.REGISTRY.values().stream()
|
||||
.sorted(Comparator.comparing(EntityType::getId))
|
||||
.forEach(entityType -> {
|
||||
long categoryCount = EntityCategory.REGISTRY.values()
|
||||
.stream()
|
||||
.filter(category -> category.contains(entityType))
|
||||
.count();
|
||||
player.sendMessage(Captions.PREFIX.getTranslated() + entityType.getName() + " is in " + categoryCount + " categories");
|
||||
});
|
||||
return true;
|
||||
}
|
||||
if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) {
|
||||
|
@ -35,6 +35,9 @@ public class EntityCategories {
|
||||
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 EntityCategory register(final String id) {
|
||||
final EntityCategory entityCategory = new EntityCategory(id);
|
||||
|
Loading…
Reference in New Issue
Block a user