Fixed /acb [permission.node] for database mode.

This commit is contained in:
ryanhamshire 2014-12-29 13:41:27 -08:00
parent 7efdc80739
commit 744d39756c

View File

@ -571,11 +571,23 @@ public class DatabaseDataStore extends DataStore
synchronized void saveGroupBonusBlocks(String groupName, int currentValue) synchronized void saveGroupBonusBlocks(String groupName, int currentValue)
{ {
//group bonus blocks are stored in the player data table, with player name = $groupName //group bonus blocks are stored in the player data table, with player name = $groupName
String playerName = "$" + groupName; try
PlayerData playerData = new PlayerData(); {
playerData.setBonusClaimBlocks(currentValue); this.refreshDataConnection();
this.savePlayerData(playerName, playerData); SimpleDateFormat sqlFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = sqlFormat.format(new Date());
Statement statement = databaseConnection.createStatement();
statement.execute("DELETE FROM griefprevention_playerdata WHERE name='$" + groupName + "';");
statement = databaseConnection.createStatement();
statement.execute("INSERT INTO griefprevention_playerdata (name, lastlogin, accruedblocks, bonusblocks) VALUES ('$" + groupName + "', '" + dateString + "', " + "0" + ", " + String.valueOf(currentValue) + ");");
}
catch(SQLException e)
{
GriefPrevention.AddLogEntry("Unable to save data for group " + groupName + ". Details:");
GriefPrevention.AddLogEntry(e.getMessage());
}
} }
@Override @Override