42 lines
1.2 KiB
Java
42 lines
1.2 KiB
Java
|
package mineplex.bungee.motd;
|
|||
|
|
|||
|
import java.util.concurrent.TimeUnit;
|
|||
|
|
|||
|
import net.md_5.bungee.api.event.ProxyPingEvent;
|
|||
|
import net.md_5.bungee.api.plugin.Listener;
|
|||
|
import net.md_5.bungee.api.plugin.Plugin;
|
|||
|
import net.md_5.bungee.event.EventHandler;
|
|||
|
|
|||
|
public class MotdManager implements Listener, Runnable
|
|||
|
{
|
|||
|
private Plugin _plugin;
|
|||
|
private MotdRepository _repository;
|
|||
|
|
|||
|
private String _motd = "<EFBFBD>b<EFBFBD>l<EFBFBD>m <20>8<EFBFBD>l<EFBFBD>m[ <20>r <20>9<EFBFBD>lMineplex<65>r <20>f<EFBFBD>lGames<65>r <20>8<EFBFBD>l<EFBFBD>m ]<5D>b<EFBFBD>l<EFBFBD>m <20>r <20>c<EFBFBD>l<EFBFBD>m<EFBFBD>kZ<6B>6<EFBFBD>l<EFBFBD>m<EFBFBD>kZ<6B>e<EFBFBD>l<EFBFBD>m<EFBFBD>kZ<6B>a<EFBFBD>l<EFBFBD>m<EFBFBD>kZ<6B>b<EFBFBD>l<EFBFBD>m<EFBFBD>kZ<6B>r <20>f<EFBFBD>lPLAY NOW<4F>r <20>b<EFBFBD>l<EFBFBD>m<EFBFBD>kZ<6B>a<EFBFBD>l<EFBFBD>m<EFBFBD>kZ<6B>e<EFBFBD>l<EFBFBD>m<EFBFBD>kZ<6B>6<EFBFBD>l<EFBFBD>m<EFBFBD>kZ<6B>c<EFBFBD>l<EFBFBD>m<EFBFBD>kZ";
|
|||
|
|
|||
|
public MotdManager(Plugin plugin)
|
|||
|
{
|
|||
|
_plugin = plugin;
|
|||
|
|
|||
|
_plugin.getProxy().getScheduler().schedule(_plugin, this, 30L, 30L, TimeUnit.SECONDS);
|
|||
|
_plugin.getProxy().getPluginManager().registerListener(_plugin, this);
|
|||
|
|
|||
|
_repository = new MotdRepository();
|
|||
|
_repository.initialize();
|
|||
|
}
|
|||
|
|
|||
|
@EventHandler
|
|||
|
public void ServerPing(ProxyPingEvent event)
|
|||
|
{
|
|||
|
net.md_5.bungee.api.ServerPing serverPing = event.getResponse();
|
|||
|
|
|||
|
event.setResponse(new net.md_5.bungee.api.ServerPing(serverPing.getVersion(), serverPing.getPlayers(), _motd, serverPing.getFavicon()));
|
|||
|
}
|
|||
|
|
|||
|
@Override
|
|||
|
public void run()
|
|||
|
{
|
|||
|
_motd = _repository.retrieveMotd();
|
|||
|
}
|
|||
|
}
|