Advertisement
Guest User

Untitled

a guest
Oct 19th, 2015
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1.     static int cells = Math.min(((playerOnline() - 2) / 9) * 9 + 9, 54);
  2.    
  3.     private static Integer playerOnline(){
  4.         int plson = 0;
  5.         for(Player pls : Bukkit.getOnlinePlayers()){
  6.             if(pls.getGameMode() == GameMode.SURVIVAL){
  7.                 plson ++;
  8.             }
  9.         }
  10.         return plson;
  11.     }
  12.    
  13.     public static void openMenu(Player player){
  14.         Inventory inv = Bukkit.createInventory(null, cells, "§cJoueurs en vie");
  15.        
  16.         for(Player plon : HungerGames.players){
  17.             int slot = 0;
  18.             for(int i = 0; i < cells; i++){
  19.                 ItemStack head =  new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
  20.                 SkullMeta meta = (SkullMeta) head.getItemMeta();
  21.                 meta.setOwner(plon.getName());
  22.                 meta.setDisplayName(plon.getName());
  23.                 head.setItemMeta(meta);
  24.                 inv.setItem(slot, head);
  25.                 slot++;
  26.             }
  27.         }
  28.         player.openInventory(inv);
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement