@EventHandler(priority = EventPriority.HIGH) public void paintingFramePlace(HangingPlaceEvent event) { org.bukkit.entity.Entity placer = event.getPlayer(); OwnedLand land = OwnedLand.getApplicableLand(event.getBlock().getLocation()); if (land == null) { return; } if (placer.getType().toString().equals("PLAYER")) { Player p = (Player) placer; if (!land.hasPermTo(p, this)) { p.sendMessage( ChatColor.RED + getPlugin().getMessageConfig().getString("event.build.paintingPlace")); event.setCancelled(true); } } }
@EventHandler(priority = EventPriority.HIGH) public void paintingFrameBreak(HangingBreakByEntityEvent event) { org.bukkit.entity.Entity victim = event.getEntity(); org.bukkit.entity.Entity remover = event.getRemover(); OwnedLand land = OwnedLand.getApplicableLand(victim.getLocation()); if (land == null) { return; } if (remover.getType().toString().equals("PLAYER")) { Player p = (Player) remover; if (!land.hasPermTo(p, this)) { p.sendMessage( ChatColor.RED + getPlugin().getMessageConfig().getString("event.build.hangingBreak")); event.setCancelled(true); } // System.out.println("Attacker Name:" + p.getName()); } }