Fixed reload command
This commit is contained in:
parent
432c7ef72c
commit
0ee06ade16
@ -22,14 +22,14 @@ public class ChatCommand implements TabExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
if (!(sender instanceof Player player)) {
|
if (args.length == 1 && sender.hasPermission("minecraftgpt.command.reload") && args[0].equalsIgnoreCase("reload")) {
|
||||||
sender.sendMessage(ChatColor.RED + "Only players can use this command!");
|
plugin.reloadConfig();
|
||||||
|
sender.sendMessage(ChatColor.GREEN + "Config reloaded!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length == 1 && args[0].equalsIgnoreCase("reload")) {
|
if (!(sender instanceof Player player)) {
|
||||||
plugin.reloadConfig();
|
sender.sendMessage(ChatColor.RED + "Only players can use this command!");
|
||||||
sender.sendMessage(ChatColor.GREEN + "Config reloaded!");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ public class ChatCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player.hasPermission("minecraftgpt.command." + type)) {
|
if (!player.hasPermission("minecraftgpt.command." + type.name().toLowerCase())) {
|
||||||
player.sendMessage(plugin.getConfig().getString("command.no-permission").replace("&", "§"));
|
player.sendMessage(plugin.getConfig().getString("command.no-permission").replace("&", "§"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user