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)
|
if ((abilityToModify instanceof SpellAbility)
|
||||||
&& abilityToModify.getControllerId().equals(source.getControllerId())) {
|
&& abilityToModify.getControllerId().equals(source.getControllerId())) {
|
||||||
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@ public abstract class GameCommanderImpl extends GameImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<UUID> getOpponents(UUID playerId) {
|
public Set<UUID> getOpponents(UUID playerId) {
|
||||||
Set<UUID> opponents = new HashSet<UUID>();
|
Set<UUID> opponents = new HashSet<>();
|
||||||
for (UUID opponentId: this.getPlayer(playerId).getInRange()) {
|
for (UUID opponentId: this.getPlayer(playerId).getInRange()) {
|
||||||
if (!opponentId.equals(playerId)) {
|
if (!opponentId.equals(playerId)) {
|
||||||
opponents.add(opponentId);
|
opponents.add(opponentId);
|
||||||
|
|
|
@ -937,12 +937,17 @@ public abstract class GameImpl implements Game, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void quit(UUID playerId) {
|
public synchronized void quit(UUID playerId) {
|
||||||
|
if (state != null) {
|
||||||
Player player = state.getPlayer(playerId);
|
Player player = state.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
logger.debug(player.getName() + " quits the game");
|
||||||
player.quit(this);
|
player.quit(this);
|
||||||
}else {
|
}else {
|
||||||
logger.error(new StringBuilder("quit - player not found - playerId: ").append(playerId));
|
logger.error(new StringBuilder("quit - player not found - playerId: ").append(playerId));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
logger.error(new StringBuilder("quit - state not found - playerId: ").append(playerId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1841,7 +1846,7 @@ public abstract class GameImpl implements Game, Serializable {
|
||||||
@Override
|
@Override
|
||||||
public void leave(UUID playerId) {
|
public void leave(UUID playerId) {
|
||||||
Player player = getPlayer(playerId);
|
Player player = getPlayer(playerId);
|
||||||
if (player.hasLeft()) {
|
if (player == null || player.hasLeft()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.leave();
|
player.leave();
|
||||||
|
|
Loading…
Reference in a new issue