mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 17:18:37 +01:00
Fix remaining Configurate nullability issues (#4370)
This commit is contained in:
parent
082950cc18
commit
aaddb2af1f
@ -621,7 +621,7 @@ 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) {
|
||||
if (c == null || c.isIncomplete()) {
|
||||
// stupid solution to stupid problem
|
||||
continue;
|
||||
}
|
||||
@ -632,7 +632,7 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
||||
|
||||
public Date getCommandCooldownExpiry(final String label) {
|
||||
for (CommandCooldown cooldown : getCooldownsList()) {
|
||||
if (cooldown == null) {
|
||||
if (cooldown == null || cooldown.isIncomplete()) {
|
||||
// stupid solution to stupid problem
|
||||
continue;
|
||||
}
|
||||
@ -661,7 +661,7 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
||||
return false; // false for no modification
|
||||
}
|
||||
|
||||
if (getCooldownsList().removeIf(cooldown -> cooldown.pattern().equals(pattern))) {
|
||||
if (getCooldownsList().removeIf(cooldown -> cooldown != null && !cooldown.isIncomplete() && cooldown.pattern().equals(pattern))) {
|
||||
save();
|
||||
return true;
|
||||
}
|
||||
|
@ -32,6 +32,9 @@ public class Commandunlimited extends EssentialsCommand {
|
||||
user.sendMessage(getList(target));
|
||||
} else if (args[0].equalsIgnoreCase("clear")) {
|
||||
for (final Material m : new HashSet<>(target.getUnlimited())) {
|
||||
if (m == null) {
|
||||
continue;
|
||||
}
|
||||
toggleUnlimited(user, target, m.toString());
|
||||
}
|
||||
} else {
|
||||
@ -48,6 +51,9 @@ public class Commandunlimited extends EssentialsCommand {
|
||||
}
|
||||
final StringJoiner joiner = new StringJoiner(", ");
|
||||
for (final Material material : items) {
|
||||
if (material == null) {
|
||||
continue;
|
||||
}
|
||||
joiner.add(material.toString().toLowerCase(Locale.ENGLISH).replace("_", ""));
|
||||
}
|
||||
output.append(joiner.toString());
|
||||
|
@ -22,6 +22,9 @@ public class MaterialTypeSerializer extends ScalarSerializer<Material> {
|
||||
|
||||
@Override
|
||||
protected Object serialize(Material item, Predicate<Class<?>> typeSupported) {
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
return item.name();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user