@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onHangingPlace(final HangingPlaceEvent event) { Block b = event.getBlock(); if (PlotManager.isPlotWorld(b)) { String id = PlotManager.getPlotId(b.getLocation()); Player p = event.getPlayer(); boolean canbuild = PlotMe.cPerms(event.getPlayer(), "plotme.admin.buildanywhere"); if (id.equalsIgnoreCase("")) { if (!canbuild) { p.sendMessage(PlotMe.caption("ErrCannotBuild")); event.setCancelled(true); } } else { Plot plot = PlotManager.getPlotById(p, id); if (plot == null) { if (!canbuild) { p.sendMessage(PlotMe.caption("ErrCannotBuild")); event.setCancelled(true); } } else if (!plot.isAllowed(p.getName())) { if (!canbuild) { p.sendMessage(PlotMe.caption("ErrCannotBuild")); event.setCancelled(true); } } else { plot.resetExpire(PlotManager.getMap(b).DaysToExpiration); } } } }
@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); } } }