mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-21 23:01:28 +01:00
Fix broken cooldowns causing exceptions (#4219)
This commit is contained in:
parent
38dcdff659
commit
def41802b8
@ -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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user