danik159

Untitled

Aug 10th, 2019
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. package com.chickenstyle.npc;
  2.  
  3. import java.util.UUID;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.craftbukkit.v1_14_R1.CraftServer;
  7. import org.bukkit.craftbukkit.v1_14_R1.CraftWorld;
  8. import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer;
  9. import org.bukkit.event.Listener;
  10. import org.bukkit.event.player.PlayerJoinEvent;
  11. import org.bukkit.plugin.java.JavaPlugin;
  12.  
  13. import com.mojang.authlib.GameProfile;
  14.  
  15. import net.minecraft.server.v1_14_R1.EntityPlayer;
  16. import net.minecraft.server.v1_14_R1.PacketPlayOutNamedEntitySpawn;
  17. import net.minecraft.server.v1_14_R1.PacketPlayOutPlayerInfo;
  18. import net.minecraft.server.v1_14_R1.PlayerConnection;
  19. import net.minecraft.server.v1_14_R1.PlayerInteractManager;
  20.  
  21. // -177 41 216 -137.5 7.1
  22.  
  23. public class Main extends JavaPlugin implements Listener {
  24. EntityPlayer npc;
  25. public void onEnable() {
  26. Bukkit.getPluginManager().registerEvents(this, this);
  27. npc = new EntityPlayer(
  28. ((CraftServer) Bukkit.getServer()).getServer(),
  29. ((CraftWorld) Bukkit.getWorld("world")).getHandle(),
  30. new GameProfile(UUID.fromString("5f18003a-0428-43e8-86c7-ae22d73105ab"), "§l§6Mini Games Chicken!"),
  31. new PlayerInteractManager(((CraftWorld) Bukkit.getWorld("world")).getHandle()));
  32. npc.setLocation(-177.5,41.0,216.5,-137,7);
  33. }
  34. public void onJoin(PlayerJoinEvent e) {
  35.  
  36. PlayerConnection connection = ((CraftPlayer) e.getPlayer()).getHandle().playerConnection;
  37.  
  38. connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, npc));
  39. connection.sendPacket(new PacketPlayOutNamedEntitySpawn(npc));
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment