From 90cdb1550aa60d04ece67a7a2c0f2c20623e5261 Mon Sep 17 00:00:00 2001 From: William Jeffcock Date: Sun, 4 Feb 2024 14:22:49 +0000 Subject: [PATCH] Allow /nicks to be used by all players and display player nicknames Signed-off-by: William Jeffcock --- .../java/dev/pgm/community/nick/commands/NickCommands.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/pgm/community/nick/commands/NickCommands.java b/src/main/java/dev/pgm/community/nick/commands/NickCommands.java index bf7ae323..ac47aeef 100644 --- a/src/main/java/dev/pgm/community/nick/commands/NickCommands.java +++ b/src/main/java/dev/pgm/community/nick/commands/NickCommands.java @@ -26,6 +26,7 @@ import net.kyori.adventure.text.format.TextDecoration; import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import tc.oc.pgm.api.integration.Integration; import tc.oc.pgm.lib.cloud.commandframework.annotations.Argument; import tc.oc.pgm.lib.cloud.commandframework.annotations.CommandDescription; import tc.oc.pgm.lib.cloud.commandframework.annotations.CommandMethod; @@ -386,12 +387,13 @@ public void enableNick(CommandAudience viewer, Player sender) { @ProxiedBy("nicks") @CommandMethod("list") @CommandDescription("View a list of online nicked players") - @CommandPermission(CommunityPermissions.STAFF) public void viewNicks(CommandAudience viewer) { + boolean staff = viewer.hasPermission(CommunityPermissions.STAFF); List nickedNames = Bukkit.getOnlinePlayers().stream() + .filter(player -> staff || Integration.isFriend(player, viewer.getPlayer())) .filter(player -> nicks.isNicked(player.getUniqueId())) - .map(player -> PlayerComponent.player(player, NameStyle.FANCY)) + .map(player -> PlayerComponent.player(player, NameStyle.VERBOSE)) .collect(Collectors.toList()); if (nickedNames.isEmpty()) {