mirror of
https://github.com/taoneill/war.git
synced 2025-01-21 14:51:25 +01:00
Accidentally exiting a warzone != flag/cake cap
Closes gh-497. Before, getting warpped or dropping out of a warzone could cause you to auto-cap the flag or the cake. Bad. Players now simply drop their payload, get respawned and the structures get reset. Bomb carriers are forced to drop their bomb as well.
This commit is contained in:
parent
06d6ae9bdb
commit
b2d0a5c355
@ -429,9 +429,52 @@ public class WarPlayerListener implements Listener {
|
||||
playerLoc.getYaw(),
|
||||
playerLoc.getPitch()));
|
||||
return;
|
||||
} else {
|
||||
// Otherwise, send him to spawn
|
||||
event.setTo(playerTeam.getTeamSpawn());
|
||||
|
||||
// Otherwise, send him to spawn (first make sure he drops his flag/cake/bomb to prevent auto-cap and as punishment)
|
||||
} else if (playerWarzone.isFlagThief(player.getName())) {
|
||||
Team victimTeam = playerWarzone.getVictimTeamForFlagThief(player.getName());
|
||||
|
||||
// Get player back to spawn
|
||||
playerWarzone.respawnPlayer(event, playerTeam, player);
|
||||
playerWarzone.removeFlagThief(player.getName());
|
||||
|
||||
// Bring back flag of victim team
|
||||
victimTeam.getFlagVolume().resetBlocks();
|
||||
victimTeam.initializeTeamFlag();
|
||||
|
||||
for (Team team : playerWarzone.getTeams()) {
|
||||
team.teamcast(player.getName() + " dropped the " + victimTeam.getName() + " flag!");
|
||||
}
|
||||
return;
|
||||
} else if (playerWarzone.isCakeThief(player.getName())) {
|
||||
Cake cake = playerWarzone.getCakeForThief(player.getName());
|
||||
|
||||
// Get player back to spawn
|
||||
playerWarzone.respawnPlayer(event, playerTeam, player);
|
||||
playerWarzone.removeCakeThief(player.getName());
|
||||
|
||||
// Bring back cake
|
||||
cake.getVolume().resetBlocks();
|
||||
cake.addCakeBlocks();
|
||||
|
||||
for (Team team : playerWarzone.getTeams()) {
|
||||
team.teamcast(player.getName() + " dropped the " + cake.getName() + " cake!");
|
||||
}
|
||||
return;
|
||||
} else if (playerWarzone.isBombThief(player.getName())) {
|
||||
Bomb bomb = playerWarzone.getBombForThief(player.getName());
|
||||
|
||||
// Get player back to spawn
|
||||
playerWarzone.respawnPlayer(event, playerTeam, player);
|
||||
playerWarzone.removeBombThief(player.getName());
|
||||
|
||||
// Bring back bomb
|
||||
bomb.getVolume().resetBlocks();
|
||||
bomb.addBombBlocks();
|
||||
|
||||
for (Team team : playerWarzone.getTeams()) {
|
||||
team.teamcast(player.getName() + " dropped the " + bomb.getName() + " bomb!");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user