Advertisement
Guest User

MOTDHandler.java

a guest
Apr 14th, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. package com.github.Gamecube762.IsMinecraftDown;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.event.EventHandler;
  5. import org.bukkit.event.EventPriority;
  6. import org.bukkit.event.Listener;
  7. import org.bukkit.event.server.ServerListPingEvent;
  8.  
  9. /**
  10. * Created by Gamecube762 on 2/25/14.
  11. */
  12. public class MOTDHandler implements Listener {
  13.  
  14. Main main;
  15.  
  16. public MOTDHandler(Main main) {
  17. this.main = main;
  18. }
  19.  
  20. @EventHandler(priority = EventPriority.HIGH)//We want it high so it overrides the MOTD set by another plugin
  21. public void MOTD(ServerListPingEvent e){
  22. if(main.config.Settings_announce_MOTD){//ToDo: Turn this into a switch type statement so user had control over which servers to announce
  23. String s = main.config.getSettings_announce_MOTDmessage();
  24. s = s.replace("%Service%","Session") .replace("%Service%", "SessionServer")
  25. .replace("%Service%", "Auth") .replace("%Service%", "AuthServer")
  26. .replace("%Service%", "skins") .replace("%Service%", "minecraft.net")
  27. ;
  28. e.setMotd( ChatColor.translateAlternateColorCodes('&', s) );
  29. }//Todo: make use of the players list in Servers List to announce the servers
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement