diff --git a/core/src/main/java/de/erethon/dungeonsxl/global/GlobalProtectionListener.java b/core/src/main/java/de/erethon/dungeonsxl/global/GlobalProtectionListener.java index 8d687242..1e1c084a 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/global/GlobalProtectionListener.java +++ b/core/src/main/java/de/erethon/dungeonsxl/global/GlobalProtectionListener.java @@ -22,6 +22,7 @@ import de.erethon.dungeonsxl.DungeonsXL; import de.erethon.dungeonsxl.config.DMessage; import de.erethon.dungeonsxl.player.DGlobalPlayer; import de.erethon.dungeonsxl.player.DPermission; +import de.erethon.dungeonsxl.player.DPlayerListener; import java.util.HashSet; import java.util.List; import java.util.Map.Entry; @@ -105,6 +106,10 @@ public class GlobalProtectionListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onPlayerBucketFill(PlayerBucketFillEvent event) { + Player player = event.getPlayer(); + if (DPlayerListener.isCitizensNPC(player)) { + return; + } Block block = event.getBlockClicked(); if (DPortal.getByBlock(plugin, block) != null) { event.setCancelled(true); @@ -140,6 +145,9 @@ public class GlobalProtectionListener implements Listener { @EventHandler public void onPlayerMove(PlayerMoveEvent event) { Player player = event.getPlayer(); + if (DPlayerListener.isCitizensNPC(player)) { + return; + } DPortal dPortal = DPortal.getByLocation(plugin, player.getEyeLocation()); if (dPortal == null) { return; @@ -181,7 +189,11 @@ public class GlobalProtectionListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onPortalCreation(PlayerInteractEvent event) { - DGlobalPlayer dPlayer = (DGlobalPlayer) plugin.getPlayerCache().get(event.getPlayer()); + Player player = event.getPlayer(); + if (DPlayerListener.isCitizensNPC(player)) { + return; + } + DGlobalPlayer dPlayer = (DGlobalPlayer) plugin.getPlayerCache().get(player); if (!dPlayer.isCreatingPortal()) { return; } @@ -213,7 +225,7 @@ public class GlobalProtectionListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); - if (plugin.getPlayerCache().get(player).isInBreakMode()) { + if (DPlayerListener.isCitizensNPC(player) || plugin.getPlayerCache().get(player).isInBreakMode()) { return; } Block clickedBlock = event.getClickedBlock(); diff --git a/core/src/main/java/de/erethon/dungeonsxl/reward/RewardListener.java b/core/src/main/java/de/erethon/dungeonsxl/reward/RewardListener.java index e76944c1..50693b1a 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/reward/RewardListener.java +++ b/core/src/main/java/de/erethon/dungeonsxl/reward/RewardListener.java @@ -21,6 +21,7 @@ import de.erethon.dungeonsxl.DungeonsXL; import de.erethon.dungeonsxl.api.player.GlobalPlayer; import de.erethon.dungeonsxl.config.DMessage; import de.erethon.dungeonsxl.player.DPermission; +import de.erethon.dungeonsxl.player.DPlayerListener; import de.erethon.dungeonsxl.util.ContainerAdapter; import de.erethon.dungeonsxl.world.DGameWorld; import de.erethon.dungeonsxl.world.block.RewardChest; @@ -114,6 +115,9 @@ public class RewardListener implements Listener { @EventHandler public void onPlayerMove(PlayerMoveEvent event) { Player player = event.getPlayer(); + if (DPlayerListener.isCitizensNPC(player)) { + return; + } GlobalPlayer dPlayer = plugin.getPlayerCache().get(player); if (plugin.getInstanceWorld(player.getWorld()) != null) { return; diff --git a/core/src/main/java/de/erethon/dungeonsxl/sign/DSignListener.java b/core/src/main/java/de/erethon/dungeonsxl/sign/DSignListener.java index 677aa598..f3524e08 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/sign/DSignListener.java +++ b/core/src/main/java/de/erethon/dungeonsxl/sign/DSignListener.java @@ -25,6 +25,7 @@ import de.erethon.dungeonsxl.api.sign.DungeonSign; import de.erethon.dungeonsxl.api.world.EditWorld; import de.erethon.dungeonsxl.config.DMessage; import de.erethon.dungeonsxl.player.DPermission; +import de.erethon.dungeonsxl.player.DPlayerListener; import de.erethon.dungeonsxl.trigger.InteractTrigger; import de.erethon.dungeonsxl.world.DGameWorld; import org.bukkit.ChatColor; @@ -52,6 +53,9 @@ public class DSignListener implements Listener { @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); + if (DPlayerListener.isCitizensNPC(player)) { + return; + } Block clickedBlock = event.getClickedBlock(); if (clickedBlock == null) { return; diff --git a/core/src/main/java/de/erethon/dungeonsxl/trigger/TriggerListener.java b/core/src/main/java/de/erethon/dungeonsxl/trigger/TriggerListener.java index 43f38636..df2a718c 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/trigger/TriggerListener.java +++ b/core/src/main/java/de/erethon/dungeonsxl/trigger/TriggerListener.java @@ -19,6 +19,7 @@ package de.erethon.dungeonsxl.trigger; import de.erethon.caliburn.item.VanillaItem; import de.erethon.dungeonsxl.DungeonsXL; import de.erethon.dungeonsxl.api.world.GameWorld; +import de.erethon.dungeonsxl.player.DPlayerListener; import de.erethon.dungeonsxl.world.DGameWorld; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -57,6 +58,9 @@ public class TriggerListener implements Listener { @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); + if (DPlayerListener.isCitizensNPC(player)) { + return; + } DGameWorld gameWorld = (DGameWorld) plugin.getGameWorld(player.getWorld()); if (gameWorld == null) { return; diff --git a/core/src/main/java/de/erethon/dungeonsxl/world/DWorldListener.java b/core/src/main/java/de/erethon/dungeonsxl/world/DWorldListener.java index a54663a0..ffc156d4 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/world/DWorldListener.java +++ b/core/src/main/java/de/erethon/dungeonsxl/world/DWorldListener.java @@ -28,6 +28,7 @@ import de.erethon.dungeonsxl.api.dungeon.GameRuleContainer; import de.erethon.dungeonsxl.api.world.EditWorld; import de.erethon.dungeonsxl.api.world.GameWorld; import de.erethon.dungeonsxl.api.world.InstanceWorld; +import de.erethon.dungeonsxl.player.DPlayerListener; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -35,6 +36,7 @@ import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -99,6 +101,10 @@ public class DWorldListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onBlockInteract(PlayerInteractEvent event) { + Player player = event.getPlayer(); + if (DPlayerListener.isCitizensNPC(player)) { + return; + } Block block = event.getClickedBlock(); GameWorld gameWorld = plugin.getGameWorld(block.getWorld()); if (gameWorld == null || gameWorld.isPlaying()) {