コード例 #1
0
  @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 Map<String, Object> serialize() {
    Map<String, Object> result = new LinkedHashMap<String, Object>();

    result.put("UUID", profile.getId().toString());

    return result;
  }
コード例 #3
0
  @Override
  public void a(PacketDataSerializer packetdataserializer)
      throws IOException { // CraftBukkit - added throws
    a = packetdataserializer.a();
    UUID uuid = UUID.fromString(packetdataserializer.c(36));

    b = new GameProfile(uuid, packetdataserializer.c(16));
    int i = packetdataserializer.a();

    for (int j = 0; j < i; ++j) {
      String s = packetdataserializer.c(32767);
      String s1 = packetdataserializer.c(32767);
      String s2 = packetdataserializer.c(32767);

      b.getProperties().put(s, new Property(s, s1, s2));
    }

    c = packetdataserializer.readInt();
    d = packetdataserializer.readInt();
    e = packetdataserializer.readInt();
    f = packetdataserializer.readByte();
    g = packetdataserializer.readByte();
    h = packetdataserializer.readShort();
    j = DataWatcher.b(packetdataserializer);
  }
コード例 #4
0
  private void d() {
    if (this.j != null && !UtilColor.b(this.j.getName())) {
      if (!this.j.isComplete() || !this.j.getProperties().containsKey("textures")) {
        GameProfile gameprofile = MinecraftServer.getServer().getUserCache().a(this.j.getName());

        if (gameprofile != null) {
          Property property =
              (Property) Iterables.getFirst(gameprofile.getProperties().get("textures"), null);

          if (property == null) {
            gameprofile = MinecraftServer.getServer().av().fillProfileProperties(gameprofile, true);
          }

          this.j = gameprofile;
          this.update();
        }
      }
    }
  }
コード例 #5
0
ファイル: NpcPlayer.java プロジェクト: Natfan/CombatTagPlus
  public static NpcPlayer valueOf(Player player) {
    MinecraftServer minecraftServer = MinecraftServer.getServer();
    WorldServer worldServer = minecraftServer.getWorldServer(0);
    PlayerInteractManager playerInteractManager = new PlayerInteractManager(worldServer);
    GameProfile gameProfile =
        new GameProfile(
            UUID.randomUUID(), NpcNameGeneratorFactory.getNameGenerator().generate(player));

    for (Map.Entry<String, Property> entry :
        ((CraftPlayer) player).getProfile().getProperties().entries()) {
      gameProfile.getProperties().put(entry.getKey(), entry.getValue());
    }

    NpcPlayer npcPlayer =
        new NpcPlayer(minecraftServer, worldServer, gameProfile, playerInteractManager);
    npcPlayer.identity = new NpcIdentity(player);

    new NpcPlayerConnection(npcPlayer);

    return npcPlayer;
  }
コード例 #6
0
  public String getName() {
    Player player = getPlayer();
    if (player != null) {
      return player.getName();
    }

    // This might not match lastKnownName but if not it should be more correct
    if (profile.getName() != null) {
      return profile.getName();
    }

    NBTTagCompound data = getBukkitData();

    if (data != null) {
      if (data.hasKey("lastKnownName")) {
        return data.getString("lastKnownName");
      }
    }

    return null;
  }
コード例 #7
0
 public UUID getUniqueId() {
   return profile.getId();
 }
コード例 #8
0
 @Override
 public String toString() {
   return getClass().getSimpleName() + "[UUID=" + profile.getId() + "]";
 }
コード例 #9
0
ファイル: LoginListener.java プロジェクト: LinEvil/Patcher
 protected GameProfile a(GameProfile gameprofile) {
   UUID uuid =
       UUID.nameUUIDFromBytes(("OfflinePlayer:" + gameprofile.getName()).getBytes(Charsets.UTF_8));
   return new GameProfile(uuid, gameprofile.getName());
 }