Blocks usage of ender chests in clear regions
This commit is contained in:
parent
9af4f3f0e1
commit
9b69e80e8f
@ -18,6 +18,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.entity.PlayerLeashEntityEvent;
|
import org.bukkit.event.entity.PlayerLeashEntityEvent;
|
||||||
|
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
@ -177,8 +178,16 @@ public class PlayerListener extends WorldGuardListener {
|
|||||||
if (meta instanceof SpawnEggMeta && !player.hasPermission(Permission.BYPASS_MOB_SPAWNING.toString())) {
|
if (meta instanceof SpawnEggMeta && !player.hasPermission(Permission.BYPASS_MOB_SPAWNING.toString())) {
|
||||||
ClearOnWorldGuard.logDebugMessage("Prevented player " + player + " from using the spawn egg " + item);
|
ClearOnWorldGuard.logDebugMessage("Prevented player " + player + " from using the spawn egg " + item);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Block usage of ender chests while in a clear region (the first check is this method takes care of the case
|
||||||
|
where the chest is outside the clear region) */
|
||||||
|
if (clicked != null && PlayerRegionTracker.isInClearRegion(player) &&
|
||||||
|
event.getAction() != Action.LEFT_CLICK_BLOCK && clicked.getType() == Material.ENDER_CHEST) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
@ -197,4 +206,11 @@ public class PlayerListener extends WorldGuardListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onBucketEmpty(@NotNull PlayerBucketEmptyEvent event) {
|
||||||
|
if (PlayerRegionTracker.isInClearRegion(event.getPlayer())) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user