Do you ever wanted to set the motd like this: Welcome on my server, <name>? Then this is the right thread you are looking for. At first make a config.yml in your project folder and write in it: Motd: ''. In onEnable() write this: Code:Java public void onEnable() {saveDefaultConfig();} Then make two methods: Code:Java public void setMotd(String motd) {getConfig().set("Motd", motd);saveConfig();} and Code:Java public String getMotd() {return ChatColor.translateAlternateColorCodes('&', getConfig().getString("Motd"));} next lets make our command to set and display the motd: Code:Java @Overridepublic boolean onCommand(CommandSender sender, Command command, String cmd,String[] args) { Player p = (Player) sender;if (commandLabel.equalsIgnoreCase("motd")) {if (args.length == 0) {//Display player the motdp.sendMessage("Motd: §r" + getMotd());return true;} else {//Player writes a new Motd:String msg = "";for (int i = 0; i < args.length; i++) {msg = msg + " " + args;}msg = msg.substring(1);setMotd(msg);p.sendMessage("Motd set: §r"+ getMotd());return true;}}return true;} Next we need two events, the first is the PlayerJoinEvent: Code:Java @EventHandlerpublic void onJoin(PlayerJoinEvent e) {Player p = e.getPlayer();String ip = "" + p.getAddress().getAddress().getHostAddress();ip = ip.replace(".", "_");if (!getConfig().contains("IPs." + ip)) {getConfig().set("IPs." + ip, p.getName());saveConfig();}} It just puts in the config the players ip and his name if it doesnt contains it. The next event is the ServerListPingEvent, thats when you click in Minecraft on Multiplayer and it shows you all the servers: Code:Java @EventHandlerpublic void onPing(ServerListPingEvent e) {String ip = "" + e.getAddress();ip = ip.substring(1);try {e.setMotd(getMotd().replace("<player>",getConfig().getString("IPs." + ip.replace(".", "_"))));} catch (Exception e2) {e.setMotd(getMotd());} } it replaces the <player> in the motd with the players name (from the config), if it doesnt work then it doesnt replace the <player> with the players name I hope that helped you! Please give me feedback if it helped you
Nice for small servers, but do not forget to mention that if you're having thousands of players on your server your "config file", which is made to be little configuration, is not going to like thousands of lines in it. I highly advise using a database for this.
As well, don't use .replace to convert & into chat colors - Use ChatColor.translateAlternateColorCodes('&', stringToTranslate) (or some method like that) as it will only filter certain things. For example... Welcome to AwesomeServer! We have Factions & Creative! would be messed up by your translator, whereas ChatColor's version will preserve the & sign.
I once created a system like this, but removed it because multiple players on the same IP will see only the latest player's name to join the server