Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RecursiveG committed Nov 20, 2016
1 parent 7f85577 commit a04fabc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/cat/nyaa/playtimetracker/DatabaseRecord.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static DatabaseRecord deserialize_legacy(UUID id, String old_format_strin
}

public void serialize(ConfigurationSection sec) {
sec.set("last_seen", lastSeen);
sec.set("last_seen", lastSeen.toString());
sec.set("daily_play_time", dailyTime);
sec.set("weekly_play_time", weeklyTime);
sec.set("monthly_play_time", monthlyTime);
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/cat/nyaa/playtimetracker/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public void onEnable() {
database = new DatabaseManager(newDataFile);
} else {
if (legacyDataFile.isFile()) { // migrate old db
getLogger().info("Updating old database... data.txt");
database = new DatabaseManager(newDataFile, legacyDataFile);
} else { // no database
getLogger().info("Creating database... database.yml");
Expand Down Expand Up @@ -149,7 +150,7 @@ private void notifyAcquire(Player p) {

@Override
public void run() { // Auto-save timer
Set<UUID> affectedPlayers = updater.updateAllOnlinePlayers();
updater.updateAllOnlinePlayers();
for (Player p : Bukkit.getOnlinePlayers()) {
notifyAcquire(p);
}
Expand Down Expand Up @@ -255,7 +256,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
if (sender.hasPermission("ptt.view.others")) {
OfflinePlayer p = Bukkit.getOfflinePlayer(args[0]);
if (p instanceof Player) {
updater.updateSingle((Player) p);
updater.updateSingle(p);
}
printStatistic(sender, p);
} else {
Expand Down Expand Up @@ -289,7 +290,7 @@ private void printStatistic(CommandSender s, OfflinePlayer p) {
* @return set of rules, not null
*/
@NotNull
public Set<Rule> getSatisfiedRules(UUID id) {
private Set<Rule> getSatisfiedRules(UUID id) {
Set<Rule> ret = new HashSet<>();
SessionedRecord rec = updater.getFullRecord(id);
if (rec.getSessionTime() > 0) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/cat/nyaa/playtimetracker/RecordManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void updateSingle(OfflinePlayer p) {
*/
private UUID updateAccumulative(UUID id) {
if (id == null) return null;
if (Main.isAFK(id)) updateNonAccumulative(id);
if (Main.isAFK(id)) return updateNonAccumulative(id);
DatabaseRecord rec = db.getRecord(id);
if (rec == null) {
db.createRecord(id, ZonedDateTime.now());
Expand Down Expand Up @@ -218,5 +218,6 @@ public void markRuleAsApplied(UUID id, Rule rule) {
break;
}
}
db.save();
}
}

0 comments on commit a04fabc

Please sign in to comment.