[Fixed sorta]Issue with registering a event

Discussion in 'Plugin Development' started by Butkicker12, Aug 20, 2011.

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

    Butkicker12

    So my mentor was teaching me the basics about registering events and he got this error and now I got it.
    [​IMG]
    [​IMG]
    He said it might be eclipse.
     
  2. Offline

    Banana937

    Scroll over the Event thing that is underlined in red and see if it asks you to import Event.
     
  3. Offline

    Butkicker12

    [​IMG]
     
  4. Offline

    DrBowe

    Just manually import it, Eclipse is weird like this sometimes.
     
  5. Offline

    Butkicker12

    I know how to import but that flew over my head. Could you walk me thru?
     
  6. Offline

    DrBowe

    Try typing this in as an import (at the top of your main file), and see if it works:
    import org.bukkit.event.Event;
     
  7. Offline

    Butkicker12

    Nope, The error switched to this:
    Multiple markers at this line
    - The method registerEvent(Event.Type, Listener, Event.Priority, Plugin) in the type PluginManager is not applicable for the arguments
    (Event.Type, AdminModePlayerListener, Event.Priority, AdminModeMain)
    - Event cannot be resolved to a variable
     
  8. Offline

    chernobyl360

    have you imported both craftbukkit and bukkit?
     
  9. Offline

    DrBowe

    That was my first thought, but he gets JavaPlugin and other Bukkit interfaces just fine.

    @Butkicker12
    Are you sure that you've added the most recent Bukkit.jar as a Build-Path?
     
  10. Offline

    chernobyl360

    im starting to think eclipse is messed up. try and remove every file for eclipse other then eclipse itself and start it up.
     
  11. Offline

    Butkicker12

    Yep I did it today @emericask8ur did it for me, Ill get a screenshot
     
  12. Offline

    Slash1987

    Post again all your code and we'll try to fix this
     
  13. Offline

    DrBowe

    If manually importing Event doesn't work, then something's horribly messed up with your build-paths. (In my opinion)
     
  14. Offline

    Butkicker12

    Code:
    package me.butkicker12.AdminMode;
    
    import java.util.logging.Logger;
    
    import org.bukkit.event.Event.Priority;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.event.Event;
    
    public class AdminModeMain extends JavaPlugin{
        Logger log = Logger.getLogger("Minecraft");//this is your Logger Which your are defining
        final private AdminModePlayerListener playerListener =  new AdminModePlayerListener();//Creating Block Listener
    
        @Override
        public void onDisable() {
        log.info("Disabled");//log
    
        }
    
        @Override
        public void onEnable() {
        PluginManager pm = getServer().getPluginManager();//get your plugin manager
        pm.registerEvent(Event.Type.PLAYER_INVENTORY, playerListener, Priority.Normal, this);//register your event
        log.info("Enabled");//log
    
        }
    
        }
    @Slash1987
     
  15. Offline

    chernobyl360

    Code:
    import java.util.logging.Logger;
    
    import org.bukkit.event.Event;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.util.config.Configuration;
    
    public class HeadStone extends JavaPlugin{
        public static Logger log;
        public Configuration config;
        protected static String SIGN_MESSAGE = "Here Lies";
        private final HSEntityListener EntityListener = new HSEntityListener(this);
        @Override
        public void onDisable() {
            log.info(getDescription().getName() + " version " + getDescription().getVersion() + " unloaded.");
        }
        @Override
        public void onEnable() {
            loadConfig();
            log = Logger.getLogger("Minecraft");
            log.info(getDescription().getName() + " version " + getDescription().getVersion() + " loaded.");
    
            PluginManager pm = getServer().getPluginManager();
            pm.registerEvent(Event.Type.ENTITY_DEATH, this.EntityListener, Event.Priority.Normal, this);
        }
    this is from my headstone plugin. try and use this setup.
     
  16. Offline

    Slash1987

    nothing seems wrong in your code, my advice is to download again eclipse and reinstall it again
     
  17. Offline

    Butkicker12

    Nope did not work :/ Error as of now:
    The method registerEvent(Event.Type, Listener, Event.Priority, Plugin) in the type PluginManager is not applicable for the arguments (Event.Type,
    AdminModePlayerListener, Event.Priority, AdminModeMain)

    @Slash1987 @chernobyl360 @DrBoweNur I'm reinstalling. Hopefully this will work. Thanks for your help so far. Didnt work if it helps I have other plugin im tinkering with and they have the same issue


    I have fixed the event issue. I have other ones I will ask my mentor

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

    DrBowe

    @Butkicker12
    So did you ever figure out what went wrong? Or did it just sort of fix itself?
     
  19. Offline

    Butkicker12

    It fixed its self, when i reinstalled. But i got other issues now :/
     
Thread Status:
Not open for further replies.

Share This Page