Solved My plugins aren't working anymore

Discussion in 'Plugin Development' started by iliasdewachter, Dec 9, 2012.

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

    iliasdewachter

    Hi all,

    I got a Major problem: My plugins aren't working anymore, they don't give an error, they just don't work. :'(



    Check it out, and if I do something wrong, please tell me.
     
  2. Offline

    ClintonM0

    You have to register the events into the core plugin class
     
  3. Offline

    iliasdewachter

    Huh, I never ever done that before -.- .
    And how do i have to do that?
     
  4. Offline

    iliasdewachter

    Sorry, but I can't find the answer, can you please explain it to me with some code? (I really hate this because i'm so bored right now!)
     
  5. Offline

    tommycake50

    in your main class in your onEnable()
    Code:
    PluginManager pm = getServer().getPluginManager();
    pm.registerEvents(listenerclass);
     
  6. Offline

    Tirelessly

    tommycake50 I believe it's actually

    registerEvents(<T implements Listener>, <T extends JavaPlugin>)
     
  7. Offline

    iliasdewachter

    Doesn't work:

    Classes.java
    Code:
    package com.hotmail.ilias.dewachter.Classes;
     
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Classes extends JavaPlugin{
        public void onEnable(){
            PluginManager pm = getServer().getPluginManager();
            pm.registerEvents(new LoginListener(), this);
        }
    }
    
    LoginListener.java
    Code:
    package com.hotmail.ilias.dewachter.Classes;
     
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerLoginEvent;
     
    public class LoginListener implements Listener {
       
        @EventHandler
        public void onPlayerLogin(PlayerLoginEvent event) {
            Player player = (Player) event.getPlayer();
            player.sendMessage("Welcome to the server!");
        }
       
    }
    
     
  8. Offline

    tommycake50

    oh yeah sorry i was doing it off the top of my head :/.
     
  9. Offline

    iliasdewachter

  10. Offline

    tommycake50

    can we please see your main class?
     
  11. Offline

    iliasdewachter

    it's classes.java

    I just created a nea project because all my projects aren't working. (This is a simple 1 :D )

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

    tommycake50

    i meant the source xD.
    but from what we have told you it should be fine.
     
  13. Offline

    coldandtired

    Player login might be too early for the player to receive messages. Try sending to the console to check.
     
  14. Offline

    iliasdewachter

    Doesn't work :'( omg!, why!?


    @Tommycake

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

    tommycake50

    oh it wasnt showing for me for some odd reason.
    use a PlayerJoinEvent PlayerLoginEvent is too early.
     
  16. Offline

    iliasdewachter

    FINALY!, THANKYOU SOOOO MUCH! :)
     
  17. Offline

    lenis0012

    tag the thread with solved
     
Thread Status:
Not open for further replies.

Share This Page