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:
parent
3c5842a92c
commit
137e5a5125
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user