Remove stupid sign check on BlockBreak + Add early exit to event
This commit is contained in:
parent
a4a7450530
commit
e144827afd
@ -1,11 +1,8 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.W;
|
||||
import nl.Steffion.BlockHunt.Managers.PermissionsM;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -16,18 +13,14 @@ public class OnBlockBreakEvent implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockBreakEvent(BlockBreakEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
// Early exit if no one is in any arena
|
||||
if (ArenaHandler.noPlayersInArenas()) return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
for (Arena arena : W.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getBlock().equals(Material.SIGN_POST) || event.getBlock().equals(Material.WALL_SIGN)) {
|
||||
if (!PermissionsM.hasPerm(player, Permissions.signcreate, true)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user