mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08: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());
|
throw new MageException("Wrong client version " + version + ", expecting version " + Main.getVersion());
|
||||||
}
|
}
|
||||||
if (!adminPassword.equals(this.adminPassword)) {
|
if (!adminPassword.equals(this.adminPassword)) {
|
||||||
|
Thread.sleep(3000);
|
||||||
throw new MageException("Wrong password");
|
throw new MageException("Wrong password");
|
||||||
}
|
}
|
||||||
return managerFactory.sessionManager().connectAdmin(sessionId);
|
return managerFactory.sessionManager().connectAdmin(sessionId);
|
||||||
|
|
|
||||||
|
|
@ -203,6 +203,12 @@ public class Session {
|
||||||
}
|
}
|
||||||
returnMessage = connectUserHandling(userName, password);
|
returnMessage = connectUserHandling(userName, password);
|
||||||
if (returnMessage != null) {
|
if (returnMessage != null) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(3000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
logger.fatal("waiting of error message had failed", e);
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
sendErrorMessageToClient(returnMessage);
|
sendErrorMessageToClient(returnMessage);
|
||||||
}
|
}
|
||||||
return returnMessage;
|
return returnMessage;
|
||||||
|
|
|
||||||
|
|
@ -83,8 +83,6 @@ class ChooseNumberEffect extends OneShotEffect {
|
||||||
|
|
||||||
class SanctumPrelateReplacementEffect extends ContinuousRuleModifyingEffectImpl {
|
class SanctumPrelateReplacementEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
Integer choiceValue;
|
|
||||||
|
|
||||||
public SanctumPrelateReplacementEffect() {
|
public SanctumPrelateReplacementEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||||
staticText = "Noncreature spells with mana value equal to the chosen number can't be cast";
|
staticText = "Noncreature spells with mana value equal to the chosen number can't be cast";
|
||||||
|
|
@ -120,10 +118,10 @@ class SanctumPrelateReplacementEffect extends ContinuousRuleModifyingEffectImpl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
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());
|
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 spell.getManaValue() == choiceValue;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue