Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nplist.add(args[1]);
- List<Integer> stringl = nd.getData().getIntegerList("IdList");
- int entityID = (int)Math.ceil(Math.random() * 1000) + 2000;
- stringl.add(entityID);
- nplist.add(args[1]);
- nd.getData().set("NpcList", nplist);
- nd.getData().set("IdList", stringl);
- nd.getData().set(args[1] + ".Location.X" , p.getLocation().getX());
- nd.getData().set(args[1] + ".Location.Y" , p.getLocation().getY());
- nd.getData().set(args[1] + ".Location.Z" , p.getLocation().getZ());
- nd.getData().set(args[1] + ".Location.Yaw" , p.getLocation().getYaw());
- nd.getData().set(args[1] + ".Location.Pitch" , p.getLocation().getPitch());
- nd.getData().set(args[1] + ".Location.World" , p.getWorld().getName());
- nd.getData().set(args[1] + ".Id", entityID);
- //spawn npc
- McSession session = McSession.search(args[1]);
- McSession.Property pa = session.getProperties("textures");
- String signa = pa.getString("Signature");
- String value = pa.getString("value");
- GameProfile gf = new GameProfile(UUID.fromString("634b2d92-f33e-4d79-9961-95a24a1f941b"), args[2]);
- gf.getProperties().put("textures", new Property("textures", value , signa));
- MinecraftServer nmsServer = ((CraftServer) Bukkit.getServer()).getServer();
- WorldServer nmsWorld = ((CraftWorld) p.getWorld()).getHandle();
- npc = new EntityPlayer(nmsServer, nmsWorld, gf, new PlayerInteractManager(nmsWorld));
- //send packets
- npc.setPositionRotation(p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ(), p.getLocation().getYaw(), p.getLocation().getPitch());
- PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn(npc);
- setValue(packet, "a", entityID);
- setValue(packet, "c", p.getLocation().getX());
- setValue(packet, "d", p.getLocation().getY());
- setValue(packet, "e", p.getLocation().getZ());
- setValue(packet, "f", getfixhead(p.getLocation().getYaw()));
- setValue(packet, "g", getfixhead(p.getLocation().getPitch()));
- sender.sendMessage(pf + " Je hebt een npc gespawnt met de naam " + ChatColor.DARK_AQUA + args[1]);
- for(Player pd : Bukkit.getOnlinePlayers()) {
- PlayerConnection connection = ((CraftPlayer) pd).getHandle().playerConnection;
- connection.sendPacket(packet);
- connection.sendPacket(new PacketPlayOutEntityMetadata(entityID, npc.getDataWatcher(), true));
- connection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, npc));
- connection.sendPacket(new PacketPlayOutNamedEntitySpawn(npc));
- }
- Bukkit.getServer().getConsoleSender().sendMessage("Er heeft iemand een npc gespawnd");
- nd.saveData();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement