Skip to content

Commit

Permalink
Fix Chat class initialization on Paper 1.16.5 - 1.18.1
Browse files Browse the repository at this point in the history
Check for class actually needed by MiniMessageParser
  • Loading branch information
Krakenied committed Aug 28, 2024
1 parent 84eae15 commit 1e0aa2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public final class Chat {
Objects.requireNonNull(plugin);

try {
Class.forName("net.kyori.adventure.Adventure", false, Bukkit.class.getClassLoader());
Class.forName("net.kyori.adventure.text.minimessage.MiniMessage", false, Bukkit.class.getClassLoader());

miniMessageParser = new MiniMessageParser();
plugin.getQuestsLogger().debug("Modern chat is available.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

public final class MiniMessageParser {

Expand All @@ -12,8 +13,8 @@ public MiniMessageParser() {
this.miniMessage = MiniMessage.miniMessage();
}

public void send(CommandSender who, String message) {
Component component = miniMessage.deserialize(message);
public void send(final @NotNull CommandSender who, final @NotNull String message) {
final Component component = this.miniMessage.deserialize(message);
who.sendMessage(component);
}
}

0 comments on commit 1e0aa2a

Please sign in to comment.