Skip to content

Commit

Permalink
multi spectate fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AoElite committed May 11, 2022
1 parent 81ebda1 commit 97591c2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/ac/grim/grimac/manager/SpectateManager.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ac.grim.grimac.manager;

import com.github.retrooper.packetevents.protocol.player.GameMode;
import com.github.retrooper.packetevents.protocol.player.User;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfo;
import org.bukkit.Location;
Expand All @@ -25,7 +24,9 @@ public boolean shouldHidePlayer(User receiver, WrapperPlayServerPlayerInfo.Playe
}

public boolean enable(Player player) {
return spectatingPlayers.put(player.getUniqueId(), new PreviousState(player.getGameMode(), player.getLocation())) == null;
if (spectatingPlayers.containsKey(player.getUniqueId())) return false;
spectatingPlayers.put(player.getUniqueId(), new PreviousState(player.getGameMode(), player.getLocation()));
return true;
}

public void disable(Player player) {
Expand Down

0 comments on commit 97591c2

Please sign in to comment.