Fixed GemHunter in StaffServer and added offline stat increment :)

This commit is contained in:
Jonathan Williams 2014-10-04 15:43:33 -07:00
parent 66457ded60
commit bf11635616
4 changed files with 4 additions and 18 deletions

View File

@ -73,6 +73,7 @@ public class StatsManager extends MiniClientPlugin<PlayerStats>
} }
_statUploadQueue.get(uuidString).put(statName, value); _statUploadQueue.get(uuidString).put(statName, value);
System.out.println("added to stat upload queue.");
} }
protected void saveStats() protected void saveStats()
@ -80,8 +81,6 @@ public class StatsManager extends MiniClientPlugin<PlayerStats>
if (_statUploadQueue.isEmpty()) if (_statUploadQueue.isEmpty())
return; return;
PreparedStatement preparedStatement = null;
try try
{ {
NautHashMap<String, NautHashMap<Integer, Integer>> uploadQueue = new NautHashMap<String, NautHashMap<Integer, Integer>>(); NautHashMap<String, NautHashMap<Integer, Integer>> uploadQueue = new NautHashMap<String, NautHashMap<Integer, Integer>>();
@ -108,20 +107,6 @@ public class StatsManager extends MiniClientPlugin<PlayerStats>
{ {
exception.printStackTrace(); exception.printStackTrace();
} }
finally
{
if (preparedStatement != null)
{
try
{
preparedStatement.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}
} }
@Override @Override

View File

@ -70,6 +70,7 @@ public class StatsRepository extends RepositoryBase
public void saveStats(NautHashMap<String, NautHashMap<Integer, Integer>> uploadQueue) public void saveStats(NautHashMap<String, NautHashMap<Integer, Integer>> uploadQueue)
{ {
System.out.println("saving stats.");
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
try try
@ -80,6 +81,7 @@ public class StatsRepository extends RepositoryBase
{ {
for (Integer statId : uploadQueue.get(uuid).keySet()) 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(1, statId);
preparedStatement.setInt(2, uploadQueue.get(uuid).get(statId)); preparedStatement.setInt(2, uploadQueue.get(uuid).get(statId));
preparedStatement.setString(3, uuid); preparedStatement.setString(3, uuid);

View File

@ -48,7 +48,6 @@ public class StaffServer extends JavaPlugin
new NpcManager(this, new Creature(this)); new NpcManager(this, new Creature(this));
ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, clientManager)); ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, clientManager));
new PlayerTracker(this, serverStatusManager.getCurrentServerName(), serverStatusManager.getUs());
PreferencesManager preferenceManager = new PreferencesManager(this, clientManager, donationManager); PreferencesManager preferenceManager = new PreferencesManager(this, clientManager, donationManager);
preferenceManager.GiveItem = false; preferenceManager.GiveItem = false;

View File

@ -25,7 +25,7 @@ public class GemHunterCommand extends CommandBase<SalesPackageManager>
int amount = Integer.parseInt(args[1]); int amount = Integer.parseInt(args[1]);
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, "Gem Hunter Level " + amount, false, 0, false); 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!")); caller.sendMessage(F.main(Plugin.GetName(), "Added Level " + amount + " Gem Hunter to " + playerName + "'s account!"));
} }
} }