Exemple #1
0
  public void onPacketReceived(Packet250CustomPayload packet, Player player) {
    DataInputStream dat = new DataInputStream(new ByteArrayInputStream(packet.data));
    BufferedReader buf = new BufferedReader(new InputStreamReader(dat));
    try {
      byte packetType = dat.readByte();
      boolean clearFirst = dat.readBoolean();
      boolean adding = dat.readBoolean();
      short length = dat.readShort();
      int coinAmount = dat.readInt();

      HashMap playerCoins = Aether.proxy.getClientCoins();

      if (clearFirst) {
        playerCoins.clear();
      }

      for (int i = 0; i < length; i++) {
        String username = dat.readUTF();
        if (adding) {
          playerCoins.put(username, Integer.valueOf(coinAmount));
          Aether.getClientPlayer((EntityPlayerSP) player).updateCoinAmount();
        } else {
          playerCoins.remove(username);
        }
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Exemple #2
0
 public static int makeID(String var0, int var1) {
   return Aether.getConfig().getItem(var0, var1).getInt(var1);
 }