Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.20 KB | None | 0 0
  1. @EventHandler
  2. public void TwoPlayersOpenFix(PlayerInteractEvent e){
  3. if(e.getClickedBlock() != null && e.getPlayer() != null){
  4.  
  5. Block b = e.getClickedBlock();
  6. Player p = e.getPlayer();
  7. String n = p.getName();
  8. String m = b.getType().toString();
  9. int id = b.getTypeId();
  10. int data = b.getData();
  11.  
  12. if(m.equalsIgnoreCase("BUILDCRAFTFACTORY_AUTOWORKBENCHBLOCK") || m.equalsIgnoreCase("APPLIEDENERGISTICS2_TILEBLOCKDRIVE") || m.equalsIgnoreCase("APPLIEDENERGISTICS2_TILEBLOCKCHEST") || m.equalsIgnoreCase("EXTRABEES_ALVEARY") || (m.equalsIgnoreCase("PROJREDEXPANSION_PROJECTREDEXPANSIONMACHINE2") && (data == 11 || data == 10 || data == 6)) || m.equalsIgnoreCase("THERMALEXPANSION_WORKBENCH")){
  13. if(this.getplayerinblock.get(b) != null){
  14. if(!this.getplayerinblock.get(b).equalsIgnoreCase(n)){
  15. p.sendMessage(ChatColor.GOLD + "Этот блок зарегистрирован игроком: " + ChatColor.RED + this.getplayerinblock.get(b));
  16. e.setCancelled(true);
  17. }
  18. }else{
  19. this.getblockinplayer.put(n, b);
  20. this.getplayerinblock.put(b, n);
  21. }
  22. }else{
  23. if(this.getblockinplayer.get(n) != null){
  24. if(this.getplayerinblock.get(this.getblockinplayer.get(n)) != null){
  25. this.getplayerinblock.remove(this.getblockinplayer.get(n));
  26. this.getblockinplayer.remove(n);
  27. }
  28. }
  29. }
  30. }
  31. }
  32.  
  33. @EventHandler
  34. public void TwoPlayersOpenFix2(BlockBreakEvent e){
  35. if(e.getPlayer() != null){
  36.  
  37. String n = e.getPlayer().getName();
  38.  
  39. if(this.getblockinplayer.get(n) != null){
  40. if(this.getplayerinblock.get(this.getblockinplayer.get(n)) != null){
  41. this.getplayerinblock.remove(this.getblockinplayer.get(n));
  42. this.getblockinplayer.remove(n);
  43. }
  44. }
  45. }
  46. }
  47.  
  48. @EventHandler
  49. public void TwoPlayersOpenFix3(PlayerChatEvent e){
  50. if(e.getPlayer() != null){
  51.  
  52. String n = e.getPlayer().getName();
  53.  
  54. if(this.getblockinplayer.get(n) != null){
  55. if(this.getplayerinblock.get(this.getblockinplayer.get(n)) != null){
  56. this.getplayerinblock.remove(this.getblockinplayer.get(n));
  57. this.getblockinplayer.remove(n);
  58. }
  59. }
  60. }
  61. }
  62.  
  63. @EventHandler
  64. public void TwoPlayersOpenFix4(PlayerQuitEvent e){
  65. if(e.getPlayer() != null){
  66.  
  67. String n = e.getPlayer().getName();
  68.  
  69. if(this.getblockinplayer.get(n) != null){
  70. if(this.getplayerinblock.get(this.getblockinplayer.get(n)) != null){
  71. this.getplayerinblock.remove(this.getblockinplayer.get(n));
  72. this.getblockinplayer.remove(n);
  73. }
  74. }
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement