1.16.5 Plugin doesent load

Discussion in 'Spigot Plugin Development' started by Lolmaster5000, Jun 26, 2021.

  1. Ive coding a bit with npc and now the plugin doesent load.

    Console:

    Code (Text):
    [Lobby] Enabling Lobby v1.0-SNAPSHOT
    [22:35:13] [Server thread/INFO]: Hey
    [22:35:13] [Server thread/WARN]: [Lobby] Loaded class net.citizensnpcs.api.CitizensAPI from Citizens v2.0.28-SNAPSHOT (build 2330) which is not a depend, softdepend or loadbefore of this plugin.
    [22:35:13] [Server thread/ERROR]: Error occurred while enabling Lobby v1.0-SNAPSHOT (Is it up to date?)
    java.lang.IllegalStateException: no implementation set
            at net.citizensnpcs.api.CitizensAPI.getImplementation(CitizensAPI.java:79) ~[?:?]
            at net.citizensnpcs.api.CitizensAPI.getNPCRegistry(CitizensAPI.java:111) ~[?:?]
            at de.skyflamme.lobby.Lobby.onEnable(Lobby.java:24) ~[?:?]
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:351) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:494) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:408) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at org.bukkit.craftbukkit.v1_16_R3.CraftServer.reload(CraftServer.java:881) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at org.bukkit.Bukkit.reload(Bukkit.java:651) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:27) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at org.bukkit.craftbukkit.v1_16_R3.CraftServer.dispatchCommand(CraftServer.java:763) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.PlayerConnection.handleCommand(PlayerConnection.java:1788) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.PlayerConnection.c(PlayerConnection.java:1631) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1584) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:47) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:19) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(SourceFile:144) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(SourceFile:118) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:942) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:935) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.awaitTasks(SourceFile:127) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.MinecraftServer.sleepForTick(MinecraftServer.java:919) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:851) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:164) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_291]

    Main:

    Code (Text):
    package de.skyflamme.lobby;

    import de.skyflamme.lobby.listener.listener;
    import net.citizensnpcs.api.CitizensAPI;
    import net.citizensnpcs.api.npc.NPC;
    import org.bukkit.Bukkit;
    import org.bukkit.Location;
    import org.bukkit.World;
    import org.bukkit.entity.EntityType;
    import org.bukkit.event.Listener;

    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;

    public final class Lobby extends JavaPlugin implements Listener{

        @Override
        public void onEnable() {
            System.out.println("Hey");
            PluginManager pl = this.getServer().getPluginManager();
            pl.registerEvents(new listener(), this);

            World lobby = Bukkit.getWorld("NormalLobby");
            NPC jnrnpc = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, "JumpAndRun");
            jnrnpc.data().setPersistent(NPC.PLAYER_SKIN_UUID_METADATA, "SkyflammeYT");
            jnrnpc.data().setPersistent(NPC.PLAYER_SKIN_USE_LATEST, false);
            Location loc = new Location(lobby, -41, 63, 41, -135, 0);
            jnrnpc.spawn(loc);

            System.out.println("Hey");
        }

        @Override
        public void onDisable() {
            // Plugin shutdown logic
        }
    }

    and the plugin.yml

    Code (Text):
    name: Lobby
    version: ${project.version}
    main: de.skyflamme.lobby.Lobby
    api-version: 1.16
    authors: [ Skyflamme ]
    description: Lobby Plugin

    I think the error is in the main class but I cant figure out what the problem is.
     
  2. SteelPhoenix

    Moderator

    Citizens is not loaded yet when your plugin loads because you didn't specify it as a (soft)depend.
     
    • Like Like x 1
  3. How can I change that, Im new at spigot java, can you help me?

    edit: i got it
     
    #3 Lolmaster5000, Jun 26, 2021
    Last edited: Jun 26, 2021
  4. Just insert to your plugin.yml:

    Code (Text):
    depend:
      - Citizens
      - ... Other Plugins you use
     
  5. Add softdepend: [Citizens]