diff --git a/src/main/java/org/ultramine/commands/basic/TechCommands.java b/src/main/java/org/ultramine/commands/basic/TechCommands.java index f388298..9c2940b 100644 --- a/src/main/java/org/ultramine/commands/basic/TechCommands.java +++ b/src/main/java/org/ultramine/commands/basic/TechCommands.java @@ -18,6 +18,7 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import static net.minecraft.util.EnumChatFormatting.*; import net.minecraft.world.WorldServer; @@ -794,4 +795,43 @@ ctx.sendMessage("command.reloadcfg.success"); } + + @Command( + name = "entitylist", + group = "technical", + permissions = {"command.technical.entitylist"}, + syntax = {""} + ) + public static void entitylist(CommandContext ctx) + { + for(WorldServer world : ctx.getServer().getMultiWorld().getLoadedWorlds()) + { + for(Entity ent : GenericIterableFactory.newCastingIterable(world.loadedEntityList, Entity.class)) + { + ctx.sendMessage("[%s](%s, %s, %s) ID: %s, Class: %s, Entity: %s", world.provider.dimensionId, ent.posX, ent.posY, ent.posZ, ent.getEntityId(), ent.getClass(), ent); + } + } + } + + @Command( + name = "killentity", + group = "technical", + permissions = {"command.technical.killentity"}, + syntax = {"<%id>"} + ) + public static void killentity(CommandContext ctx) + { + int id = ctx.get("id").asInt(); + for(WorldServer world : ctx.getServer().getMultiWorld().getLoadedWorlds()) + { + for(Entity ent : GenericIterableFactory.newCastingIterable(world.loadedEntityList, Entity.class)) + { + if(ent.getEntityId() == id) + { + ent.attackEntityFrom(DamageSource.outOfWorld, 10000f); + ent.setDead(); + } + } + } + } } diff --git a/src/main/resources/assets/ultramine/lang/en_US.lang b/src/main/resources/assets/ultramine/lang/en_US.lang index 3b849da..bf9a31a 100644 --- a/src/main/resources/assets/ultramine/lang/en_US.lang +++ b/src/main/resources/assets/ultramine/lang/en_US.lang @@ -309,3 +309,9 @@ command.reloadcfg.usage=/reloadcfg command.reloadcfg.description=Reloads UltraMine server configuration (in /settings directory) command.reloadcfg.success=Server configuration successfully reloaded + +command.reloadcfg.usage=/entitylist +command.reloadcfg.description=Displays list of all loaded entities in all worlds + +command.reloadcfg.usage=/killentity +command.reloadcfg.description=Kills entity with specified ID diff --git a/src/main/resources/assets/ultramine/lang/ru_RU.lang b/src/main/resources/assets/ultramine/lang/ru_RU.lang index e27f3ce..f1c79ec 100644 --- a/src/main/resources/assets/ultramine/lang/ru_RU.lang +++ b/src/main/resources/assets/ultramine/lang/ru_RU.lang @@ -309,3 +309,9 @@ command.reloadcfg.usage=/reloadcfg command.reloadcfg.description=Перезагружает конфигурацию UltraMine сервера (из директории /settings) command.reloadcfg.success=Серверная конфигурация успешно перезагружена + +command.reloadcfg.usage=/entitylist +command.reloadcfg.description=Показывает список всех загруженных Entity во всех мирах + +command.reloadcfg.usage=/killentity +command.reloadcfg.description=Убивает Entity с указанным ID