Fix ticket booth commands clashing with leave commands

This commit is contained in:
Potato 2017-12-03 16:23:49 +08:00 committed by Ashcon Partovi
parent 8fa0caba8d
commit 3a2cfa7c98
3 changed files with 14 additions and 13 deletions

View File

@ -199,19 +199,20 @@ public class TicketBooth {
final PlayerId playerId = userStore.playerId(player);
final Game game = currentGame(playerId);
if(game == null) {
audience.sendMessage(gameFormatter.notPlaying());
//audience.sendMessage(gameFormatter.notPlaying());
return;
}
syncExecutor.callback(
sendPlayRequest(playerId, null),
CommandFutureCallback.onSuccess(player, reply -> {
audience.sendMessage(gameFormatter.left(game));
if(returnToLobby) {
serverChanger.sendPlayerToLobby(player, true);
}
})
);
if(game != null) {
syncExecutor.callback(
sendPlayRequest(playerId, null),
CommandFutureCallback.onSuccess(player, reply -> {
audience.sendMessage(gameFormatter.left(game));
if(returnToLobby) {
serverChanger.sendPlayerToLobby(player, true);
}
})
);
}
}
public void playLocalGame(Player player) {

View File

@ -48,7 +48,7 @@ public class TicketCommands implements Commands {
}
@Command(
aliases = { "leave", "quit" },
aliases = { "quit" },
desc = "Leave the game you are currently playing, or waiting to play",
min = 0,
max = 0

View File

@ -133,7 +133,7 @@ public class JoinCommands implements Commands {
public static final String OBSERVE_COMMAND = "observe";
@Command(
aliases = { OBSERVE_COMMAND, "obs", "spectate" },
aliases = { OBSERVE_COMMAND, "obs", "spectate", "leave" },
desc = "Observe the current match",
min = 0,
max = 0