From 35145476101c2ffd2b78cf195c1e8255f41201fe Mon Sep 17 00:00:00 2001 From: LeoDog896 Date: Fri, 15 Jan 2021 13:26:12 -0500 Subject: [PATCH] Fix isEmpty check in ColoredText --- src/main/java/net/minestom/server/chat/ColoredText.java | 4 ++-- .../minestom/server/command/builder/CommandDispatcher.java | 1 + .../java/net/minestom/server/entity/ai/goal/EatBlockGoal.java | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minestom/server/chat/ColoredText.java b/src/main/java/net/minestom/server/chat/ColoredText.java index 0a9a7760b..203bff414 100644 --- a/src/main/java/net/minestom/server/chat/ColoredText.java +++ b/src/main/java/net/minestom/server/chat/ColoredText.java @@ -20,7 +20,7 @@ import java.util.regex.Pattern; public class ColoredText extends JsonMessage { // the raw text - private StringBuilder message = new StringBuilder(); + private final StringBuilder message = new StringBuilder(); /** * Creates a colored text. @@ -160,7 +160,7 @@ public class ColoredText extends JsonMessage { protected List getComponents() { final List objects = new ArrayList<>(); // No message, return empty list - if (message.isEmpty()) + if (getMessage().isEmpty()) return objects; boolean inFormat = false; diff --git a/src/main/java/net/minestom/server/command/builder/CommandDispatcher.java b/src/main/java/net/minestom/server/command/builder/CommandDispatcher.java index d027b2d4e..25ad79fbd 100644 --- a/src/main/java/net/minestom/server/command/builder/CommandDispatcher.java +++ b/src/main/java/net/minestom/server/command/builder/CommandDispatcher.java @@ -58,6 +58,7 @@ public class CommandDispatcher { * @param commandString the command (containing the command name and the args if any) * @return the result of the parsing, null if the command doesn't exist */ + @Nullable public CommandResult parse(@NotNull String commandString) { commandString = commandString.trim(); diff --git a/src/main/java/net/minestom/server/entity/ai/goal/EatBlockGoal.java b/src/main/java/net/minestom/server/entity/ai/goal/EatBlockGoal.java index 9104590dc..aea57a783 100644 --- a/src/main/java/net/minestom/server/entity/ai/goal/EatBlockGoal.java +++ b/src/main/java/net/minestom/server/entity/ai/goal/EatBlockGoal.java @@ -7,7 +7,6 @@ import net.minestom.server.instance.Instance; import net.minestom.server.utils.BlockPosition; import org.jetbrains.annotations.NotNull; -import java.util.Map; import java.util.Random; public class EatBlockGoal extends GoalSelector {