mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Some formatting, NPE checking and log messages.
This commit is contained in:
parent
e57aee7fcb
commit
e51213a72a
3 changed files with 13 additions and 8 deletions
|
@ -123,7 +123,7 @@ class BattlefieldThaumaturgeSpellsCostReductionEffect extends CostModificationEf
|
|||
if ((abilityToModify instanceof SpellAbility)
|
||||
&& abilityToModify.getControllerId().equals(source.getControllerId())) {
|
||||
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
|
||||
return spell != null && this.filter.match(spell, game);
|
||||
return spell != null && BattlefieldThaumaturgeSpellsCostReductionEffect.filter.match(spell, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ public abstract class GameCommanderImpl extends GameImpl {
|
|||
|
||||
@Override
|
||||
public Set<UUID> getOpponents(UUID playerId) {
|
||||
Set<UUID> opponents = new HashSet<UUID>();
|
||||
Set<UUID> opponents = new HashSet<>();
|
||||
for (UUID opponentId: this.getPlayer(playerId).getInRange()) {
|
||||
if (!opponentId.equals(playerId)) {
|
||||
opponents.add(opponentId);
|
||||
|
|
|
@ -937,11 +937,16 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
|
||||
@Override
|
||||
public synchronized void quit(UUID playerId) {
|
||||
Player player = state.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.quit(this);
|
||||
}else {
|
||||
logger.error(new StringBuilder("quit - player not found - playerId: ").append(playerId));
|
||||
if (state != null) {
|
||||
Player player = state.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
logger.debug(player.getName() + " quits the game");
|
||||
player.quit(this);
|
||||
}else {
|
||||
logger.error(new StringBuilder("quit - player not found - playerId: ").append(playerId));
|
||||
}
|
||||
} else {
|
||||
logger.error(new StringBuilder("quit - state not found - playerId: ").append(playerId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1841,7 +1846,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
@Override
|
||||
public void leave(UUID playerId) {
|
||||
Player player = getPlayer(playerId);
|
||||
if (player.hasLeft()) {
|
||||
if (player == null || player.hasLeft()) {
|
||||
return;
|
||||
}
|
||||
player.leave();
|
||||
|
|
Loading…
Reference in a new issue