How do I add Announcements to my plugin?

Discussion in 'Plugin Development' started by DragsZombies, Sep 28, 2012.

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

    DragsZombies

    I'm trying to have my plugin show the name of the plugin with the version, and tell who the author was. I'm also wondering, how would I be able to disable the plugin in game, and then still be able to enable in game, using /disable or /enable to enable that plugin or vise versa.


    Thanks!

    DragsZombies
     
  2. Offline

    krazytraynz

    I'm not entirely sure about the enabling/disabling plugins, but as for the broadcast, you could do something like this:
    Code:
    public void giveInfo(PlayerJoinEvent e){
    Player p = e.getPlayer();
    p.sendMessage("This server is running <Plugin name here>");
    p.sendMessage("Author: DragsZombies");
    }
    
     
  3. Offline

    DragsZombies

    Alright, Thank you! This helps me a lot! would I need to put it into the plugin.yml?
     
  4. Offline

    krazytraynz

    Nope, just add this to your onEnable:
    Code:
    getServer().getPluginManager().registerEvents(this, this);
    
    Oh and you also need to add @EventHandler above the giveInfo method, and have your main class implement Listener. Of course, this is assuming that you put the method in your main class.
     
  5. Offline

    DragsZombies

    Yeah, Thank you very much, this helped me a lot! :D
     
Thread Status:
Not open for further replies.

Share This Page