Skip to content

Commit

Permalink
Fixed issue with autoPurge
Browse files Browse the repository at this point in the history
Issue Reference: #285
  • Loading branch information
booksaw committed Dec 22, 2021
1 parent c7a8420 commit 99a6794
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ Bug Fixes:
- Fixed case sensitivity issues with player names (#288)
- Fixed bug causing NoSuchMethod error with "@" in commands (#287)
- Fixed bug causing rebuildLookups to not work as expected (#286)
- Fixed bug and documentation with autoPurge (#285)

TODO (any TODO which is not specifically code), mainly used for reminders to update documentation

Expand Down
13 changes: 9 additions & 4 deletions src/main/java/com/booksaw/betterTeams/score/ScoreManagement.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ public ScoreManagement() {

Main.plugin.getConfig().getStringList("autoPurge").forEach(str -> {
String[] split = str.split(":");
Date temp = new Date(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
purges.add(temp);
if (nextPurge == -1 && temp.isAfterNow()) {
nextPurge = purges.indexOf(temp);
if (split.length < 2) {
Bukkit.getLogger().severe("The autopurge value " + str
+ " is not of the correct format, it should be of the format 'dateofMonth:hour', if your format looks like this, make sure you have surrounded the message in single quotes (ie - '1:6')");
} else {
Date temp = new Date(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
purges.add(temp);
if (nextPurge == -1 && temp.isAfterNow()) {
nextPurge = purges.indexOf(temp);
}
}

});
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ purgeCommands:
#
# Possible values: [{dateOfMonth}:{Hour of day}]
autoPurge:
#- 1:6
#- '1:6'
# This will purge the users score at 6am on the first of every month

# The amount of time after an event occurs that repeat events are classed as spam
Expand Down

0 comments on commit 99a6794

Please sign in to comment.