Fixed issue and updated bungee motd manager.

This commit is contained in:
Jonathan Williams 2015-07-09 11:07:43 -05:00
parent 77a63f72cc
commit a20a9ba9e7

View File

@ -1,5 +1,6 @@
package mineplex.bungee.motd; package mineplex.bungee.motd;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -31,9 +32,19 @@ public class MotdManager implements Listener, Runnable
_plugin.getProxy().getScheduler().schedule(_plugin, this, 5L, 30L, TimeUnit.SECONDS); _plugin.getProxy().getScheduler().schedule(_plugin, this, 5L, 30L, TimeUnit.SECONDS);
_plugin.getProxy().getPluginManager().registerListener(_plugin, this); _plugin.getProxy().getPluginManager().registerListener(_plugin, this);
_repository = new RedisDataRepository<GlobalMotd>(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(), _repository = new RedisDataRepository<GlobalMotd>(ServerManager.getConnection(true, ServerManager.SERVER_STATUS_LABEL), ServerManager.getConnection(false, ServerManager.SERVER_STATUS_LABEL),
Region.ALL, GlobalMotd.class, "globalMotd"); Region.ALL, GlobalMotd.class, "globalMotd");
run(); run();
if (new File("updateMOTD.dat").exists())
{
List<String> lines = new ArrayList<String>();
lines.add(" §b§l◄§f§lNEW§b§l► §f§l◄§b§lSKYWARS§f§l► §b§l◄§f§lNEW§b§l►");
//lines.add(" §d§lRank Sale §a§l40% Off");
updateMainMotd(" §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r", lines);
System.out.println("Updated Bungee MOTD");
}
} }
@EventHandler @EventHandler
@ -53,14 +64,6 @@ public class MotdManager implements Listener, Runnable
@Override @Override
public void run() public void run()
{ {
// Add in default MOTD listing to database
List<String> lines = new ArrayList<String>();
lines.add(" §b§l◄§f§lNEW§b§l► §f§l◄§b§lSKYWARS§f§l► §b§l◄§f§lNEW§b§l►");
//lines.add(" §d§lRank Sale §a§l40% Off");
updateMainMotd(" §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r", lines);
GlobalMotd motd = _repository.getElement("MainMotd"); GlobalMotd motd = _repository.getElement("MainMotd");
if (motd != null) if (motd != null)