Fix broken cooldowns causing exceptions (#4219)

This commit is contained in:
Josh Roy 2021-06-09 21:20:51 -04:00 committed by GitHub
parent 38dcdff659
commit def41802b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -574,6 +574,10 @@ public abstract class UserData extends PlayerExtension implements IConf {
public Map<Pattern, Long> getCommandCooldowns() {
final Map<Pattern, Long> map = new HashMap<>();
for (final CommandCooldown c : getCooldownsList()) {
if (c == null) {
// stupid solution to stupid problem
continue;
}
map.put(c.pattern(), c.value());
}
return map;
@ -581,6 +585,10 @@ public abstract class UserData extends PlayerExtension implements IConf {
public Date getCommandCooldownExpiry(final String label) {
for (CommandCooldown cooldown : getCooldownsList()) {
if (cooldown == null) {
// stupid solution to stupid problem
continue;
}
if (cooldown.pattern().matcher(label).matches()) {
return new Date(cooldown.value());
}