Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. @EventHandler(priority = EventPriority.HIGH) //, ignoreCancelled = true
  2. public void onBlockBreak(final BlockBreakEvent event)
  3. {
  4. Block b = event.getBlock();
  5.  
  6. if(PlotManager.isPlotWorld(b))
  7. {
  8. Player p = event.getPlayer();
  9. boolean canbuild = PlotMe.cPerms(event.getPlayer(), "plotme.admin.buildanywhere");
  10. String id = PlotManager.getPlotId(b.getLocation());
  11.  
  12. if(id.equalsIgnoreCase(""))
  13. {
  14. if(!canbuild)
  15. {
  16. p.sendMessage(PlotMe.caption("ErrCannotBuild"));
  17. event.setCancelled(true);
  18. }
  19. }
  20. else
  21. {
  22. Plot plot = PlotManager.getMap(p).plots.get(id);
  23.  
  24. if (plot == null)
  25. {
  26. if(!canbuild)
  27. {
  28. p.sendMessage(PlotMe.caption("ErrCannotBuild"));
  29. event.setCancelled(true);
  30. }
  31. }
  32. else if(!plot.isAllowed(p.getUniqueId()))
  33. {
  34. if(!canbuild)
  35. {
  36. p.sendMessage(PlotMe.caption("ErrCannotBuild"));
  37. event.setCancelled(true);
  38. }
  39. }
  40. else
  41. {
  42. plot.resetExpire(PlotManager.getMap(b).DaysToExpiration);
  43. }
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement