mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-23 01:27:40 +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() {
|
public Map<Pattern, Long> getCommandCooldowns() {
|
||||||
final Map<Pattern, Long> map = new HashMap<>();
|
final Map<Pattern, Long> map = new HashMap<>();
|
||||||
for (final CommandCooldown c : getCooldownsList()) {
|
for (final CommandCooldown c : getCooldownsList()) {
|
||||||
if (c == null) {
|
if (c == null || c.isIncomplete()) {
|
||||||
// stupid solution to stupid problem
|
// stupid solution to stupid problem
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -632,7 +632,7 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
|||||||
|
|
||||||
public Date getCommandCooldownExpiry(final String label) {
|
public Date getCommandCooldownExpiry(final String label) {
|
||||||
for (CommandCooldown cooldown : getCooldownsList()) {
|
for (CommandCooldown cooldown : getCooldownsList()) {
|
||||||
if (cooldown == null) {
|
if (cooldown == null || cooldown.isIncomplete()) {
|
||||||
// stupid solution to stupid problem
|
// stupid solution to stupid problem
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -661,7 +661,7 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
|||||||
return false; // false for no modification
|
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();
|
save();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,9 @@ public class Commandunlimited extends EssentialsCommand {
|
|||||||
user.sendMessage(getList(target));
|
user.sendMessage(getList(target));
|
||||||
} else if (args[0].equalsIgnoreCase("clear")) {
|
} else if (args[0].equalsIgnoreCase("clear")) {
|
||||||
for (final Material m : new HashSet<>(target.getUnlimited())) {
|
for (final Material m : new HashSet<>(target.getUnlimited())) {
|
||||||
|
if (m == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
toggleUnlimited(user, target, m.toString());
|
toggleUnlimited(user, target, m.toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -48,6 +51,9 @@ public class Commandunlimited extends EssentialsCommand {
|
|||||||
}
|
}
|
||||||
final StringJoiner joiner = new StringJoiner(", ");
|
final StringJoiner joiner = new StringJoiner(", ");
|
||||||
for (final Material material : items) {
|
for (final Material material : items) {
|
||||||
|
if (material == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
joiner.add(material.toString().toLowerCase(Locale.ENGLISH).replace("_", ""));
|
joiner.add(material.toString().toLowerCase(Locale.ENGLISH).replace("_", ""));
|
||||||
}
|
}
|
||||||
output.append(joiner.toString());
|
output.append(joiner.toString());
|
||||||
|
@ -22,6 +22,9 @@ public class MaterialTypeSerializer extends ScalarSerializer<Material> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object serialize(Material item, Predicate<Class<?>> typeSupported) {
|
protected Object serialize(Material item, Predicate<Class<?>> typeSupported) {
|
||||||
|
if (item == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return item.name();
|
return item.name();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user