From dda431ebdd4f6c9711df9877452652970b4537f4 Mon Sep 17 00:00:00 2001 From: lokspel <208148594+lokspel@users.noreply.github.com> Date: Mon, 24 Aug 2026 11:22:14 +0400 Subject: [PATCH 1/2] Remove the useless SHOW-PLAYERS-IN-TAB option. --- core/pom.xml | 2 +- .../practice/manager/backend/ConfigManager.java | 4 ---- .../nandi0813/practice/manager/fight/match/Match.java | 5 +---- .../practice/util/entityhider/PlayerHider.java | 10 ++-------- core/src/main/resources/config.yml | 1 - distribution/pom.xml | 2 +- pom.xml | 2 +- 7 files changed, 6 insertions(+), 20 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 6789321b..20f50086 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -7,7 +7,7 @@ dev.nandi0813 practice-parent - 7.7.0-SNAPSHOT + 7.8.0-SNAPSHOT practice-core diff --git a/core/src/main/java/dev/nandi0813/practice/manager/backend/ConfigManager.java b/core/src/main/java/dev/nandi0813/practice/manager/backend/ConfigManager.java index 980cbcd8..07ac5f43 100644 --- a/core/src/main/java/dev/nandi0813/practice/manager/backend/ConfigManager.java +++ b/core/src/main/java/dev/nandi0813/practice/manager/backend/ConfigManager.java @@ -66,10 +66,6 @@ public static boolean isShowMatchPlayersInTab() { return getBoolean("MATCH-SETTINGS.SHOW-PLAYERS-IN-TAB"); } - public static boolean isShowLobbyPlayersInMatch() { - return getBoolean("MATCH-SETTINGS.SHOW-LOBBY-PLAYERS-IN-MATCH"); - } - public static int getInt(String loc) { return getConfig().getInt(loc); } diff --git a/core/src/main/java/dev/nandi0813/practice/manager/fight/match/Match.java b/core/src/main/java/dev/nandi0813/practice/manager/fight/match/Match.java index 832d4db9..4ca4cb59 100644 --- a/core/src/main/java/dev/nandi0813/practice/manager/fight/match/Match.java +++ b/core/src/main/java/dev/nandi0813/practice/manager/fight/match/Match.java @@ -148,10 +148,7 @@ public void startMatch() { for (Player online : Bukkit.getOnlinePlayers()) { if (!this.players.contains(online)) { - if (ConfigManager.isShowLobbyPlayersInMatch()) - PlayerHider.getInstance().showPlayer(player, online); - else - PlayerHider.getInstance().hidePlayer(player, online, true); + PlayerHider.getInstance().hidePlayer(player, online, true); if (!ConfigManager.isShowMatchPlayersInTab()) PlayerHider.getInstance().hidePlayer(online, player, false); diff --git a/core/src/main/java/dev/nandi0813/practice/util/entityhider/PlayerHider.java b/core/src/main/java/dev/nandi0813/practice/util/entityhider/PlayerHider.java index 405924a8..5e176899 100644 --- a/core/src/main/java/dev/nandi0813/practice/util/entityhider/PlayerHider.java +++ b/core/src/main/java/dev/nandi0813/practice/util/entityhider/PlayerHider.java @@ -56,10 +56,7 @@ public void playerJoin(PlayerJoinEvent e) { * Hide the player from the online. */ if (onlineStatus.equals(ProfileStatus.MATCH) || onlineStatus.equals(ProfileStatus.EVENT) || onlineStatus.equals(ProfileStatus.FFA)) { - if (ConfigManager.isShowLobbyPlayersInMatch()) - showPlayer(online, player); - else - hidePlayer(online, player, ConfigManager.isShowMatchPlayersInTab()); + hidePlayer(online, player, ConfigManager.isShowMatchPlayersInTab()); } else if (!onlineStatus.equals(ProfileStatus.SPECTATE) && onlineProfile.isHidePlayers()) { hidePlayer(online, player, false); } else if (profile.isHideFromPlayers() && !online.hasPermission("zpp.staffmode.see")) { @@ -108,10 +105,7 @@ public void playerTeleport(PlayerTeleportEvent e) { } // Handle the online player - if (onlineProfile.getStatus().equals(ProfileStatus.MATCH) || onlineProfile.getStatus().equals(ProfileStatus.EVENT) || onlineProfile.getStatus().equals(ProfileStatus.FFA)) { - if (ConfigManager.isShowLobbyPlayersInMatch()) - showPlayer(online, player); - } else { + if (!(onlineProfile.getStatus().equals(ProfileStatus.MATCH) || onlineProfile.getStatus().equals(ProfileStatus.EVENT) || onlineProfile.getStatus().equals(ProfileStatus.FFA))) { if (onlineProfile.isHidePlayers() && ServerManager.getInstance().getInWorld().get(online) == WorldEnum.LOBBY) { hidePlayer(online, player, false); } else if (!profile.isHideFromPlayers() || online.hasPermission("zpp.staffmode.see")) { diff --git a/core/src/main/resources/config.yml b/core/src/main/resources/config.yml index 59a06492..47181210 100644 --- a/core/src/main/resources/config.yml +++ b/core/src/main/resources/config.yml @@ -231,7 +231,6 @@ AUTO-SAVE: # Match settings MATCH-SETTINGS: SHOW-PLAYERS-IN-TAB: false # If true, players currently in a match/FFA/event remain visible in the tab list for lobby players (otherwise they are hidden). - SHOW-LOBBY-PLAYERS-IN-MATCH: false # If true, players in a match/FFA/event can see the players in the lobby (otherwise lobby players are hidden from them). TEAMS: TEAM1: NAME: "[B]" diff --git a/distribution/pom.xml b/distribution/pom.xml index 4d14b14d..bb841660 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -10,7 +10,7 @@ dev.nandi0813 practice-parent - 7.7.0-SNAPSHOT + 7.8.0-SNAPSHOT diff --git a/pom.xml b/pom.xml index 7f10fa9d..ae9c3ce0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ dev.nandi0813 practice-parent - 7.7.0-SNAPSHOT + 7.8.0-SNAPSHOT pom ZonePractice Pro From 4bc3d12b8c3f82163d08e15e274b5ea91a08be06 Mon Sep 17 00:00:00 2001 From: lokspel <208148594+lokspel@users.noreply.github.com> Date: Tue, 25 Aug 2026 11:44:39 +0400 Subject: [PATCH 2/2] fix: restore spectator flight after teleport ability resync --- .../manager/spectator/SpectatorListener.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/dev/nandi0813/practice/manager/spectator/SpectatorListener.java b/core/src/main/java/dev/nandi0813/practice/manager/spectator/SpectatorListener.java index e27dd215..4e82617f 100644 --- a/core/src/main/java/dev/nandi0813/practice/manager/spectator/SpectatorListener.java +++ b/core/src/main/java/dev/nandi0813/practice/manager/spectator/SpectatorListener.java @@ -10,6 +10,7 @@ import dev.nandi0813.practice.manager.profile.enums.ProfileStatus; import dev.nandi0813.practice.util.Cuboid; import dev.nandi0813.practice.util.interfaces.Spectatable; +import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -131,10 +132,18 @@ public void onPlayerTeleport(PlayerTeleportEvent e) { Player player = e.getPlayer(); ensureSpectatorFlight(player); - // Some teleports or server versions can drop flight state right after teleport. + // The client ignores ability packets sent during a teleport until it has + // acknowledged the new position, so the flight state has to be re-sent after it. ZonePractice plugin = ZonePractice.getInstance(); if (plugin != null && plugin.isEnabled()) { - org.bukkit.Bukkit.getScheduler().runTask(plugin, () -> ensureSpectatorFlight(player)); + Bukkit.getScheduler().runTask(plugin, () -> ensureSpectatorFlight(player)); + Bukkit.getScheduler().runTaskLater(plugin, () -> { + // Skip if the player is no longer a spectator by the time this runs. + if (player.isOnline() && hasSpectatorRestrictions(player)) { + player.setAllowFlight(false); + ensureSpectatorFlight(player); + } + }, 2L); } }