Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler(priority = EventPriority.HIGH) //, ignoreCancelled = true
- public void onBlockBreak(final BlockBreakEvent event)
- {
- Block b = event.getBlock();
- if(PlotManager.isPlotWorld(b))
- {
- Player p = event.getPlayer();
- boolean canbuild = PlotMe.cPerms(event.getPlayer(), "plotme.admin.buildanywhere");
- String id = PlotManager.getPlotId(b.getLocation());
- if(id.equalsIgnoreCase(""))
- {
- if(!canbuild)
- {
- p.sendMessage(PlotMe.caption("ErrCannotBuild"));
- event.setCancelled(true);
- }
- }
- else
- {
- Plot plot = PlotManager.getMap(p).plots.get(id);
- if (plot == null)
- {
- if(!canbuild)
- {
- p.sendMessage(PlotMe.caption("ErrCannotBuild"));
- event.setCancelled(true);
- }
- }
- else if(!plot.isAllowed(p.getUniqueId()))
- {
- if(!canbuild)
- {
- p.sendMessage(PlotMe.caption("ErrCannotBuild"));
- event.setCancelled(true);
- }
- }
- else
- {
- plot.resetExpire(PlotManager.getMap(b).DaysToExpiration);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement