Skip to content

Commit

Permalink
fix and use XentityType
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Aug 1, 2024
1 parent 42555c9 commit 2e71f89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,11 @@ private void checkVillagersInChunk(Chunk chunk) {
// Create a list with all villagers in that chunk
final List<Villager> 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);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -132,7 +131,7 @@ private void checkVillagersInChunk(Chunk chunk) {
// Create a list with all villagers in that chunk
final List<Villager> 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);
Expand Down

0 comments on commit 2e71f89

Please sign in to comment.