From e969f374055c0a3af9b694fda16ecc5a81bad628 Mon Sep 17 00:00:00 2001 From: Andre601 <11576465+Andre601@users.noreply.github.com> Date: Wed, 1 Dec 2021 19:05:28 +0100 Subject: [PATCH] Improve StringBuilder and also fix possible NPE --- .../expansion/manager/LocalExpansionManager.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java b/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java index a59893d..5ba2821 100644 --- a/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java +++ b/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java @@ -160,7 +160,11 @@ public final class LocalExpansionManager implements Listener { @NotNull final Class clazz) { try { final PlaceholderExpansion expansion = createExpansionInstance(clazz); - + + if(expansion == null){ + return Optional.empty(); + } + Objects.requireNonNull(expansion.getAuthor(), "The expansion author is null!"); Objects.requireNonNull(expansion.getIdentifier(), "The expansion identifier is null!"); Objects.requireNonNull(expansion.getVersion(), "The expansion version is null!"); @@ -340,9 +344,11 @@ public final class LocalExpansionManager implements Listener { .append("placeholder hook(s) registered!"); if (needsUpdate > 0) { - message.append("&6") + message.append(' ') + .append("&6") .append(needsUpdate) - .append(" placeholder hook(s) have an update available."); + .append(' ') + .append("placeholder hook(s) have an update available."); }