Skip to content

refactor: track vanished players - #204

Merged
Maxlego08 merged 1 commit into
developfrom
codex/add-/vanish-command
Oct 20, 2025
Merged

Maxlego08 merged 1 commit into
developfrom
codex/add-/vanish-command

Conversation

@Maxlego08

Copy link
Copy Markdown
Owner

Summary

  • track vanished players in a shared set so their visibility can be reused without scanning all online players
  • update the join listener to rely on the cached vanished list when deciding what to show or hide for newcomers

Testing

  • ./gradlew build (fails: dependency downloads blocked by HTTP 403 responses)

https://chatgpt.com/codex/tasks/task_e_68f6169269dc8321b7a463d1f2053fa6

ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +112 to +118
List<Player> players = new ArrayList<>();
Iterator<UUID> iterator = VANISHED_PLAYERS.iterator();
while (iterator.hasNext()) {
UUID uuid = iterator.next();
Player vanished = plugin.getServer().getPlayer(uuid);
if (vanished == null || !isVanished(vanished)) {
iterator.remove();

ghost Oct 20, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Removing from concurrent vanish cache via unsupported iterator

The vanish cache now uses ConcurrentHashMap.newKeySet(), but getVanishedPlayers tries to clean stale UUIDs using iterator.remove(). Iterators from ConcurrentHashMap’s key set do not support the optional remove operation and will throw UnsupportedOperationException. Once any vanished player disconnects (or loses the metadata) and another player calls this method—e.g. on the next join—the listener will crash before hiding vanished players for the newcomer. Remove stale entries by calling VANISHED_PLAYERS.remove(uuid) outside the iterator or by collecting them into a list rather than invoking iterator.remove().

Useful? React with 👍 / 👎.

@Maxlego08
Maxlego08 merged commit 0dea92a into develop Oct 20, 2025
@Maxlego08
Maxlego08 deleted the codex/add-/vanish-command branch October 20, 2025 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant