Remove EntityPlayer from tablist and chat

Discussion in 'Plugin Development' started by OkayName, May 6, 2021.

  1. Offline

    OkayName

    Yes I know this thread has been made before here and here, but these solutions did not work for me. The first solution did not fix it at all, and the second one worked, but it reset the skin of the NPC.

    Heres my code for the NPC:

    NPC:
    Code:
    MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
    WorldServer world = ((CraftWorld) Bukkit.getWorld(((Player) sender).getWorld().getName())).getHandle();
    GameProfile gameProfile = new GameProfile(UUID.fromString("32ad26a8-de3a-42a8-bf9b-6251d354d827"), ChatColor.DARK_AQUA + "" + ChatColor.BOLD + "Discord");
    gameProfile.getProperties().put("textures", new Property("textures", "ewogICJ0aW1lc3RhbXAiIDogMTYyMDIxODQwNDcwOSwKICAicHJvZmlsZUlkIiA6ICI4OGU0YWNiYTQwOTc0YWZkYmE0ZDM1YjdlYzdmNmJmYSIsCiAgInByb2ZpbGVOYW1lIiA6ICJKb2FvMDkxNSIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8xNGQ3MGQyZjE0YzFhZjJmOTliMDZjNjNlMmNiYjk5NjdjNTlmNmE5YjBiODExNDZiOWMxYmMzMjJiMWQyYmVkIgogICAgfQogIH0KfQ==", "x5HemtssxWDu1KGxqWpWkmwVR8rfk6nYRf++/iykkH4jTsFYNjf3IFB/iuN0LOBkjx06qnt8V9Cz9QcQ/ETamJ1SV8SQju/yF06ijcziU0XbDjvhizAJwaF+TD+59+qIFFvTxOkGCSZYQjmDTrUnXmTZoT1KPMXBssulywmiYZ2JmcMaXp7opDGEpno0A6XpBhHhFEUieN3geQl7Ba58qhFL2EXxGzFBtl+4sONerOU5yki6HjdZYwJnrkYAAPnoT+KJuW3DN9NC/UkSuHSWlPbv61TVk8H4vulHhEYS8oQeq3EJoRJZzYODfKu2BTF80Xh8UGMd7+utlWIU/D15W8cU0NSNcPDkhR49CTcsQ/T/mwPubpVNPjGT7z8GLWvFoDaRUwR//+T0Wezz8KdwzPvqJa9Y+ZD/sPQXds4eunU8xsh6vcrGNGAEUNxUvVY8ho5z5KeTiqEg0BhqGnlHljPH6MJXnC01ZwdhhJZHhNGJTu17SZAeg969gouI33kLmy5K+pSqxvTc5NLSZn2pniGhzXgFrpXgkwVh7BRWgvY5A1BY5CtcOaQ0HTkQ6cQgunq6hpXjGuDKHf77f461m1UUyvosjo8GRiGpxI90dgB8A+kYGPc2g7RdZUTX8G66kllVGtCeiWS+3joVbQzE2ExHC0Bx2Bc8xuZgwI/80bM="));
    EntityPlayer npc = new EntityPlayer(server, world, gameProfile, new PlayerInteractManager(world));npc.setLocation(((Player) sender).getLocation().getX(), ((Player) sender).getLocation().getY(), ((Player) sender).getLocation().getZ(), ((Player) sender).getLocation().getYaw(), ((Player) sender).getLocation().getPitch());
    e = npc;
    
    Sending the NPC Packet:
    Code:
    if (e != null) {
        PlayerConnection connection = ((CraftPlayer) event.getPlayer()).getHandle().playerConnection;
        connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, e));
        connection.sendPacket(new PacketPlayOutNamedEntitySpawn(e));
    }
    
     
  2. Offline

    OkayName

  3. Offline

    OkayName

    bump x2
     
  4. Offline

    davidclue

    @OkayName Put this on spigot since I don't believe anyone here knows how to solve your problem. You could also decompile a plugin that already does this and see what they did.
     

Share This Page