When Message.broadcast() is called the presence of Placeholder API should always be checked before using it to replace the placeholders.
For example, this check is not done here leading to unhandled exceptions when executing commands as /evenmorefish admin nbt-rod without the other plugin being loaded.
Example of the error:
org.bukkit.command.CommandException: Unhandled exception executing command 'evenmorefish' in plugin EvenMoreFish v1.6.11.17 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.v1_20_R3.CraftServer.dispatchCommand(CraftServer.java:875) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at org.bukkit.craftbukkit.v1_20_R3.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:50) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at com.mojang.brigadier.context.ContextChain.runExecutable(ContextChain.java:73) ~[brigadier-1.2.9.jar:?] at net.minecraft.commands.execution.tasks.ExecuteCommand.a(SourceFile:29) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(SourceFile:13) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.commands.execution.UnboundEntryAction.a(SourceFile:8) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.commands.execution.CommandQueueEntry.a(SourceFile:8) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.commands.execution.ExecutionContext.a(SourceFile:107) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.commands.CommandDispatcher.a(CommandDispatcher.java:413) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.commands.CommandDispatcher.performCommand(CommandDispatcher.java:335) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.commands.CommandDispatcher.a(CommandDispatcher.java:322) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1856) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.network.PlayerConnection.lambda$15(PlayerConnection.java:1818) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.util.thread.IAsyncTaskHandler.b(SourceFile:67) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?] at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:156) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1191) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.util.thread.IAsyncTaskHandler.x(SourceFile:130) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.MinecraftServer.bl(MinecraftServer.java:1170) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1163) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:139) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.MinecraftServer.w_(MinecraftServer.java:1147) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1060) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at java.lang.Thread.run(Thread.java:833) ~[?:?] Caused by: java.lang.NoClassDefFoundError: me/clip/placeholderapi/PlaceholderAPI at com.oheers.fish.config.messages.Message.broadcast(Message.java:178) ~[?:?] at com.oheers.fish.Controls.adminControl(CommandCentre.java:493) ~[?:?] at com.oheers.fish.CommandCentre.control(CommandCentre.java:186) ~[?:?] at com.oheers.fish.CommandCentre.onCommand(CommandCentre.java:84) ~[?:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] ... 29 more Caused by: java.lang.ClassNotFoundException: me.clip.placeholderapi.PlaceholderAPI at com.oheers.fish.config.messages.Message.broadcast(Message.java:178) ~[?:?] at com.oheers.fish.Controls.adminControl(CommandCentre.java:493) ~[?:?] at com.oheers.fish.CommandCentre.control(CommandCentre.java:186) ~[?:?] at com.oheers.fish.CommandCentre.onCommand(CommandCentre.java:84) ~[?:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] ... 29 more
When Message.broadcast() is called the presence of Placeholder API should always be checked before using it to replace the placeholders. For example, this check is not done here leading to unhandled exceptions when executing commands as
/evenmorefish admin nbt-rod
without the other plugin being loaded.Example of the error:
org.bukkit.command.CommandException: Unhandled exception executing command 'evenmorefish' in plugin EvenMoreFish v1.6.11.17 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.v1_20_R3.CraftServer.dispatchCommand(CraftServer.java:875) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at org.bukkit.craftbukkit.v1_20_R3.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:50) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at com.mojang.brigadier.context.ContextChain.runExecutable(ContextChain.java:73) ~[brigadier-1.2.9.jar:?] at net.minecraft.commands.execution.tasks.ExecuteCommand.a(SourceFile:29) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(SourceFile:13) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.commands.execution.UnboundEntryAction.a(SourceFile:8) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.commands.execution.CommandQueueEntry.a(SourceFile:8) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.commands.execution.ExecutionContext.a(SourceFile:107) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.commands.CommandDispatcher.a(CommandDispatcher.java:413) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.commands.CommandDispatcher.performCommand(CommandDispatcher.java:335) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.commands.CommandDispatcher.a(CommandDispatcher.java:322) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1856) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.network.PlayerConnection.lambda$15(PlayerConnection.java:1818) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.util.thread.IAsyncTaskHandler.b(SourceFile:67) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?] at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:156) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1191) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.util.thread.IAsyncTaskHandler.x(SourceFile:130) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.MinecraftServer.bl(MinecraftServer.java:1170) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1163) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:139) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.MinecraftServer.w_(MinecraftServer.java:1147) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1060) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4029-Spigot-c198da2-3337018] at java.lang.Thread.run(Thread.java:833) ~[?:?] Caused by: java.lang.NoClassDefFoundError: me/clip/placeholderapi/PlaceholderAPI at com.oheers.fish.config.messages.Message.broadcast(Message.java:178) ~[?:?] at com.oheers.fish.Controls.adminControl(CommandCentre.java:493) ~[?:?] at com.oheers.fish.CommandCentre.control(CommandCentre.java:186) ~[?:?] at com.oheers.fish.CommandCentre.onCommand(CommandCentre.java:84) ~[?:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] ... 29 more Caused by: java.lang.ClassNotFoundException: me.clip.placeholderapi.PlaceholderAPI at com.oheers.fish.config.messages.Message.broadcast(Message.java:178) ~[?:?] at com.oheers.fish.Controls.adminControl(CommandCentre.java:493) ~[?:?] at com.oheers.fish.CommandCentre.control(CommandCentre.java:186) ~[?:?] at com.oheers.fish.CommandCentre.onCommand(CommandCentre.java:84) ~[?:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] ... 29 more