Exemplo 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;
   }
 }
Exemplo n.º 2
0
  /**
   * Deserialize a chaining point from a given buffer.
   *
   * @param p_buffer
   * @return ChainingPoint
   */
  public static ChainingPoint deserialize(EasyBuffering p_buffer) {
    ChainingPoint pe = new ChainingPoint();
    pe.px = p_buffer.readUnsignedByte();
    pe.py = p_buffer.readUnsignedByte();
    pe.comingAngle = Angle.fromInt(p_buffer.readUnsignedByte());
    pe.transitionAnim = FilterEffect.values()[p_buffer.readUnsignedByte()];
    String mapName = p_buffer.readString();
    pe.mapname = mapName;

    // Set the linked properties
    if ((pe.px & 64) != 0) {
      pe.single = true;
      pe.px &= 128 + 63;
    }
    if (pe.px > 127) {
      pe.vertical = true;
      pe.px &= 127;
    }
    if (pe.py > 127) {
      pe.border = true;
      pe.py &= 127;
    }
    return pe;
  }
Exemplo n.º 3
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;
 }