Drop flags on match end

This commit is contained in:
Austin Mayes 2019-05-18 23:38:08 -05:00
parent 8a0e315c6d
commit 8f611cd4e6
No known key found for this signature in database
GPG Key ID: 72C78ABE045D34F6
2 changed files with 10 additions and 1 deletions

View File

@ -365,7 +365,7 @@ public class Flag extends TouchableGoal<FlagDefinition> implements Listener {
// Check again, in case startCountdown transitioned. In that case, the nested
// transition will have already called these events if necessary.
if(this.state == newState) {
if(this.state == newState && match.isRunning()) {
getMatch().callEvent(new GoalStatusChangeEvent(this));
if(isCompleted()) {
getMatch().callEvent(new GoalCompleteEvent(this,

View File

@ -167,6 +167,10 @@ public class Carried extends Spawned implements Missing {
@Override
public void tickRunning() {
if (flag.getMatch().isFinished()) {
this.flag.transition(new Returned(this.flag, this.post, this.carrier.getEntityLocation()));
return;
}
super.tickRunning();
BaseComponent message = this.getMessage();
@ -308,6 +312,11 @@ public class Carried extends Spawned implements Missing {
public void onEvent(CoarsePlayerMoveEvent event) {
super.onEvent(event);
if(flag.getMatch().isFinished()) {
dropFlag();
return;
}
if(this.isCarrier(event.getPlayer())) {
final Location playerLoc = event.getBlockTo();
if((dropLocations.isEmpty() || !dropLocations.peekLast().equals(playerLoc)) &&