[1.16] Npc WorldServer thing doesent Work

Discussion in 'Plugin Development' started by Kopflos, Mar 16, 2021.

Thread Status:
Not open for further replies.
  1. Offline

    Kopflos

    I don't know why but I have a problem with NMS. I want to make an NPC but it doesn't really work with the WorldServer.

    The Error is:
    "Inconvertible types; cannot cast 'org.bukkit.World' to 'org.bukkit.craftbukkit.v1_16_R3.CraftServer'"


    I implemented NMS using BuildTools and here is my code:
    Code:
        public static void createNPC(Player player) {
            World w = Bukkit.getWorld("world");
            MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
            WorldServer world = ((CraftServer)w).getHandle();
            GameProfile gameProfile = new GameProfile(UUID.randomUUID(), ChatColor.AQUA + "" + ChatColor.BOLD + "Practice");
        }
    Can anyone help me?
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Kopflos Why are you casting w to CraftServer?
     
  3. Offline

    Kopflos

    I watched a youtube how I can create an NPC, is it not good?
     
  4. Online

    KarimAKL

    @Kopflos You probably meant to cast World to CraftWorld, not CraftServer.
     
Thread Status:
Not open for further replies.

Share This Page