From bf116356161d6bac769bd36387287fc25ed1094c Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Sat, 4 Oct 2014 15:43:33 -0700 Subject: [PATCH] Fixed GemHunter in StaffServer and added offline stat increment :) --- .../src/mineplex/core/stats/StatsManager.java | 17 +---------------- .../mineplex/core/stats/StatsRepository.java | 2 ++ .../src/mineplex/staffServer/StaffServer.java | 1 - .../salespackage/command/GemHunterCommand.java | 2 +- 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java index 002a84355..c4945f8c4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java @@ -73,6 +73,7 @@ public class StatsManager extends MiniClientPlugin } _statUploadQueue.get(uuidString).put(statName, value); + System.out.println("added to stat upload queue."); } protected void saveStats() @@ -80,8 +81,6 @@ public class StatsManager extends MiniClientPlugin if (_statUploadQueue.isEmpty()) return; - PreparedStatement preparedStatement = null; - try { NautHashMap> uploadQueue = new NautHashMap>(); @@ -108,20 +107,6 @@ public class StatsManager extends MiniClientPlugin { exception.printStackTrace(); } - finally - { - if (preparedStatement != null) - { - try - { - preparedStatement.close(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - } - } } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java index 883d3aaec..c08c7b0b2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java @@ -70,6 +70,7 @@ public class StatsRepository extends RepositoryBase public void saveStats(NautHashMap> uploadQueue) { + System.out.println("saving stats."); PreparedStatement preparedStatement = null; try @@ -80,6 +81,7 @@ public class StatsRepository extends RepositoryBase { for (Integer statId : uploadQueue.get(uuid).keySet()) { + System.out.println("saving stat : uuid=" + uuid + " " + statId + "=" + uploadQueue.get(uuid).get(statId)); preparedStatement.setInt(1, statId); preparedStatement.setInt(2, uploadQueue.get(uuid).get(statId)); preparedStatement.setString(3, uuid); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java index d8670c249..3b86977a4 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java @@ -48,7 +48,6 @@ public class StaffServer extends JavaPlugin new NpcManager(this, new Creature(this)); ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, clientManager)); - new PlayerTracker(this, serverStatusManager.getCurrentServerName(), serverStatusManager.getUs()); PreferencesManager preferenceManager = new PreferencesManager(this, clientManager, donationManager); preferenceManager.GiveItem = false; diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/GemHunterCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/GemHunterCommand.java index b47f6d8e2..cc1a00fc1 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/GemHunterCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/GemHunterCommand.java @@ -25,7 +25,7 @@ public class GemHunterCommand extends CommandBase int amount = Integer.parseInt(args[1]); Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, "Gem Hunter Level " + amount, false, 0, false); - Plugin.getStatsManager().incrementStat(UUIDFetcher.getUUIDOf(playerName).toString(), "Global.GemsEarned", amount); + Plugin.getStatsManager().incrementStat(UUIDFetcher.getUUIDOf(playerName).toString(), "Global.GemsEarned", 5000 + (amount * 5000)); caller.sendMessage(F.main(Plugin.GetName(), "Added Level " + amount + " Gem Hunter to " + playerName + "'s account!")); } }