public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws this.a = packetdataserializer.a(); UUID uuid = UUID.fromString(packetdataserializer.c(36)); this.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); this.b.getProperties().put(s, new Property(s, s1, s2)); } this.c = packetdataserializer.readInt(); this.d = packetdataserializer.readInt(); this.e = packetdataserializer.readInt(); this.f = packetdataserializer.readByte(); this.g = packetdataserializer.readByte(); this.h = packetdataserializer.readShort(); this.j = DataWatcher.b(packetdataserializer); }
public void b(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws packetdataserializer.b(this.a); UUID uuid = this.b.getId(); packetdataserializer.a(uuid == null ? "" : uuid.toString()); packetdataserializer.a(this.b.getName().length() > 16 ? this.b.getName().substring(0, 16) : this.b.getName()); // CraftBukkit - Limit name length to 16 characters packetdataserializer.b(this.b.getProperties().size()); Iterator iterator = this.b.getProperties().values().iterator(); while (iterator.hasNext()) { Property property = (Property) iterator.next(); packetdataserializer.a(property.getName()); packetdataserializer.a(property.getValue()); packetdataserializer.a(property.getSignature()); } packetdataserializer.writeInt(this.c); packetdataserializer.writeInt(this.d); packetdataserializer.writeInt(this.e); packetdataserializer.writeByte(this.f); packetdataserializer.writeByte(this.g); packetdataserializer.writeShort(this.h); this.i.a(packetdataserializer); }
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().getProfile(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(); } } } }
public void initUUID() { UUID uuid; if ( networkManager.spoofedUUID != null ) { uuid = networkManager.spoofedUUID; } else { uuid = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + this.i.getName() ).getBytes( Charsets.UTF_8 ) ); } this.i = new GameProfile( uuid, this.i.getName() ); if (networkManager.spoofedProfile != null) { for ( Property property : networkManager.spoofedProfile ) { this.i.getProperties().put( property.getName(), property ); } } }
private void updateSkin(WrappedGameProfile profile, String skinOwner) { try { JSONObject json = (JSONObject) new JSONParser().parse(profileCache.get(skinOwner)); JSONArray properties = (JSONArray) json.get("properties"); for (int i = 0; i < properties.size(); i++) { JSONObject property = (JSONObject) properties.get(i); String name = (String) property.get("name"); String value = (String) property.get("value"); String signature = (String) property.get("signature"); // May be NULL // Uncomment for ProtocolLib 3.4.0 //profile.getProperties().put(name, new WrappedSignedProperty(name, value, signature)); ((GameProfile) profile.getHandle()).getProperties().put(name, new Property(name, value, signature)); } } catch (Exception e) { // ProtocolLib will throttle the number of exceptions printed to the console log } }
public static GameProfile makeProfile(String name, UUID skinId) { GameProfile profile = new GameProfile(UUID.randomUUID(), name); if (skinId != null) { GameProfile skin = new GameProfile(skinId, null); skin = NMS.getServer().av().fillProfileProperties(skin, true); //Srg = func_147130_as if (skin.getProperties().get("textures") == null || !skin.getProperties().get("textures").isEmpty()) { Property textures = skin.getProperties().get("textures").iterator().next(); profile.getProperties().put("textures", textures); } } return profile; }
/** * Create NPCProfile based on game profile * * @param profile Mojang's game profile */ public NPCProfile(GameProfile profile) { this(); this.uuid = profile.getId(); this.name = profile.getName(); for (Entry<String, Collection<Property>> entry : profile.getProperties().asMap().entrySet()) { profile.getProperties().putAll(entry.getKey(), entry.getValue()); } }
public void b(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws packetdataserializer.b(this.a); UUID uuid = this.b.getId(); packetdataserializer.a( uuid == null ? "" : ( ( packetdataserializer.version >= 5 ) ? uuid.toString() : uuid.toString().replaceAll( "-", "" ) ) ); // Spigot packetdataserializer.a(this.b.getName().length() > 16 ? this.b.getName().substring(0, 16) : this.b.getName()); // CraftBukkit - Limit name length to 16 characters if (packetdataserializer.version >= 5 ) { // Spigot packetdataserializer.b(this.b.getProperties().size()); Iterator iterator = this.b.getProperties().values().iterator(); while (iterator.hasNext()) { Property property = (Property) iterator.next(); packetdataserializer.a(property.getName()); packetdataserializer.a(property.getValue()); packetdataserializer.a(property.getSignature()); } } // Spigot packetdataserializer.writeInt(this.c); packetdataserializer.writeInt(this.d); packetdataserializer.writeInt(this.e); packetdataserializer.writeByte(this.f); packetdataserializer.writeByte(this.g); packetdataserializer.writeShort(this.h); this.i.a(packetdataserializer); }
public void doActualSpawn(Location inLocation, GameProfile profile) { Property property = Iterables.getFirst(profile.getProperties().get("textures"), null); if(property == null) profile = MinecraftServer.getServer().av().fillProfileProperties(profile, true); WorldServer worldServer = ((CraftWorld)inLocation.getWorld()).getHandle(); this.m_entity = new RemotePlayerEntity(worldServer.getMinecraftServer(), worldServer, profile, new PlayerInteractManager(worldServer), this); worldServer.addEntity(m_entity); this.m_entity.world.players.remove(this.m_entity); Player player = this.getBukkitEntity(); if(player != null) { player.teleport(inLocation); player.setMetadata("remoteentity", new FixedMetadataValue(this.m_manager.getPlugin(), this)); } this.setHeadYaw(inLocation.getYaw()); this.setYaw(inLocation.getYaw()); ((RemotePlayerEntity)this.m_entity).updateSpawn(); if(!inLocation.getBlock().getRelative(BlockFace.DOWN).isEmpty()) this.m_entity.onGround = true; if(this.m_speed != -1) this.setSpeed(this.m_speed); else this.setSpeed(1d); if(this.m_speedModifier != null) { this.addSpeedModifier(this.m_speedModifier.d(), (this.m_speedModifier.c() == 0)); this.m_speedModifier = null; } }