Allow player-list API to self un/list (#10358)

This commit is contained in:
Shane Freeder 2024-04-07 01:45:43 +01:00
parent bccba9bc30
commit b56970d394

View file

@ -145,7 +145,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public boolean unlistPlayer(@NotNull Player other) {
+ Preconditions.checkNotNull(other, "hidden entity cannot be null");
+ if (this.getHandle().connection == null) return false;
+ if (this.equals(other)) return false;
+ if (!this.canSee(other)) return false;
+
+ if (unlistedEntities.add(other.getUniqueId())) {
@ -160,7 +159,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public boolean listPlayer(@NotNull Player other) {
+ Preconditions.checkNotNull(other, "hidden entity cannot be null");
+ if (this.getHandle().connection == null) return false;
+ if (this.equals(other)) return false;
+ if (!this.canSee(other)) throw new IllegalStateException("Player cannot see other player");
+
+ if (this.unlistedEntities.remove(other.getUniqueId())) {