Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.chickenstyle.npc;
- import java.util.UUID;
- import org.bukkit.Bukkit;
- import org.bukkit.craftbukkit.v1_14_R1.CraftServer;
- import org.bukkit.craftbukkit.v1_14_R1.CraftWorld;
- import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.PlayerJoinEvent;
- import org.bukkit.plugin.java.JavaPlugin;
- import com.mojang.authlib.GameProfile;
- import net.minecraft.server.v1_14_R1.EntityPlayer;
- import net.minecraft.server.v1_14_R1.PacketPlayOutNamedEntitySpawn;
- import net.minecraft.server.v1_14_R1.PacketPlayOutPlayerInfo;
- import net.minecraft.server.v1_14_R1.PlayerConnection;
- import net.minecraft.server.v1_14_R1.PlayerInteractManager;
- // -177 41 216 -137.5 7.1
- public class Main extends JavaPlugin implements Listener {
- EntityPlayer npc;
- //-177 41 216 138 6
- public void onEnable() {
- Bukkit.getPluginManager().registerEvents(this, this);
- npc = new EntityPlayer(
- ((CraftServer) Bukkit.getServer()).getServer(),
- ((CraftWorld) Bukkit.getWorld("world")).getHandle(),
- new GameProfile(UUID.fromString("5f18003a-0428-43e8-86c7-ae22d73105ab"), "§6§lBob"),
- new PlayerInteractManager(((CraftWorld) Bukkit.getWorld("world")).getHandle()));
- npc.setLocation(-176.5,41.0,216.5, -138 ,0);
- }
- @EventHandler
- public void onJoin(PlayerJoinEvent e) {
- PlayerConnection connection = ((CraftPlayer) e.getPlayer()).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));
- }
- }
Add Comment
Please, Sign In to add comment