From 82d51a896fbb36cc3ace21eadedccac4c03eff82 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 19 Feb 2016 19:54:06 -0600 Subject: [PATCH] Add SERVER_STATS to DBPool. Rename STATS to MINEPLEX_STATS --- .../bungee/PlayerStatsRepository.java | 2 +- .../mineplex/cache/player/PlayerCache.java | 11 +++++++++- .../core/antihack/AntiHackRepository.java | 2 +- .../mineplex/serverdata/database/DBPool.java | 20 +++++++++++++------ .../StatusHistoryRepository.java | 2 +- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/PlayerStatsRepository.java b/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/PlayerStatsRepository.java index c664fedb7..009695499 100644 --- a/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/PlayerStatsRepository.java +++ b/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/PlayerStatsRepository.java @@ -14,7 +14,7 @@ public class PlayerStatsRepository extends RepositoryBase public PlayerStatsRepository() { - super(DBPool.getStats()); + super(DBPool.getPlayerStats()); } @Override diff --git a/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerCache.java b/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerCache.java index 3bfb1bf00..232352662 100644 --- a/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerCache.java +++ b/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerCache.java @@ -47,7 +47,16 @@ public class PlayerCache { try { - return _repository.getElement(uuid.toString()); + System.out.println("Getting PlayerCache for " + uuid.toString()); + PlayerInfo playerInfo = _repository.getElement(uuid.toString()); + System.out.println("Got playerINfo: " + playerInfo); + if (playerInfo != null) + { + System.out.println("account id: " + playerInfo.getAccountId()); + System.out.println("name: " + playerInfo.getName()); + } + + return playerInfo; } catch (Exception exception) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java index d80308172..eb3b3cd0c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java @@ -33,7 +33,7 @@ public class AntiHackRepository { PreparedStatement preparedStatement = null; - try (Connection connection = DBPool.getStats().getConnection()) + try (Connection connection = DBPool.getMineplexStats().getConnection()) { preparedStatement = connection.prepareStatement(UPDATE_PLAYER_OFFENSES); diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/DBPool.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/DBPool.java index 2a33e450b..226e45f44 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/DBPool.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/DBPool.java @@ -15,8 +15,9 @@ public final class DBPool private static DataSource ACCOUNT; private static DataSource QUEUE; private static DataSource MINEPLEX; - private static DataSource STATS_MINEPLEX; + private static DataSource MINEPLEX_STATS; private static DataSource PLAYER_STATS; + private static DataSource SERVER_STATS; private static DataSource openDataSource(String url, String username, String password) { @@ -60,12 +61,12 @@ public final class DBPool return MINEPLEX; } - public static DataSource getStats() + public static DataSource getMineplexStats() { - if (STATS_MINEPLEX == null) + if (MINEPLEX_STATS == null) loadDataSources(); - return STATS_MINEPLEX; + return MINEPLEX_STATS; } public static DataSource getPlayerStats() @@ -76,6 +77,11 @@ public final class DBPool return PLAYER_STATS; } + public static DataSource getServerStats() + { + return SERVER_STATS; + } + private static void loadDataSources() { try @@ -122,10 +128,12 @@ public final class DBPool QUEUE = openDataSource("jdbc:mysql://" + dbHost, userName, password); else if (dbSource.toUpperCase().equalsIgnoreCase("MINEPLEX")) MINEPLEX = openDataSource("jdbc:mysql://" + dbHost, userName, password); - else if (dbSource.toUpperCase().equalsIgnoreCase("STATS")) - STATS_MINEPLEX = openDataSource("jdbc:mysql://" + dbHost, userName, password); + else if (dbSource.toUpperCase().equalsIgnoreCase("MINEPLEX_STATS")) + MINEPLEX_STATS = openDataSource("jdbc:mysql://" + dbHost, userName, password); else if (dbSource.toUpperCase().equalsIgnoreCase("PLAYER_STATS")) PLAYER_STATS = openDataSource("jdbc:mysql://" + dbHost, userName, password); + else if (dbSource.toUpperCase().equalsIgnoreCase("SERVER_STATS")) + SERVER_STATS = openDataSource("jdbc:mysql://" + dbHost, userName, password); } } } diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/StatusHistoryRepository.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/StatusHistoryRepository.java index 8f4566b0f..5fd639283 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/StatusHistoryRepository.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/StatusHistoryRepository.java @@ -34,7 +34,7 @@ public class StatusHistoryRepository extends RepositoryBase public StatusHistoryRepository() { - super(DBPool.getStats()); + super(DBPool.getServerStats()); PreparedStatement preparedStatement = null;