@Override
  public void b(PacketDataSerializer packetdataserializer)
      throws IOException { // CraftBukkit - added throws
    packetdataserializer.b(a);

    UUID uuid = b.getId();
    // Spigot start - protocol patch
    if (packetdataserializer.version < 20) {
      packetdataserializer.a(
          uuid == null
              ? ""
              : packetdataserializer.version >= 5
                  ? uuid.toString()
                  : uuid.toString().replaceAll("-", "")); // Spigot
      packetdataserializer.a(
          b.getName().length() > 16
              ? b.getName().substring(0, 16)
              : b.getName()); // CraftBukkit - Limit name length to 16 characters
      if (packetdataserializer.version >= 5) { // Spigot
        packetdataserializer.b(b.getProperties().size());
        Iterator iterator = b.getProperties().values().iterator();

        while (iterator.hasNext()) {
          Property property = (Property) iterator.next();

          packetdataserializer.a(property.getName());
          packetdataserializer.a(property.getValue());
          packetdataserializer.a(property.getSignature());
        }
      }
    } else {
      packetdataserializer.writeUUID(uuid);
    }
    // Spigot end

    packetdataserializer.writeInt(c);
    packetdataserializer.writeInt(d);
    packetdataserializer.writeInt(e);
    packetdataserializer.writeByte(f);
    packetdataserializer.writeByte(g);
    // Spigot start - protocol patch
    if (packetdataserializer.version >= 47) {
      packetdataserializer.writeShort(org.spigotmc.SpigotDebreakifier.getItemId(h));
    } else {
      packetdataserializer.writeShort(h);
    }
    i.a(packetdataserializer);
  }
예제 #2
0
  public void initUUID() {
    UUID uuid;
    if (this.networkManager.spoofedUUID != null) {
      uuid = this.networkManager.spoofedUUID;
    } else {
      uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + this.i.getName()).getBytes(Charsets.UTF_8));
    }
    this.i = new GameProfile(uuid, this.i.getName());
    if (this.networkManager.spoofedProfile != null) {
      Property[] arr$ = this.networkManager.spoofedProfile;
      int len$ = arr$.length;

      for (int i$ = 0; i$ < len$; ++i$) {
        Property property = arr$[i$];
        this.i.getProperties().put(property.getName(), property);
      }
    }
  }