Skip to content

Commit

Permalink
fix: no spectators winning on diamond block
Browse files Browse the repository at this point in the history
  • Loading branch information
BomBardyGamer committed Mar 9, 2024
1 parent 8d75b18 commit b6d44f7
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.kyori.adventure.text.format.TextDecoration;
import net.kyori.adventure.title.Title;
import net.minestom.server.coordinate.Point;
import net.minestom.server.entity.GameMode;
import net.minestom.server.entity.Player;
import net.minestom.server.event.Event;
import net.minestom.server.event.EventNode;
Expand Down Expand Up @@ -43,7 +44,11 @@ public void registerListeners(@NotNull EventNode<Event> eventNode) {

private boolean isValidMove(@NotNull PlayerMoveEvent event) {
if (this.game.hasEnded()) return false;
if (event.getPlayer().getTeam() == PlayerDeathHandler.DEAD_TEAM) return false;

Player player = event.getPlayer();
if (player.getTeam() == PlayerDeathHandler.DEAD_TEAM) return false;
if (player.getGameMode() != GameMode.SURVIVAL) return false;

return event.getNewPosition().sameBlock(SPAWN);
}

Expand Down

0 comments on commit b6d44f7

Please sign in to comment.