Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. public class CustomNpc {
  2.     private EntityPlayer npc;
  3.    
  4.     protected CustomNpc() {
  5.         MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
  6.         WorldServer world = ((CraftWorld) Bukkit.getServer().getWorlds().get(0)).getHandle();
  7.         npc = new EntityPlayer(server, world, new GameProfile(UUID.randomUUID(), ChatColor.AQUA + "Я мразь"), new PlayerInteractManager(world));
  8.     }
  9.    
  10.     protected void teleport(Location loc, Player p) {
  11.         npc.teleportTo(loc, false);
  12.         PlayerConnection connection = ((CraftPlayer)p).getHandle().playerConnection;
  13.         connection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, npc));
  14.         connection.sendPacket(new PacketPlayOutNamedEntitySpawn(npc));
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement