public boolean handleDeath(WarPlayer player, String deathMessage) { WarGame game = warzone.getGame().orElseThrow(IllegalStateException::new); plugin.delayTask( 3, () -> { if (player.isPlayingWar()) game.resetPlayerState(player); }); return true; }
public boolean handlePlayerLeaveZone(WarPlayer player, WarLocation from, WarLocation to) { Optional<WarGame> game = warzone.getGame(); if (game.isPresent() && game.get().isPlaying(player)) { player.sendMessage("Please use /warleave to exit the game before leaving."); warzone.mask(player); plugin.delayTask(3, () -> warzone.unmask(player)); return true; } return false; }
public boolean handlePlayerEnterZone(WarPlayer player, WarLocation from, WarLocation to) { Optional<WarGame> game = warzone.getGame(); if (game.isPresent() && !game.get().isPlaying(player) || !player.isZoneMaker()) { player.sendMessage("Please join a team first."); player.setLocation(warzone.getTeleport()); warzone.mask(player); plugin.delayTask(3, () -> warzone.unmask(player)); return false; } return false; }