Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GameProfile gameProfile = new GameProfile(UUID.fromString("0a2b7487-fa7b-4f48-b00f-106356c6e836"), "skin696561374");
- gameProfile.getProperties().removeAll("textures");
- gameProfile.getProperties().put("textures", new Property("textures", "eyJ0aW1lc3RhbXAiOjE1ODY0NDM1NjAwNzgsInByb2ZpbGVJZCI6IjgyYzYwNmM1YzY1MjRiNzk4YjkxYTEyZDNhNjE2OTc3IiwicHJvZmlsZU5hbWUiOiJOb3ROb3RvcmlvdXNOZW1vIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS82ODc0NjEyMWI1OWEzODY2NzM4N2Q4OTRiMzczMjYwYWY5MzU1OGIwOTY2YzdiZWRmODAzZTExNDBmZmIyYWE2IiwibWV0YWRhdGEiOnsibW9kZWwiOiJzbGltIn19fX0=", "AVnFmYfgysy4OXmrW3PlVkIhPY/b+Ma3Re544q0hsRpRpSyZm7v4+7gbeaS8NmyiETt1X2TX2NfniVJ5TcKf6BLOKjEXep1FZ+uTZk39rL0dH/vi/ysZwnVBTnpzRrVBNMFN3VjmNb9CrNPR1Djp9q2b0jKJSQ2xMM1Ek4AsooE9BGGdR6HNtHVzYBHEaRl51L+iIOZNSVA3wjw6Ko1wjiMqq7hKm0+TV5UqP7gnvIQ+ck29YkgRGZ/O8d6MHhWXxaxokIbIfJKmvNo4Evepxsc6k/MW0kWnXM0BKsCXjRi/MPbJBbVwtlaIZ1JSO83YPVobhRXsV1n9NqXG2SsrbRIPqyx5ee570CyghTXzxZFj4JGpqKAaEGT5QjyUcioaO0FzF/S+kANAaLk8Ni69LqMQrzXY0p4MMEToVIctAiWzwfJ6yt1aji/CO3zXNdhoCAU1CTiHq2ji02SJoVdJg8GzpxuQ1ezwa1ZByzCVFTOIHvHA2EHKQ23ZXx9u3cDRLF3en51aYKz1XrbEgWCjbSUfN3RxW43i9478/JgvT1e5q8W+2Lb5edodvEqZql6iCukTya5b4nxqda2cXflKET7x7gkkU6tReQoRyvthkdmxTY3F0h73RmphH3oIJGr1zNX8LR1gPJ/sw4eegnxxqAl/aYWqgq8hUX5QgjmCvRE="));
- spawnNPC(bwTeam.getStuffPNJLocation(), gameProfileStuff);
- spawnNPC(bwTeam.getUpgradePNJLocation(), gameProfile);
- public void spawnNPC(Location location, GameProfile gameProfile) {
- NPC npc = new NPC(location, gameProfile);
- Bukkit.getOnlinePlayers().forEach(npc::sendNpcToPlayer);
- }
- public class NPC {
- private Location location;
- private String name;
- private EntityPlayer npc;
- public NPC(Location location, GameProfile gameProfile) {
- this.location = location;
- MinecraftServer nmsServer = ((CraftServer) Bukkit.getServer()).getServer();
- WorldServer nmsWorld = ((CraftWorld) location.getWorld()).getHandle();
- PlayerInteractManager pim = new PlayerInteractManager(nmsWorld);
- npc = new EntityPlayer(nmsServer, nmsWorld, gameProfile, new PlayerInteractManager(nmsWorld));
- Player npcPlayer = npc.getBukkitEntity().getPlayer();
- npcPlayer.setPlayerListName("");
- npc.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
- npc.setInvulnerable(true);
- }
- public void sendNpcToPlayer(Player player) {
- PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
- connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, npc));
- connection.sendPacket(new PacketPlayOutNamedEntitySpawn(npc));
- connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, npc));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement