Fixes a problem in the spawn egg check
This commit is contained in:
parent
69a667dd95
commit
71a2ae03f3
@ -113,7 +113,7 @@ public class PlayerListener extends WorldGuardListener {
|
||||
private boolean updateClearRegions(@NotNull Player player, @NotNull Location from, @NotNull Location to) {
|
||||
Set<ProtectedRegion> regionsEntered = getRegionsEntered(from, to);
|
||||
if (!regionsEntered.isEmpty()) {
|
||||
if (!player.getInventory().isEmpty()) {
|
||||
if (!player.getInventory().isEmpty() || player.isInsideVehicle() || !player.getPassengers().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
Bukkit.getPluginManager().callEvent(new EnterClearRegionEvent(player, regionsEntered));
|
||||
@ -172,8 +172,8 @@ public class PlayerListener extends WorldGuardListener {
|
||||
|
||||
// Block usage of spawn eggs
|
||||
ItemStack item = event.getItem();
|
||||
if (item != null && isInClearRegion(player) && item.hasItemMeta()) {
|
||||
ItemMeta meta = event.getItem().getItemMeta();
|
||||
if (item != null && PlayerRegionTracker.isInClearRegion(player)) {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta instanceof SpawnEggMeta && !player.hasPermission(Permission.BYPASS_MOB_SPAWNING.toString())) {
|
||||
ClearOnWorldGuard.logDebugMessage("Prevented player " + player + " from using the spawn egg " + item);
|
||||
event.setCancelled(true);
|
||||
|
Loading…
Reference in New Issue
Block a user