Plugin not loading

Discussion in 'Plugin Development' started by eagledude4, Jan 31, 2011.

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

    eagledude4

    So I'm trying to put together a plugin, and used a source of a plugin that I know works for a base.

    This is the main class:
    Code:
    package com.bukkit.HOMEPC_Jordan.GroupSpawns;
    import java.io.*;
    
    import org.bukkit.Server;
    import org.bukkit.event.Event.Priority;
    import org.bukkit.event.Event;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.PluginLoader;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.plugin.PluginManager;
    
    import com.nijikokun.bukkit.Permissions.Permissions;
    
    public class GroupSpawns extends JavaPlugin {
        private final GSPlayerListener playerListener = new GSPlayerListener(this);
        public static Permissions Permissions = null;
    
        public GroupSpawns(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
            super(pluginLoader, instance, desc, folder, plugin, cLoader);
        }
    
        public void onEnable() {
        PluginManager pm = getServer().getPluginManager();
            pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.High, this);
            pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
            System.out.println("Group Spawns is enabled!" );
        }
    
        public void onDisable() {
        PluginDescriptionFile pdfFile = this.getDescription();
            System.out.println( "[GroupSpawns] version [" + pdfFile.getVersion() + "] unloaded" );
        }
    }

    When I start the server it doesn't say "Group Spawns enabled!" in the batch file

    What am I doing wrong?
     
  2. Offline

    darknesschaos

    do you have your yml file?

    edit: without it you shouldnt see anything.
     
  3. Offline

    eagledude4

    Yes, I checked it off as a resource to export, along with the project ofcourse, the .classpath and the .project
     
  4. Offline

    darknesschaos

    Try starting fresh with a blank template. get that to load first then move on. works for me every time.
     
  5. Offline

    8e8

    In the batch file meaning the console, or the server.log? It wouldn't show in the .log afaik. I can't see why it wouldn't show in the console though. Do any errors pop up when the server starts? What build of craftbukkit are you using?
     
  6. Offline

    eagledude4

    server console. I'm going to start a fresh project and see what happens.
     
  7. Offline

    Redecouverte

    it's better to not use System.out directly, do it that way:

    Code:
    import java.util.logging.Logger;
    
    private static final Logger logger = Logger.getLogger("Minecraft");
    
     logger.info("Group Spawns is enabled!" );
    --- merged: Feb 4, 2011 7:50 PM ---
    plugin.yml has to be in the default package afaik
     
  8. Offline

    eagledude4

    I'll use the logger instead. And the plugin.yml is in the default package. Although I don't know what afaik means,
     
  9. Offline

    Redecouverte

    afaik -> as far as i know :)
     
  10. Offline

    eagledude4

    This is what I have now:
    Code:
    package com.bukkit.eagledude4.GroupSpawns;
    
    import java.io.*;
    import java.util.logging.Logger;
    
    import org.bukkit.Server;
    import org.bukkit.event.Event;
    import org.bukkit.event.Event.Priority;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.PluginLoader;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class GroupSpawns extends JavaPlugin {
    private static final Logger logger = Logger.getLogger("Minecraft");
    private final GroupSpawnsPlayerListener playerListener = new GroupSpawnsPlayerListener(this);
        public GroupSpawns(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) throws IOException {
            super(pluginLoader, instance, desc, folder, plugin, cLoader);
        }
    
        public void onEnable() {
        PluginManager pm = getServer().getPluginManager();
            pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this);
            PluginDescriptionFile pdfFile = this.getDescription();
            logger.info( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
        }
    
        public void onDisable() {
            logger.info("Group Spawns has been disabled" );
        }
    }
     
  11. Offline

    Redecouverte

    looks fine, does it work ?
     
  12. Offline

    eagledude4

    I just tried it with the newest build of craft bucket (241) and I got a no version defined error when I started the server, which is odd.

    plugin.yml:
    Code:
    name: GroupSpawns
    
    main: com.bukkit.eagledude4.GroupSpawns.GroupSpawns
    
    ver: 1
     
  13. Offline

    Redecouverte

    here's one of my plugin.yml:

    Code:
    name: BasicNpcs
    main: org.bukkit.redecouverte.basicnpcs.Main
    version: 0.1
    website: http://forums.bukkit.org
    authors:
      - Redecouverte
    description: nps port
    commands:
      bnpc:
        description: Main npc command
        usage: /bnpc
               
    -> change ver to version :)
     
  14. Offline

    eagledude4

Thread Status:
Not open for further replies.

Share This Page