Remove unused log, add null check, and update player teleport.

Removed a redundant logging statement from `OtherGameEvents`. Added a null check for shooter class in `SnowballEvent` to avoid potential issues. Enhanced player handling in `OnPlayerOnlineStatus` by teleporting players to their team’s spawn location if applicable.
This commit is contained in:
Teriuihi 2025-03-01 20:03:40 +01:00
parent 3c5842a92c
commit 137e5a5125
3 changed files with 6 additions and 1 deletions

View File

@ -42,6 +42,8 @@ public class OnPlayerOnlineStatus implements Listener {
resetPlayer(player);
handleRunningGame(player);
handleDiscordLink(player);
gameManager.getTeamPlayer(player).ifPresent(teamPlayer ->
player.teleportAsync(teamPlayer.getTeam().getSpawnLocation()));
}
private void handleRunningGame(Player player) {

View File

@ -33,7 +33,6 @@ public class OtherGameEvents implements Listener {
log.info("no game phases");
return;
}
log.info(event.getBlock().getType().toString());
if (!Tag.SNOW.isTagged(event.getBlock().getType())) {
event.setCancelled(true);
return;

View File

@ -88,6 +88,10 @@ public class SnowballEvent implements Listener {
public void onSnowballThrown(ProjectileLaunchEvent event) {
handleSnowballThrown(event, (shooter, shooterTeamPlayer, snowball) -> {
GameClass shooterClass = shooterTeamPlayer.getGameClass();
if (shooterClass == null) {
event.setCancelled(true);
return;
}
shooter.setCooldown(Material.SNOWBALL, shooterClass.getThrowTickSpeed());
shooterTeamPlayer.increaseStat(Stat.SNOWBALLS_THROWN);
if (shooterClass instanceof Mage mage) {