Improve StringBuilder and also fix possible NPE

This commit is contained in:
Andre601 2021-12-01 19:05:28 +01:00
parent 38099198d6
commit e969f37405

View File

@ -161,6 +161,10 @@ public final class LocalExpansionManager implements Listener {
try { try {
final PlaceholderExpansion expansion = createExpansionInstance(clazz); final PlaceholderExpansion expansion = createExpansionInstance(clazz);
if(expansion == null){
return Optional.empty();
}
Objects.requireNonNull(expansion.getAuthor(), "The expansion author is null!"); Objects.requireNonNull(expansion.getAuthor(), "The expansion author is null!");
Objects.requireNonNull(expansion.getIdentifier(), "The expansion identifier is null!"); Objects.requireNonNull(expansion.getIdentifier(), "The expansion identifier is null!");
Objects.requireNonNull(expansion.getVersion(), "The expansion version is null!"); Objects.requireNonNull(expansion.getVersion(), "The expansion version is null!");
@ -340,8 +344,10 @@ public final class LocalExpansionManager implements Listener {
.append("placeholder hook(s) registered!"); .append("placeholder hook(s) registered!");
if (needsUpdate > 0) { if (needsUpdate > 0) {
message.append("&6") message.append(' ')
.append("&6")
.append(needsUpdate) .append(needsUpdate)
.append(' ')
.append("placeholder hook(s) have an update available."); .append("placeholder hook(s) have an update available.");
} }