Broken Plugin, not loaded.

Discussion in 'Plugin Development' started by kanx, Sep 7, 2011.

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

    kanx

    I made a little plugin called AlwaysDay, im new at coding and i know its not working, tried to put the
    *jar file into my plugins folder (to get the jar i exported it) it says something about plugin.yml
    I suck so.
    Jar creation failed.. something like that..
    Code:
    package kez.alwaysday;
    
    import java.util.logging.Logger;
    
    import org.bukkit.Bukkit;
    import org.bukkit.World;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class alwaysday extends JavaPlugin{
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
            if(cmd.getName().equalsIgnoreCase("alwaysday")){ // If the player typed /basic then do the following...
                for (World world : Bukkit.getServer().getWorlds()) {
                if(world.getTime() >= 12000 && world.getTime() <= 24000) {
                 world.setTime(14606);
                }
                }
                return true;
            } //If this has happened the function will break and return true. if this hasn't happened the a value of false will be returned.
            return false;
        }
        private final AlwaysDayPlayerListener PlayerListener = new AlwaysDayPlayerListener();
        Logger log = Logger.getLogger("Minecraft");
        public void onEnable(){
            log.info("[AlwaysDay] Loaded plugin");
        }
    public void onDisable(){
            log.info("[AlwaysDay] Unloaded plugin");
          }
    }
    Wait, I tried deleting the .JAR while the server was open running and I couldn't so it might be used by the server.. Somehow it isnt even in the /pl list and commands not working :p
    - How do I enable the / use the onCommand boolean?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  2. Offline

    rominos2

    @kanx

    enable the onCommand method ?
    you can't every commands wich is written in your plugin.yml is send onCommand method
     
  3. Offline

    Pencil

    In Eclipse, click the plugin.yml (one time only!) and hit F5, then try to create the .jar again.
     
  4. Offline

    kanx

    Thanks!

    - Still not working.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  5. Offline

    Pencil

    ok. Post exact error message

    1. in eclipse
    2. in the console

    then I can help you....
     
  6. Offline

    kanx

    There are no error messages in Eclipse.
    Server log:
    Host currently down, will post in the next 6 hours.
     
  7. Offline

    SpikeMeister

    You can test on your own computer, just extract <Edit by Moderator: Redacted mediafire url>
     
    Last edited by a moderator: Nov 12, 2016
  8. Offline

    kanx

    So, if you still are reading this thread. The server is now up and I'm testing it right now.
    Putting plugin in and deleting current server log and will tell u every log I find.
    Server log:
    Code:
    [SEVERE] Could not load 'plugins\alwaysday.jar' in folder 'plugins': 
    java.lang.ClassNotFoundException: kez.alwaysday.AlwaysDay
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:36)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:24)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:168)
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:213)
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136)
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:143)
        at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:110)
        at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigurationManager.java:51)
        at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:133)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:337)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Let me try and see what class is not found, it could be because i named alwaysday with big letters.

    HELP me kids! :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  9. Offline

    badbh222

    On the right track, in your plugin.yml, "main" has to be: "main: <packagename>.<mainclass>" so if my package was "badbh222.MyPlugin" and my main class was MyPlugin.java, my main would look like:

    "main: badbh222.MyPlugin.MyPlugin".

    I see your package is "kez.alwaysday" and your main class is "alwaysday.java" so your main should be:

    "main: kez.alwaysday.alwaysday".

    Java is very fussy about capitalisation. :)
     
  10. Offline

    kanx

    Thank you, AGAIN!
     
Thread Status:
Not open for further replies.

Share This Page