mirror of
https://github.com/SunNetservers/MiniGames.git
synced 2025-09-17 11:27:55 +02:00
Makes some GUI changes
Makes the current state of the player toggle visible. Makes it possible to toggle player visibility outside arenas.
This commit is contained in:
@@ -4,6 +4,7 @@ import net.knarcraft.minigames.MiniGames;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@@ -34,6 +35,16 @@ public class PlayerVisibilityManager {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the given player is currently hiding other players
|
||||
*
|
||||
* @param player <p>The player to check</p>
|
||||
* @return <p>True if currently hiding other players</p>
|
||||
*/
|
||||
public boolean isHidingPlayers(Player player) {
|
||||
return this.hidingEnabledFor.contains(player.getUniqueId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates which players are seen as hidden
|
||||
*
|
||||
@@ -77,7 +88,10 @@ public class PlayerVisibilityManager {
|
||||
* @param player <p>The player to change the visibility for</p>
|
||||
* @param hide <p>Whether to hide the players or show the players</p>
|
||||
*/
|
||||
private void changeVisibilityFor(@NotNull ArenaPlayerRegistry<?> playerRegistry, @NotNull Player player, boolean hide) {
|
||||
private void changeVisibilityFor(@Nullable ArenaPlayerRegistry<?> playerRegistry, @NotNull Player player, boolean hide) {
|
||||
if (playerRegistry == null) {
|
||||
return;
|
||||
}
|
||||
for (UUID playerId : playerRegistry.getPlayingPlayers()) {
|
||||
Player otherPlayer = Bukkit.getPlayer(playerId);
|
||||
if (otherPlayer == null) {
|
||||
|
@@ -17,8 +17,6 @@ import java.util.logging.Level;
|
||||
*/
|
||||
public class DropperArenaSession extends AbstractArenaSession {
|
||||
|
||||
private static final ArenaGUI gui = new DropperGUI();
|
||||
|
||||
private final @NotNull DropperArena arena;
|
||||
private final @NotNull Player player;
|
||||
private final @NotNull DropperArenaGameMode gameMode;
|
||||
@@ -102,7 +100,7 @@ public class DropperArenaSession extends AbstractArenaSession {
|
||||
|
||||
@Override
|
||||
public @NotNull ArenaGUI getGUI() {
|
||||
return gui;
|
||||
return new DropperGUI(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -19,8 +19,6 @@ import java.util.logging.Level;
|
||||
*/
|
||||
public class ParkourArenaSession extends AbstractArenaSession {
|
||||
|
||||
private static final ArenaGUI gui = new ParkourGUI();
|
||||
|
||||
private final @NotNull ParkourArena arena;
|
||||
private final @NotNull Player player;
|
||||
private final @NotNull ParkourArenaGameMode gameMode;
|
||||
@@ -115,7 +113,7 @@ public class ParkourArenaSession extends AbstractArenaSession {
|
||||
|
||||
@Override
|
||||
public @NotNull ArenaGUI getGUI() {
|
||||
return gui;
|
||||
return new ParkourGUI(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user