Add more entity categories

This commit is contained in:
Hannes Greule
2020-04-12 00:57:50 +02:00
parent dd9450d36a
commit 6e536f81ac
3 changed files with 35 additions and 0 deletions

View File

@ -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")) {

View File

@ -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);