use internal method for message sending, replace some try/catch with null checks

This commit is contained in:
2022-05-14 11:53:31 +02:00
parent 4088a6dd5b
commit 5a36ba7748
7 changed files with 104 additions and 103 deletions
@@ -1,8 +1,8 @@
package me.youhavetrouble.preventstabby.commands;
import me.youhavetrouble.preventstabby.PreventStabby;
import me.youhavetrouble.preventstabby.util.PluginMessages;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
public class ReloadCommand {
@@ -10,8 +10,7 @@ public class ReloadCommand {
public static void reload(CommandSender sender) {
Bukkit.getScheduler().runTaskAsynchronously(PreventStabby.getPlugin(), () -> {
if (!sender.hasPermission("preventstabby.command.reload")) {
String message = ChatColor.translateAlternateColorCodes('&', PreventStabby.getPlugin().getConfigCache().getNo_permission());
sender.sendMessage(message);
PluginMessages.parseMessage(sender, PreventStabby.getPlugin().getConfigCache().getNo_permission());
return;
}
PreventStabby.getPlugin().reloadPluginConfig(sender);