More bonus work

This commit is contained in:
Shaun Bennett 2015-08-02 19:12:39 -05:00
parent 06be7b2cdd
commit cadd21c18b
4 changed files with 34 additions and 23 deletions

View File

@ -8,10 +8,11 @@ public class BonusClientData {
private Timestamp _dailyTime; private Timestamp _dailyTime;
private Date _rankTime; private Date _rankTime;
private Date _voteTime; private Date _voteTime;
private int _rankStreak; private int _dailyStreak;
private int _maxRankStreak; private int _maxDailyStreak;
private int _voteStreak; private int _voteStreak;
private int _maxVoteStreak; private int _maxVoteStreak;
private int _tickets;
public Timestamp getDailyTime() public Timestamp getDailyTime()
{ {
@ -43,24 +44,24 @@ public class BonusClientData {
this._voteTime = _voteTime; 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) public void setVoteStreak(int voteStreak)
@ -82,4 +83,14 @@ public class BonusClientData {
{ {
return _maxVoteStreak; return _maxVoteStreak;
} }
public int getTickets()
{
return _tickets;
}
public void setTickets(int tickets)
{
_tickets = tickets;
}
} }

View File

@ -249,7 +249,7 @@ public class BonusManager extends MiniDbClientPlugin<BonusClientData> {
@Override @Override
public String getQuery(int accountId, String uuid, String name) 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() public BonusRepository getRepository()

View File

@ -42,18 +42,18 @@ public class BonusRepository extends RepositoryBase {
{ {
BonusClientData clientData = new BonusClientData(); BonusClientData clientData = new BonusClientData();
Date rankTime = null; while (resultSet.next())
Timestamp dailyTime = null; {
clientData.setDailyTime(resultSet.getTimestamp(1));
while (resultSet.next()) { clientData.setRankTime(resultSet.getDate(2));
rankTime = resultSet.getDate("ranktime"); clientData.setVoteTime(resultSet.getDate(3));
dailyTime = resultSet.getTimestamp("dailytime"); clientData.setDailyStreak(resultSet.getInt(4));
System.err.println("COUNT---COUNT"); 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; return clientData;
} }

View File

@ -184,8 +184,8 @@ public class RankBonusButton implements GuiItem, Listener {
BonusAmount bonusAmount = _bonusManager.getRankBonusAmount(_player); BonusAmount bonusAmount = _bonusManager.getRankBonusAmount(_player);
bonusAmount.addLore(lore); bonusAmount.addLore(lore);
lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getRankStreak()); lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getDailyStreak());
lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxRankStreak()); lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxDailyStreak());
lore.add(" "); lore.add(" ");
lore.add(C.cYellow + "Record Holder: " + C.cWhite + "Phinary"); lore.add(C.cYellow + "Record Holder: " + C.cWhite + "Phinary");
lore.add(C.cYellow + "Streak: " + C.cWhite + "420"); lore.add(C.cYellow + "Streak: " + C.cWhite + "420");