From 4b4f43ac16adf73b69247fc3557db1c0aa9dbfa3 Mon Sep 17 00:00:00 2001 From: Ty Date: Wed, 13 Aug 2014 16:37:05 -0400 Subject: [PATCH] Convert PortalRepository's redis host fetch to ServerManager constant, and remove debug code section. --- .../src/mineplex/core/portal/Portal.java | 16 ++-------------- .../mineplex/core/portal/PortalRepository.java | 7 ++++--- .../src/mineplex/serverdata/ServerManager.java | 4 ++-- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java index 953adbb96..44d7de506 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java @@ -46,8 +46,7 @@ public class Portal extends MiniPlugin Bukkit.getMessenger().registerOutgoingPluginChannel(GetPlugin(), "BungeeCord"); - String host = plugin.getConfig().getString("serverstatus.connectionurl"); - _repository = new PortalRepository(host); + _repository = new PortalRepository(); } public void SendAllPlayers(String serverName) @@ -150,23 +149,12 @@ public class Portal extends MiniPlugin AddCommand(new ServerCommand(this)); AddCommand(new SendCommand(this)); } - boolean sent = false; + @EventHandler public void checkForServerTransfers(UpdateEvent event) { if (event.getType() != UpdateType.SEC || Bukkit.getOnlinePlayers().length == 0) return; - // DEBUG CODE - REMOVE THIS - if (Bukkit.getOnlinePlayers().length > 0 && !sent) - { - Player player = Bukkit.getOnlinePlayers()[0]; - if (player.isSneaking()) - { - System.out.println("Debug transferring player " + player.getName()); - AddTransferRecord(player.getName(), "TEST-2"); - sent = true; - } - } _retrieve = !_retrieve; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/PortalRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/PortalRepository.java index f2cbf9d3d..43f2ff35c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/PortalRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/PortalRepository.java @@ -6,6 +6,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import mineplex.serverdata.ServerManager; import mineplex.serverdata.Utility; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; @@ -25,11 +26,11 @@ public class PortalRepository /** * Class constructor - * @param host - the host name connection URL for the repository database */ - public PortalRepository(String host) + public PortalRepository() { - this._jedisPool = new JedisPool(new JedisPoolConfig(), host); + this._jedisPool = new JedisPool(new JedisPoolConfig(), ServerManager.DEFAULT_REDIS_HOST, + ServerManager.DEFAULT_REDIS_PORT); } /** diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerManager.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerManager.java index e1a0f46b0..58168fb79 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerManager.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerManager.java @@ -12,10 +12,10 @@ import java.util.Map; public class ServerManager { // The host of the default redis database used for server repository - private static String DEFAULT_REDIS_HOST = "10.33.53.16"; + public final static String DEFAULT_REDIS_HOST = "10.33.53.16"; // The default port used by redis databases - private static int DEFAULT_REDIS_PORT = 6379; + public final static int DEFAULT_REDIS_PORT = 6379; // The cached repository instances private static Map repositories = new HashMap();