From cadd21c18bdd2feb5aff385d4e60b4b7b1424761 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sun, 2 Aug 2015 19:12:39 -0500 Subject: [PATCH] More bonus work --- .../mineplex/hub/bonuses/BonusClientData.java | 31 +++++++++++++------ .../mineplex/hub/bonuses/BonusManager.java | 2 +- .../mineplex/hub/bonuses/BonusRepository.java | 20 ++++++------ .../bonuses/gui/buttons/RankBonusButton.java | 4 +-- 4 files changed, 34 insertions(+), 23 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/BonusClientData.java b/Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/BonusClientData.java index d1a92493d..550cfae07 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/BonusClientData.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/BonusClientData.java @@ -8,10 +8,11 @@ public class BonusClientData { private Timestamp _dailyTime; private Date _rankTime; private Date _voteTime; - private int _rankStreak; - private int _maxRankStreak; + private int _dailyStreak; + private int _maxDailyStreak; private int _voteStreak; private int _maxVoteStreak; + private int _tickets; public Timestamp getDailyTime() { @@ -43,24 +44,24 @@ public class BonusClientData { this._voteTime = _voteTime; } - public void setRankStreak(int rankStreak) + public int getDailyStreak() { - _rankStreak = rankStreak; + return _dailyStreak; } - public int getRankStreak() + public void setDailyStreak(int dailyStreak) { - return _rankStreak; + _dailyStreak = dailyStreak; } - public void setMaxRankStreak(int maxRankStreak) + public int getMaxDailyStreak() { - _maxRankStreak = maxRankStreak; + return _maxDailyStreak; } - public int getMaxRankStreak() + public void setMaxDailyStreak(int maxDailyStreak) { - return _maxRankStreak; + _maxDailyStreak = maxDailyStreak; } public void setVoteStreak(int voteStreak) @@ -82,4 +83,14 @@ public class BonusClientData { { return _maxVoteStreak; } + + public int getTickets() + { + return _tickets; + } + + public void setTickets(int tickets) + { + _tickets = tickets; + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/BonusManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/BonusManager.java index 0b5a0c676..7734a0ceb 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/BonusManager.java @@ -249,7 +249,7 @@ public class BonusManager extends MiniDbClientPlugin { @Override public String getQuery(int accountId, String uuid, String name) { - return "SELECT * FROM bonus WHERE accountId = '" + accountId + "';"; + return "SELECT dailytime, ranktime, votetime, dailyStreak, maxDailyStreak, voteStreak, maxVoteStreak, tickets FROM bonus WHERE accountId = '" + accountId + "';"; } public BonusRepository getRepository() diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/BonusRepository.java b/Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/BonusRepository.java index f789c3c4c..8195c5cff 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/BonusRepository.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/BonusRepository.java @@ -42,18 +42,18 @@ public class BonusRepository extends RepositoryBase { { BonusClientData clientData = new BonusClientData(); - Date rankTime = null; - Timestamp dailyTime = null; - - while (resultSet.next()) { - rankTime = resultSet.getDate("ranktime"); - dailyTime = resultSet.getTimestamp("dailytime"); - System.err.println("COUNT---COUNT"); + while (resultSet.next()) + { + clientData.setDailyTime(resultSet.getTimestamp(1)); + clientData.setRankTime(resultSet.getDate(2)); + clientData.setVoteTime(resultSet.getDate(3)); + clientData.setDailyStreak(resultSet.getInt(4)); + clientData.setMaxDailyStreak(resultSet.getInt(5)); + clientData.setVoteStreak(resultSet.getInt(6)); + clientData.setMaxVoteStreak(resultSet.getInt(7)); + clientData.setTickets(resultSet.getInt(8)); } - clientData.setRankTime(rankTime); - clientData.setDailyTime(dailyTime); - return clientData; } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/gui/buttons/RankBonusButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/gui/buttons/RankBonusButton.java index 547df3f4a..cf01ed593 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/gui/buttons/RankBonusButton.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/bonuses/gui/buttons/RankBonusButton.java @@ -184,8 +184,8 @@ public class RankBonusButton implements GuiItem, Listener { BonusAmount bonusAmount = _bonusManager.getRankBonusAmount(_player); bonusAmount.addLore(lore); - lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getRankStreak()); - lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxRankStreak()); + lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getDailyStreak()); + lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxDailyStreak()); lore.add(" "); lore.add(C.cYellow + "Record Holder: " + C.cWhite + "Phinary"); lore.add(C.cYellow + "Streak: " + C.cWhite + "420");