Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@

public class OnlinePlayerAutoComplete implements SuggestionProvider<BukkitCommandActor> {

public static final String VANISH_META_KEY = "omcstaff.vanished";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pourquoi mettre plusieurs key dans plusieurs fichiers alors que c'est la meme partout?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'me suis fait la reflexion en le faisant

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahah


@Override
public @NotNull List<String> getSuggestions(@NotNull ExecutionContext<BukkitCommandActor> context) {
return Bukkit.getOnlinePlayers().stream()
.map(Player::getName)
.filter(name -> !context.actor().requirePlayer().hasMetadata(VANISH_META_KEY))
.toList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@

public class FriendsAutoComplete implements SuggestionProvider<BukkitCommandActor> {

public static final String VANISH_META_KEY = "omcstaff.vanished";

@Override
public @NotNull List<String> getSuggestions(@NotNull ExecutionContext<BukkitCommandActor> context) {
List<UUID> friendsUUIDs = getFriendsAsync(context.actor().requirePlayer().getUniqueId()).join();
return friendsUUIDs.stream()
.map(uuid -> CacheOfflinePlayer.getOfflinePlayer(uuid).getName())
.filter(name -> !context.actor().requirePlayer().hasMetadata(VANISH_META_KEY))
.toList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

public class FriendsRequestAutoComplete implements SuggestionProvider<BukkitCommandActor> {

public static final String VANISH_META_KEY = "omcstaff.vanished";

@Override
public @NotNull List<String> getSuggestions(@NotNull ExecutionContext<BukkitCommandActor> context) {
Player sender = context.actor().requirePlayer();
Expand All @@ -24,6 +26,7 @@ public class FriendsRequestAutoComplete implements SuggestionProvider<BukkitComm
.toList();
return requestUUIDs.stream()
.map(uuid -> CacheOfflinePlayer.getOfflinePlayer(uuid).getName())
.filter(name -> !sender.hasMetadata(VANISH_META_KEY))
.toList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void onPlayerJoin(PlayerJoinEvent event) {
FriendManager.getFriendsAsync(player.getUniqueId()).thenAccept(friendsUUIDS -> {
for (UUID friendUUID : friendsUUIDS) {
final Player friend = player.getServer().getPlayer(friendUUID);
if (friend != null && friend.isOnline()) {
if (friend != null && friend.isOnline() && !friend.hasMetadata(VANISH_META_KEY)) {
MessagesManager.sendMessage(friend, Component.text("§aVotre ami §r" + "§r" + LuckPermsHook.getFormattedPAPIPrefix(player) + player.getName() +" §as'est connecté(e)"), Prefix.FRIEND, MessageType.NONE, true);
}
}
Expand Down Expand Up @@ -105,7 +105,7 @@ public void onPlayerQuit(PlayerQuitEvent event) {
FriendManager.getFriendsAsync(player.getUniqueId()).thenAccept(friendsUUIDS -> {
for (UUID friendUUID : friendsUUIDS) {
final Player friend = player.getServer().getPlayer(friendUUID);
if (friend != null && friend.isOnline()) {
if (friend != null && friend.isOnline() && !friend.hasMetadata(VANISH_META_KEY)) {
MessagesManager.sendMessage(friend, Component.text("§cVotre ami §e" + "§r" + LuckPermsHook.getFormattedPAPIPrefix(player) + player.getName() +" §cs'est déconnecté(e)"), Prefix.FRIEND, MessageType.NONE, true);
}
}
Expand Down
Loading