Advertisement
Guest User

Untitled

a guest
Nov 15th, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. public ArrayList<Player> all = new ArrayList<Player>();
  2.  
  3. @SuppressWarnings("deprecation")
  4. @EventHandler
  5. public void LobbySign(PlayerInteractEvent event) {
  6.  
  7. Location castle = new Location(Bukkit.getWorld("world"), -163, 68, 260);
  8. Location spawn = new Location(Bukkit.getWorld("world"), -97, 82, 262);
  9.  
  10. Player player = event.getPlayer();
  11.  
  12. Block block = event.getClickedBlock();
  13.  
  14. ItemStack Lobby = new ItemStack(Material.BED);
  15. ItemMeta LobbyMeta = Lobby.getItemMeta();
  16. LobbyMeta
  17. .setDisplayName(ChatColor.DARK_GREEN + ">> Revenir au spawn !");
  18. Lobby.setItemMeta(LobbyMeta);
  19.  
  20. if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
  21. if (block.getType() == Material.SIGN || block.getTypeId() == 68) {
  22.  
  23. Sign sign = (Sign) block.getState();
  24.  
  25. if (sign.getLine(0).contains("Castle")) {
  26.  
  27. if (all.size() != 10 && !all.contains(player)) {
  28.  
  29. all.add(player);
  30. player.sendMessage(ChatColor.GREEN
  31. + "Tu as été ajouté à la partie !"
  32. + ChatColor.RED + " Nombre de joueurs "
  33. + all.size() + " /10");
  34. sign.setLine(2, all.size() + "/10");
  35. sign.update();
  36. player.teleport(castle);
  37. player.getInventory().clear();
  38.  
  39. player.getInventory().setItem(8, Lobby);
  40. player.updateInventory();
  41.  
  42. }
  43.  
  44. else {
  45. player.sendMessage(ChatColor.RED
  46. + "Vous êtes déjà dans une partie !");
  47.  
  48. }
  49.  
  50. } else {
  51. player.sendMessage(ChatColor.RED
  52. + "Désolé le lobby est plein !");
  53. sign.setLine(1, ChatColor.RED + "PLEIN");
  54. sign.update();
  55.  
  56. }
  57. }
  58. }
  59. if (event.getAction() == Action.RIGHT_CLICK_BLOCK
  60. || event.getAction() == Action.LEFT_CLICK_AIR
  61. || event.getAction() == Action.LEFT_CLICK_BLOCK) {
  62.  
  63. if (event.getMaterial() == Material.BED) {
  64. Sign sign = (Sign) block.getState();
  65.  
  66. event.getPlayer().teleport(spawn);
  67. event.getPlayer().getInventory().clear();
  68.  
  69. ItemStack menutp = new ItemStack(Material.BLAZE_ROD);
  70. ItemMeta menutpMeta = menutp.getItemMeta();
  71. menutpMeta.setDisplayName(ChatColor.GREEN
  72. + ">> Menu principale");
  73. menutp.setItemMeta(menutpMeta);
  74. event.getPlayer().getInventory().setItem(0, menutp);
  75.  
  76. ItemStack gold = new ItemStack(Material.GOLD_INGOT);
  77. ItemMeta goldMeta = gold.getItemMeta();
  78. goldMeta.setDisplayName(ChatColor.GREEN
  79. + ">> Menu pour le shop!");
  80. gold.setItemMeta(goldMeta);
  81. event.getPlayer().getInventory().setItem(8, gold);
  82.  
  83. ItemStack jeux = new ItemStack(Material.WOOL);
  84. ItemMeta jeuxMeta = jeux.getItemMeta();
  85. jeuxMeta.setDisplayName(ChatColor.GREEN
  86. + ">> Menu pour les jeux !");
  87. jeux.setItemMeta(goldMeta);
  88. event.getPlayer().getInventory().setItem(4, jeux);
  89.  
  90. ItemStack poudre = new ItemStack(Material.YELLOW_FLOWER);
  91. ItemMeta poudreMeta = poudre.getItemMeta();
  92. poudreMeta.setDisplayName(ChatColor.GREEN
  93. + ">> Faire disparaître tous les joueurs !");
  94. poudre.setItemMeta(poudreMeta);
  95. event.getPlayer().getInventory().setItem(2, poudre);
  96.  
  97. event.getPlayer().updateInventory();
  98.  
  99. all.remove(player);
  100. sign.setLine(2, all.size() + "/10");
  101. sign.update();
  102. }
  103. }
  104.  
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement