1. Welcome to LilyPad. Download the project, explore the forums, and create your own LilyPad network.


    If you use the software and enjoy it or have a question, or would like to contribute to the future of the software directly or through resources, please sign up and join our little community.

[15:35:34 ERROR]: Could not load 'plugins/LilyStaff.jar' in folder 'plugins'

Discussion in 'Development' started by Matt, Dec 15, 2013.

  1. Matt

    Matt Forum Moderator & Contributor Staff Member Moderator Contributor

    Hello all,

    I just made a LilyPad plugin, but it can't load.
    I get this error:
    Code (text):
    [15:35:34 ERROR]: Could not load 'plugins/LilyStaff.jar' in folder 'plugins'
     
    Code:
    Code (text):
    public class Main extends JavaPlugin implements Listener {
       
        Connect connect;
       
        private Main plugin;
        public static Chat chat = null;
       
        PlayerEvent event;
       
        String playername = event.getPlayer().getDisplayName();
        Player player = event.getPlayer();
        String prefix = chat.getPlayerPrefix(player);
       
        String join = (ChatColor.GREEN + "[Staff] " + prefix + playername + ChatColor.YELLOW + " Joined!");
        String leave = (ChatColor.GREEN + "[Staff] " + prefix + playername + ChatColor.RED + " Left!");

       
        public void onEnable() {
            PluginManager pm = getServer().getPluginManager();
            pm.registerEvents(this, this);
           
            setupChat();
        }
       
        private boolean setupChat() {
            RegisteredServiceProvider<Chat> rsp = Bukkit.getServer().getServicesManager().getRegistration(Chat.class);
            chat = rsp.getProvider();
            return chat != null;
        }
       
        @EventHandler
        public void OnJoin (PlayerJoinEvent event) {
            event.setJoinMessage(join);
        }
       
        @EventHandler
        public void OnLeave (PlayerQuitEvent event) {
            event.setQuitMessage(leave);
        }
       
        @EventListener
        public void globaljoin (MessageEvent event) {
            if (event.getChannel().equalsIgnoreCase("lilystaff.notify")) {
                plugin.getServer().broadcastMessage(join);
            }
        }
       
        @EventListener
        public void globalquit (MessageEvent event) {
            if (event.getChannel().equalsIgnoreCase("lilystaff.notify")) {
                plugin.getServer().broadcastMessage(leave);
            }
        }
    }
    Plugin.yml:
    Code (text):
    name: LilyStaff
    main: me.matthijs110.LilyStaff.Main
    version: 1.0
    depend: [LilyPad-Connect, Vault]
    author: matthijs110
     
    Did I do something wrong?

    I am running the latest version of all. Including Java.
  2. Shawshark

    Shawshark Active Member Resource Contributor

    Is there any more to the error?
  3. Matt

    Matt Forum Moderator & Contributor Staff Member Moderator Contributor

    nop... otherwise I would know the problem
  4. The_Zip

    The_Zip Active Member Resource Contributor

    Thats what I found as interesting, I haven't see many errors where it just states that its not loading. But, for more info on this (Me and Matt have been chatting about this for awhile now), here is the full start up.

    Code (text):
    [15:35:33 INFO]: Starting Minecraft server on *:25566
    [15:35:34 INFO]: This server is running CraftBukkit version git-Bukkit-1.6.4-R2.0-2-g7e1ac0a-b2923jnks (MC: 1.7.2) (Implementing API version 1.7.2-R0.1-SNAPSHOT)
    [15:35:34 ERROR]: Could not load 'plugins/LilyStaff.jar' in folder 'plugins'
    [15:35:34 INFO]: [LilyPad-Connect] Loading LilyPad-Connect v50
    [15:35:34 INFO]: [Vault] Loading Vault v1.2.27-b349
    I know it doesn't help, just some more backing up for information.
  5. Matt

    Matt Forum Moderator & Contributor Staff Member Moderator Contributor

    After I updated my Bukkit, it gives me the full error :D
    Code (text):
    [16:12:30 ERROR]: Could not load 'plugins/LilyStaff.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.NullPointerException
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:182) ~[craftbukkit.jar:git-Bukkit-1.6.4-R2.0-50-g402ee87-b2959jnks]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:308) ~[craftbukkit.jar:git-Bukkit-1.6.4-R2.0-50-g402ee87-b2959jnks]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:231) [craftbukkit.jar:git-Bukkit-1.6.4-R2.0-50-g402ee87-b2959jnks]
        at org.bukkit.craftbukkit.v1_7_R1.CraftServer.loadPlugins(CraftServer.java:255) [craftbukkit.jar:git-Bukkit-1.6.4-R2.0-50-g402ee87-b2959jnks]
        at org.bukkit.craftbukkit.v1_7_R1.CraftServer.<init>(CraftServer.java:233) [craftbukkit.jar:git-Bukkit-1.6.4-R2.0-50-g402ee87-b2959jnks]
        at net.minecraft.server.v1_7_R1.PlayerList.<init>(PlayerList.java:63) [craftbukkit.jar:git-Bukkit-1.6.4-R2.0-50-g402ee87-b2959jnks]
        at net.minecraft.server.v1_7_R1.DedicatedPlayerList.<init>(SourceFile:14) [craftbukkit.jar:git-Bukkit-1.6.4-R2.0-50-g402ee87-b2959jnks]
        at net.minecraft.server.v1_7_R1.DedicatedServer.init(DedicatedServer.java:126) [craftbukkit.jar:git-Bukkit-1.6.4-R2.0-50-g402ee87-b2959jnks]
        at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:424) [craftbukkit.jar:git-Bukkit-1.6.4-R2.0-50-g402ee87-b2959jnks]
        at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617) [craftbukkit.jar:git-Bukkit-1.6.4-R2.0-50-g402ee87-b2959jnks]
    Caused by: java.lang.NullPointerException
        at me.matthijs110.LilyStaff.Main.<init>(Main.java:29) ~[?:?]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.7.0_10]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[?:1.7.0_10]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.7.0_10]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:525) ~[?:1.7.0_10]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:178) ~[craftbukkit.jar:git-Bukkit-1.6.4-R2.0-50-g402ee87-b2959jnks]
        ... 9 more
     
    Line 29:
    Code (text):
    String playername = event.getPlayer().getDisplayName();
  6. Shawshark

    Shawshark Active Member Resource Contributor

  7. Shawshark

    Shawshark Active Member Resource Contributor

    Oh you bet me to it -.-
  8. Shawshark

    Shawshark Active Member Resource Contributor

    It's something to do with
    Code (text):
      PlayerEvent event;
     
      String playername = event.getPlayer().getDisplayName();
      Player player = event.getPlayer();
      String prefix = chat.getPlayerPrefix(player);
  9. Matt

    Matt Forum Moderator & Contributor Staff Member Moderator Contributor

    Yeah, to me exact: It is line 29 that is giving me a NullPointerException:
    Code (text):
    String playername = event.getPlayer().getDisplayName();
  10. Coelho

    Coelho Software Engineer Staff Member Administrator Maintainer

    PlayerEvent event is initialized as null, and you are creating another variable which tries to use the getPlayer() object on it, causing a NullPointerException.
  11. Matt

    Matt Forum Moderator & Contributor Staff Member Moderator Contributor

    How can I fix that? I need that string..
  12. Coelho

    Coelho Software Engineer Staff Member Administrator Maintainer

    Don't make a variable for it?
  13. Matt

    Matt Forum Moderator & Contributor Staff Member Moderator Contributor

    And how do I make IDE?
  14. Coelho

    Coelho Software Engineer Staff Member Administrator Maintainer

  15. TakeMeNL

    TakeMeNL Member Resource Contributor

    What my question is where you get the Chat.class from?
    Bukkit nor Spigot gives that, so any other plugin?

    Edit:
    Also, maybe stupid, but who do you call the globaljoin as is has the same event as globalquit?
    Both listen to lilystaff.notify??
  16. Matt

    Matt Forum Moderator & Contributor Staff Member Moderator Contributor

    I did that first to see if it worked, after that I was planning to putting it in once. Otherwise I hadn't the overview anymore :p
  17. hamzaxx

    hamzaxx Member

  18. Matt

    Matt Forum Moderator & Contributor Staff Member Moderator Contributor

Share This Page