1.15.2 Unrecognized problem at writing the plugin

Discussion in 'Spigot Plugin Development' started by Phoenix852, Feb 12, 2020.

  1. I am writing a plugin called IronXMessages. Here is my code

    Code (Java):
    package com.thunderkofy;

    import org.bukkit.ChatColor;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.PlayerDeathEvent;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.event.player.PlayerQuitEvent;
    import org.bukkit.plugin.java.JavaPlugin;

    public class ironxmessages extends JavaPlugin implements Listener {
        public void onEnable(){
            System.out.println("Thanks for having me as a plugin at your server :)");
        public void onDisable() {
            System.out.println("Goodbye dood!");
        public void onPlayerJoin(PlayerJoinEvent e) {
            Player p = e.getPlayer();
            if(p.hasPlayedBefore()) {
                String joinmsg = getConfig().getString("joinmsg");
                System.out.println(ChatColor.GREEN + p.getName() + " has joined the server!");
            if(!p.hasPlayedBefore()) {
                String firstjoinmsg = getConfig().getString("firstjoinmsg");
                System.out.println(ChatColor.GREEN + p.getName() + " has joined the server for the first time!");
        public void onPlayerQuit(PlayerQuitEvent e) {
            Player p = e.getPlayer();
            String quitmsg = getConfig().getString("quitmsg");
            System.out.println(ChatColor.GREEN + p.getName() + " has left the server!");
    I seriously see no problem in this but when I start the server, the plugin f**ks me.

    as you can see the plugin doesn't work, and also, the code which I wrote to welcome the player on join and firstjoin etc etc doesn't work.

    Please help!

    Attached Files:

  2. You need to register your listener onEnable.
    • Agree Agree x 1
  3. md_5

    Administrator Developer

    And put the command in plugin.yml
  4. Register Events and you have add the String "joinmsg", "firstjoinmsg" and "quitmsg" to config?
    • Like Like x 1
  5. Whoops! How did I even forgot to register the events.
  6. Config.yml ans plugin.yml is alright, I was a idiot who forgot to register the events xD. Anyways thanks :)
  7. What command sir?
  8. md_5

    Administrator Developer

    Well the ironxmessages command you tried to use in the console
  9. Oh, I did that earlier but when the problem arrived, I removed it from plugin.yml to see if it works or not. But anyways... Ty
  10. Also you don’t need any of the system.out.printlms. Join message is broadcasted to console already and Bukkit tells you when a plugin starts and stops
    • Agree Agree x 1
  11. also the log tells you to specify an api-version in your plugin.yml. if youre using 1.15.2, without writing the api version of 1.15, the server is going to apply internal changes to support older versions and potentially have unintended side effects for newer stuff
  12. Strahan


    Agreed. I hate it when plugins puke crap all over my logs. Spigot already notifies on en/dis.

    Also I'd recommend using the logger instead of println.
  13. Yup, logger is far better. You can designate a log level (info, warning or severe) to the message too which is handy