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 { @Override public void onEnable(){ System.out.println("Thanks for having me as a plugin at your server :)"); saveDefaultConfig(); } @Override public void onDisable() { System.out.println("Goodbye dood!"); } @EventHandler 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!"); e.setJoinMessage(joinmsg); return; } if(!p.hasPlayedBefore()) { String firstjoinmsg = getConfig().getString("firstjoinmsg"); System.out.println(ChatColor.GREEN + p.getName() + " has joined the server for the first time!"); e.setJoinMessage(firstjoinmsg); return; } } @EventHandler 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!"); e.setQuitMessage(quitmsg); return; } } 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!
Config.yml ans plugin.yml is alright, I was a idiot who forgot to register the events xD. Anyways thanks
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
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
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
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.
Yup, logger is far better. You can designate a log level (info, warning or severe) to the message too which is handy