From 2e71f89d14dade577499b1fe6105722467803097 Mon Sep 17 00:00:00 2001 From: xGinko Date: Fri, 2 Aug 2024 01:03:48 +0200 Subject: [PATCH] fix and use XentityType --- .../me/xginko/aef/modules/chunklimits/VillagerLimit.java | 8 +++++--- .../me/xginko/aef/modules/chunklimits/VillagerLimit.java | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/chunklimits/VillagerLimit.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/chunklimits/VillagerLimit.java index f25af802..3b6bbf1d 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/chunklimits/VillagerLimit.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/chunklimits/VillagerLimit.java @@ -135,9 +135,11 @@ private void checkVillagersInChunk(Chunk chunk) { // Create a list with all villagers in that chunk final List villagers_in_chunk = new ArrayList<>(); for (Entity entity : entities) { - Villager villager = (Villager) entity; - if (whitelistEnabled && !professionWhitelist.contains(villager.getProfession())) { - villagers_in_chunk.add(villager); + if (entity.getType() == XEntityType.VILLAGER.get()) { + Villager villager = (Villager) entity; + if (whitelistEnabled && !professionWhitelist.contains(villager.getProfession())) { + villagers_in_chunk.add(villager); + } } } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/chunklimits/VillagerLimit.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/chunklimits/VillagerLimit.java index 8ddd85bc..f7c3018e 100644 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/chunklimits/VillagerLimit.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/chunklimits/VillagerLimit.java @@ -6,7 +6,6 @@ import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Villager; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -132,7 +131,7 @@ private void checkVillagersInChunk(Chunk chunk) { // Create a list with all villagers in that chunk final List villagers_in_chunk = new ArrayList<>(); for (Entity entity : entities) { - if (entity.getType() == EntityType.VILLAGER) { + if (entity.getType() == XEntityType.VILLAGER.get()) { Villager villager = (Villager) entity; if (whitelistEnabled && !professionWhitelist.contains(villager.getProfession())) { villagers_in_chunk.add(villager);