Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.natsu.plist;
- import java.util.ArrayList;
- import java.util.Arrays;
- import org.bukkit.Bukkit;
- import org.bukkit.GameMode;
- import org.bukkit.Material;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.inventory.Inventory;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.SkullMeta;
- public class ListCommand implements CommandExecutor
- {
- public String commandName = "playerslist";
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String msg, String[] args)
- {
- if(!(sender instanceof Player))
- {
- return false;
- }
- else if(sender instanceof Player)
- {
- if(cmd.getName().equalsIgnoreCase(commandName))
- {
- Player player = (Player)sender;
- Inventory inv = Bukkit.createInventory(null, 45, "§7> §9Liste des joueurs");
- ItemStack skull = new ItemStack(Material.SKULL_ITEM ,1 , (byte) 3);
- SkullMeta sM = (SkullMeta)skull.getItemMeta();
- int place = 0;
- ArrayList<Player> joueurs = new ArrayList<>();
- for(Player pl : Bukkit.getOnlinePlayers())
- {
- joueurs.add(pl);
- }
- for(Player pl : joueurs)
- {
- sM.setOwner(pl.getName());
- sM.setDisplayName(pl.getName());
- if(pl.isOp())
- {
- if(pl.getGameMode().equals(GameMode.CREATIVE))
- {
- if(pl.getHealth() > 10)
- {
- sM.setLore(Arrays.asList(new String[] {"§9", "§7>§9 OP: §aOui", "§7> §9Gamemode: §aCréatif", "§7> §9Vie: §a"+pl.getHealth(),"§8", "§7§oCliquez pour vous téléporter!"}));
- }
- else
- {
- sM.setLore(Arrays.asList(new String[] {"§9", "§7>§9 OP: §aOui", "§7> §9Gamemode: §aCréatif", "§7> §9Vie:§c "+pl.getHealth(),"§8", "§7§oCliquez pour vous téléporter!"}));
- }
- }
- else if(pl.getGameMode().equals(GameMode.SURVIVAL))
- {
- if(pl.getHealth() > 10)
- {
- sM.setLore(Arrays.asList(new String[] {"§9", "§7>§9 OP: §aOui", "§7> §9Gamemode: §aSurvie", "§7> §9Vie: §a"+pl.getHealth(),"§8", "§7oCliquez pour vous téléporter!"}));
- }
- else
- {
- sM.setLore(Arrays.asList(new String[] {"§9", "§7>§9 OP: §aOui", "§7> §9Gamemode: §aSurvie", "§7> §9Vie:§c "+pl.getHealth(), "§8", "§7§oCliquez pour vous téléporter!"}));
- }
- }
- else if(pl.getGameMode().equals(GameMode.ADVENTURE))
- {
- if(pl.getHealth() > 10)
- {
- sM.setLore(Arrays.asList(new String[] {"§9", "§7>§9 OP: §aOui", "§7> §9Gamemode: §aAventure", "§7> §9Vie: §a"+pl.getHealth(), "§8", "§7§oCliquez pour vous téléporter!"}));
- }
- else
- {
- sM.setLore(Arrays.asList(new String[] {"§9", "§7>§9 OP: §aOui", "§7> §9Gamemode: §aAventure", "§7> §9Vie:§c "+pl.getHealth(), "§8", "§7§oCliquez pour vous téléporter!"}));
- }
- }
- }
- else if(!pl.isOp())
- {
- if(pl.getGameMode().equals(GameMode.CREATIVE))
- {
- if(pl.getHealth() > 10)
- {
- sM.setLore(Arrays.asList(new String[] {"§9", "§7>§9 OP: §cNon", "§7> §9Gamemode: §aCréatif", "§7> §9Vie: §a"+pl.getHealth(), "§8", "§7§oCliquez pour vous téléporter!"}));
- }
- else
- {
- sM.setLore(Arrays.asList(new String[] {"§9", "§7>§9 OP: §cNon", "§7> §9Gamemode: §aCréatif", "§7> §9Vie:§c "+pl.getHealth(), "§8", "§7§oCliquez pour vous téléporter!"}));
- }
- }
- else if(pl.getGameMode().equals(GameMode.SURVIVAL))
- {
- if(pl.getHealth() > 10)
- {
- sM.setLore(Arrays.asList(new String[] {"§9", "§7>§9 OP: §cNon", "§7> §9Gamemode: §aSurvie", "§7> §9Vie: §a"+pl.getHealth(), "§8", "§7§oCliquez pour vous téléporter!"}));
- }
- else
- {
- sM.setLore(Arrays.asList(new String[] {"§9", "§7>§9 OP: §cNon", "§7> §9Gamemode: §aSurvie", "§7> §9Vie:§c "+pl.getHealth(),"§8", "§7§oCliquez pour vous téléporter!"}));
- }
- }
- else if(pl.getGameMode().equals(GameMode.ADVENTURE))
- {
- if(pl.getHealth() > 10)
- {
- sM.setLore(Arrays.asList(new String[] {"§9", "§7>§9 OP: §cNon", "§7> §9Gamemode: §aAventure", "§7> §9Vie: §a"+pl.getHealth(), "§8", "§7§oCliquez pour vous téléporter!"}));
- }
- else
- {
- sM.setLore(Arrays.asList(new String[] {"§9", "§7>§9 OP: §cNon", "§7> §9Gamemode: §aAventure", "§7> §9Vie:§c "+pl.getHealth(),"§8", "§7§oCliquez pour vous téléporter!"}));
- }
- }
- }
- skull.setItemMeta(sM);
- inv.setItem(place, skull);
- place++;
- }
- player.closeInventory();
- player.openInventory(inv);
- player.updateInventory();
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement