Esempio n. 1
0
 /**
  * Read the servers configuration file to return a list of {@link ServerInfo}.<br>
  * In any error case, return an empty list.
  *
  * @return List<ServerInfo>
  */
 public static List<ServerInfo> loadServersInfos() {
   List<ServerInfo> infos = new ArrayList<ServerInfo>();
   try {
     EasyBuffering file = Zildo.pdPlugin.openFile(Constantes.SERVER_FILE);
     while (!file.eof()) {
       String name = file.readString();
       String ip = file.readString();
       int port = file.readInt();
       infos.add(new ServerInfo(name, ip, port));
     }
     return infos;
   } catch (Exception e) {
     return infos;
   }
 }
Esempio n. 2
0
 public static PlayerState deserialize(EasyBuffering p_buffer) {
   PlayerState s = new PlayerState(p_buffer.readString(), p_buffer.readInt());
   s.nDied = p_buffer.readInt();
   s.nKill = p_buffer.readInt();
   return s;
 }