Drop flags on match end
This commit is contained in:
parent
8a0e315c6d
commit
8f611cd4e6
|
@ -365,7 +365,7 @@ public class Flag extends TouchableGoal<FlagDefinition> implements Listener {
|
||||||
|
|
||||||
// Check again, in case startCountdown transitioned. In that case, the nested
|
// Check again, in case startCountdown transitioned. In that case, the nested
|
||||||
// transition will have already called these events if necessary.
|
// transition will have already called these events if necessary.
|
||||||
if(this.state == newState) {
|
if(this.state == newState && match.isRunning()) {
|
||||||
getMatch().callEvent(new GoalStatusChangeEvent(this));
|
getMatch().callEvent(new GoalStatusChangeEvent(this));
|
||||||
if(isCompleted()) {
|
if(isCompleted()) {
|
||||||
getMatch().callEvent(new GoalCompleteEvent(this,
|
getMatch().callEvent(new GoalCompleteEvent(this,
|
||||||
|
|
|
@ -167,6 +167,10 @@ public class Carried extends Spawned implements Missing {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tickRunning() {
|
public void tickRunning() {
|
||||||
|
if (flag.getMatch().isFinished()) {
|
||||||
|
this.flag.transition(new Returned(this.flag, this.post, this.carrier.getEntityLocation()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
super.tickRunning();
|
super.tickRunning();
|
||||||
BaseComponent message = this.getMessage();
|
BaseComponent message = this.getMessage();
|
||||||
|
|
||||||
|
@ -308,6 +312,11 @@ public class Carried extends Spawned implements Missing {
|
||||||
public void onEvent(CoarsePlayerMoveEvent event) {
|
public void onEvent(CoarsePlayerMoveEvent event) {
|
||||||
super.onEvent(event);
|
super.onEvent(event);
|
||||||
|
|
||||||
|
if(flag.getMatch().isFinished()) {
|
||||||
|
dropFlag();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(this.isCarrier(event.getPlayer())) {
|
if(this.isCarrier(event.getPlayer())) {
|
||||||
final Location playerLoc = event.getBlockTo();
|
final Location playerLoc = event.getBlockTo();
|
||||||
if((dropLocations.isEmpty() || !dropLocations.peekLast().equals(playerLoc)) &&
|
if((dropLocations.isEmpty() || !dropLocations.peekLast().equals(playerLoc)) &&
|
||||||
|
|
Loading…
Reference in New Issue