From b284ab1df031a6bdd0c2c7ecdf65bec72e85cf47 Mon Sep 17 00:00:00 2001 From: Revxrsal Date: Sun, 13 Mar 2022 16:55:38 +0300 Subject: [PATCH] feat: filter entities in /spawner list by permission (#350) --- .../src/main/java/de/dustplanet/util/SilkUtil.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/SilkSpawners/src/main/java/de/dustplanet/util/SilkUtil.java b/modules/SilkSpawners/src/main/java/de/dustplanet/util/SilkUtil.java index 1a3c28c6..0328efdc 100644 --- a/modules/SilkSpawners/src/main/java/de/dustplanet/util/SilkUtil.java +++ b/modules/SilkSpawners/src/main/java/de/dustplanet/util/SilkUtil.java @@ -654,9 +654,13 @@ public String getCreatureEggName(final String entity) { public void showAllCreatures(final CommandSender sender) { // For each entry in the list final StringBuilder builder = new StringBuilder(); - for (String displayName : displayNameToMobID.keySet()) { + for (Entry entityType : displayNameToMobID.entrySet()) { + String displayName = entityType.getKey(); + String entityId = entityType.getValue(); displayName = displayName.replace(" ", ""); - builder.append(displayName + ", "); + if (hasPermission(sender, "silkspawners.changetype.", entityId)) { + builder.append(displayName + ", "); + } } // Strip last comma out String message = builder.toString();