Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int cells = Math.min(((playerOnline() - 2) / 9) * 9 + 9, 54);
- private static Integer playerOnline(){
- int plson = 0;
- for(Player pls : Bukkit.getOnlinePlayers()){
- if(pls.getGameMode() == GameMode.SURVIVAL){
- plson ++;
- }
- }
- return plson;
- }
- public static void openMenu(Player player){
- Inventory inv = Bukkit.createInventory(null, cells, "§cJoueurs en vie");
- for(Player plon : HungerGames.players){
- int slot = 0;
- for(int i = 0; i < cells; i++){
- ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
- SkullMeta meta = (SkullMeta) head.getItemMeta();
- meta.setOwner(plon.getName());
- meta.setDisplayName(plon.getName());
- head.setItemMeta(meta);
- inv.setItem(slot, head);
- slot++;
- }
- }
- player.openInventory(inv);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement