Update permissions for nickcommand.

This commit is contained in:
Len 2022-10-08 11:14:58 +02:00
parent 3aa0b09133
commit 3eff30a4be

View File

@ -130,23 +130,23 @@ public class Nicknames implements CommandExecutor, TabCompleter {
@Override @Override
public List<String> onTabComplete(CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { public List<String> onTabComplete(CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
List<String> completions = new ArrayList<>(); List<String> completions = new ArrayList<>();
if (!sender.hasPermission("utility.nick")) return completions; if (!sender.hasPermission("chat.command.nick")) return completions;
if (args.length == 1) { if (args.length == 1) {
List<String> choices = new ArrayList<>(); List<String> choices = new ArrayList<>();
if (sender.hasPermission("utility.nick.set")) { if (sender.hasPermission("chat.command.nick.set")) {
choices.add("set"); choices.add("set");
} }
if (sender.hasPermission("utility.nick.review")) { if (sender.hasPermission("chat.command.nick.review")) {
choices.add("review"); choices.add("review");
} }
if (sender.hasPermission("utility.nick.request")) { if (sender.hasPermission("chat.command.nick.request")) {
choices.add("request"); choices.add("request");
} }
if (sender.hasPermission("utility.nick.try")) { if (sender.hasPermission("chat.command.nick.try")) {
choices.add("try"); choices.add("try");
} }
if (sender.hasPermission("utility.nick.current")) { if (sender.hasPermission("chat.command.nick.current")) {
choices.add("current"); choices.add("current");
} }
choices.add("help"); choices.add("help");
@ -162,7 +162,7 @@ public class Nicknames implements CommandExecutor, TabCompleter {
List<String> onlinePlayers = new ArrayList<>(); List<String> onlinePlayers = new ArrayList<>();
Bukkit.getOnlinePlayers().forEach(a -> onlinePlayers.add(a.getName())); Bukkit.getOnlinePlayers().forEach(a -> onlinePlayers.add(a.getName()));
if (sender.hasPermission("utility.nick.set.others")) { if (sender.hasPermission("chat.command.nick.set.others")) {
choices.addAll(onlinePlayers); choices.addAll(onlinePlayers);
} }
@ -188,7 +188,7 @@ public class Nicknames implements CommandExecutor, TabCompleter {
Nick nick = NickCache.get(uniqueId); Nick nick = NickCache.get(uniqueId);
long timeSinceLastChange = new Date().getTime() - nick.getLastChangedDate(); long timeSinceLastChange = new Date().getTime() - nick.getLastChangedDate();
long waitTime = Config.NICK_WAIT_TIME; long waitTime = Config.NICK_WAIT_TIME;
if (timeSinceLastChange > waitTime || player.hasPermission("utility.nick.admin")) { if (timeSinceLastChange > waitTime || player.hasPermission("chat.command.nick.bypasswaittime")) {
if (nick.hasRequest()) { if (nick.hasRequest()) {
player.sendMessage(Utility.parseMiniMessage(Config.NICK_REQUEST_PLACED, player.sendMessage(Utility.parseMiniMessage(Config.NICK_REQUEST_PLACED,
Placeholder.component("oldrequestednick", Utility.applyColor(nick.getNewNick())), Placeholder.component("oldrequestednick", Utility.applyColor(nick.getNewNick())),
@ -341,28 +341,28 @@ public class Nicknames implements CommandExecutor, TabCompleter {
message.append(helpMessage(sender, HelpType.TRY)); message.append(helpMessage(sender, HelpType.TRY));
break; break;
case SET_SELF: case SET_SELF:
if (sender.hasPermission("utility.nick.set")) { if (sender.hasPermission("chat.command.nick.set")) {
message.append("<gold>/nick set <nickname><white> - Sets your nickname to the specified name.\n"); message.append("<gold>/nick set <nickname><white> - Sets your nickname to the specified name.\n");
} }
break; break;
case SET_OTHERS: case SET_OTHERS:
if (sender.hasPermission("utility.nick.set.others")) { if (sender.hasPermission("chat.command.nick.set.others")) {
message.append("<gold>/nick set <username> <nickname><white> - Sets the specified user's nickname to the specified name.\n"); message.append("<gold>/nick set <username> <nickname><white> - Sets the specified user's nickname to the specified name.\n");
} }
break; break;
case REQUEST: case REQUEST:
if (sender.hasPermission("utility.nick.request")) { if (sender.hasPermission("chat.command.nick.request")) {
message.append("<gold>/nick request <nickname><white> - Requests a username to be reviewed by staff.\n" + message.append("<gold>/nick request <nickname><white> - Requests a username to be reviewed by staff.\n" +
" <gray>Try using <dark_gray>/nick try <nickname><gray> to see if you like the name, you can only change it once per day!\n"); " <gray>Try using <dark_gray>/nick try <nickname><gray> to see if you like the name, you can only change it once per day!\n");
} }
break; break;
case REVIEW: case REVIEW:
if (sender.hasPermission("utility.nick.review")) { if (sender.hasPermission("chat.command.nick.review")) {
message.append("<gold>/nick review<white> - Opens the nickname review GUI (left click to accept a nick, right click to deny it)\n"); message.append("<gold>/nick review<white> - Opens the nickname review GUI (left click to accept a nick, right click to deny it)\n");
} }
break; break;
case TRY: case TRY:
if (sender.hasPermission("utility.nick.try")) { if (sender.hasPermission("chat.command.nick.try")) {
message.append("<gold>/nick try <nickname><white> - Shows you what your nickname will look like in chat.\n"); message.append("<gold>/nick try <nickname><white> - Shows you what your nickname will look like in chat.\n");
} }
} }