mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
* improved message for missing cards on the server.
This commit is contained in:
parent
424448b38f
commit
9ba6f74bf6
1 changed files with 8 additions and 2 deletions
|
@ -58,7 +58,7 @@ public class Deck implements Serializable {
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
deck.cards.add(card);
|
deck.cards.add(card);
|
||||||
} else if (!ignoreErrors) {
|
} else if (!ignoreErrors) {
|
||||||
throw new GameException("Error loading card - " + deckCardInfo.getCardName() + " for deck - " + deck.getName());
|
throw createCardNotFoundGameException(deckCardInfo, deckCardLists.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (DeckCardInfo deckCardInfo: deckCardLists.getSideboard()) {
|
for (DeckCardInfo deckCardInfo: deckCardLists.getSideboard()) {
|
||||||
|
@ -66,13 +66,19 @@ public class Deck implements Serializable {
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
deck.sideboard.add(card);
|
deck.sideboard.add(card);
|
||||||
} else if (!ignoreErrors) {
|
} else if (!ignoreErrors) {
|
||||||
throw new GameException("Error loading card - " + deckCardInfo.getCardName() + " for deck - " + deck.getName());
|
throw createCardNotFoundGameException(deckCardInfo, deckCardLists.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return deck;
|
return deck;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static GameException createCardNotFoundGameException(DeckCardInfo deckCardInfo, String deckName) {
|
||||||
|
return new GameException("Card not found - " + deckCardInfo.getCardName() + " - " + deckCardInfo.getSetCode() + " for deck - " + deckName + "\n" +
|
||||||
|
"Possible reason is, that you use cards in your deck, that are only supported in newer versions of the server.\n" +
|
||||||
|
"So it can help to use the same card from another set, that's already supported from this server." );
|
||||||
|
}
|
||||||
|
|
||||||
private static Card createCard(DeckCardInfo deckCardInfo, boolean mockCards) {
|
private static Card createCard(DeckCardInfo deckCardInfo, boolean mockCards) {
|
||||||
CardInfo cardInfo = CardRepository.instance.findCard(deckCardInfo.getSetCode(), deckCardInfo.getCardNum());
|
CardInfo cardInfo = CardRepository.instance.findCard(deckCardInfo.getSetCode(), deckCardInfo.getCardNum());
|
||||||
if (cardInfo == null) {
|
if (cardInfo == null) {
|
||||||
|
|
Loading…
Reference in a new issue