mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-01-03 22:08:28 +00:00
Fix broken cooldowns causing exceptions (#4219)
This commit is contained in:
parent
38dcdff659
commit
def41802b8
1 changed files with 8 additions and 0 deletions
|
@ -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 a new issue