Risiko94

Playerlist.java

Oct 19th, 2021
536
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package DataTypes;
  2.  
  3. import java.util.LinkedList;
  4. import java.util.List;
  5.  
  6. public class Playerlist {
  7.     public static List<Player> playerlist = new LinkedList<Player> ();
  8.  
  9.     public static Player getPlayerFromId(byte id) {
  10.         Player name = new Player();
  11.         for (Player player: Playerlist.playerlist){
  12.             if (player.getId() == id) name = player;
  13.         }
  14.         return name;
  15.     }
  16.    
  17.     public static Player removeId(byte id) {
  18.         Player player = new Player();
  19.         for (int i = 0; i < Playerlist.playerlist.size(); i++) {
  20.             if (Playerlist.playerlist.get(i).getId() == id) {
  21.                 player = Playerlist.playerlist.remove(i);
  22.             }
  23.         }
  24.         return player;
  25.     }
  26.     public static String vomit() {
  27.         String output ="";
  28.         for (Player player: Playerlist.playerlist){
  29.             output = output.concat(player.getId() + " " + player.getName()+ " | ");
  30.         }
  31.         return output;
  32.     }
  33. }
RAW Paste Data