mirror of
https://github.com/correl/mage.git
synced 2025-03-12 17:00:08 -09:00
Fixed possible NPE, improved server timeout
This commit is contained in:
parent
bc5c381fef
commit
517ee16a60
3 changed files with 9 additions and 4 deletions
|
@ -178,6 +178,7 @@ public class MageServerImpl implements MageServer {
|
|||
throw new MageException("Wrong client version " + version + ", expecting version " + Main.getVersion());
|
||||
}
|
||||
if (!adminPassword.equals(this.adminPassword)) {
|
||||
Thread.sleep(3000);
|
||||
throw new MageException("Wrong password");
|
||||
}
|
||||
return managerFactory.sessionManager().connectAdmin(sessionId);
|
||||
|
|
|
@ -203,6 +203,12 @@ public class Session {
|
|||
}
|
||||
returnMessage = connectUserHandling(userName, password);
|
||||
if (returnMessage != null) {
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
} catch (InterruptedException e) {
|
||||
logger.fatal("waiting of error message had failed", e);
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
sendErrorMessageToClient(returnMessage);
|
||||
}
|
||||
return returnMessage;
|
||||
|
|
|
@ -83,8 +83,6 @@ class ChooseNumberEffect extends OneShotEffect {
|
|||
|
||||
class SanctumPrelateReplacementEffect extends ContinuousRuleModifyingEffectImpl {
|
||||
|
||||
Integer choiceValue;
|
||||
|
||||
public SanctumPrelateReplacementEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
staticText = "Noncreature spells with mana value equal to the chosen number can't be cast";
|
||||
|
@ -120,10 +118,10 @@ class SanctumPrelateReplacementEffect extends ContinuousRuleModifyingEffectImpl
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
choiceValue = (Integer) game.getState().getValue(source.getSourceId().toString());
|
||||
Integer choiceValue = (Integer) game.getState().getValue(source.getSourceId().toString());
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
|
||||
if (spell != null && !spell.isCreature(game)) {
|
||||
if (spell != null && !spell.isCreature(game) && choiceValue != null) {
|
||||
return spell.getManaValue() == choiceValue;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue