mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
- CheckStyle.
This commit is contained in:
@@ -190,20 +190,18 @@ public final class CardDb {
|
||||
return new ImmutablePair<String, String>(cardName, null);
|
||||
}
|
||||
|
||||
private boolean isFoil(String cardName)
|
||||
{
|
||||
private boolean isFoil(String cardName) {
|
||||
return cardName.toLowerCase().endsWith(FOIL_SUFFIX) && cardName.length() > 5;
|
||||
}
|
||||
|
||||
public String removeFoilSuffix(String cardName)
|
||||
{
|
||||
public String removeFoilSuffix(String cardName) {
|
||||
return cardName.substring(0, cardName.length() - 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is card supported.
|
||||
*
|
||||
* @param cardName
|
||||
* @param cardName0
|
||||
* the card name
|
||||
* @return true, if is card supported
|
||||
*/
|
||||
@@ -363,20 +361,22 @@ public final class CardDb {
|
||||
} else {
|
||||
if (!fromLatestSet) {
|
||||
result = this.uniqueCards.get(nameWithSet.left.toLowerCase());
|
||||
if ( null == result )
|
||||
if (null == result) {
|
||||
throw new NoSuchElementException(String.format("Card '%s' not found in our database.", name));
|
||||
}
|
||||
} else {
|
||||
// OK, plain name here
|
||||
Predicate<CardPrinted> predicate = CardPrinted.Predicates.name(nameWithSet.left);
|
||||
List<CardPrinted> namedCards = predicate.select(this.allCardsFlat);
|
||||
if ( namedCards.isEmpty() )
|
||||
if (namedCards.isEmpty()) {
|
||||
throw new NoSuchElementException(String.format("Card '%s' not found in our database.", name));
|
||||
}
|
||||
|
||||
// Find card with maximal set index
|
||||
result = namedCards.get(0);
|
||||
int resIndex = SetUtils.getSetByCode((result).getSet()).getIndex();
|
||||
for(CardPrinted card : namedCards)
|
||||
{
|
||||
for (CardPrinted card : namedCards) {
|
||||
|
||||
int thisIndex = SetUtils.getSetByCode((card).getSet()).getIndex();
|
||||
if (thisIndex > resIndex) {
|
||||
result = card;
|
||||
@@ -385,8 +385,9 @@ public final class CardDb {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( isFoil )
|
||||
if (isFoil) {
|
||||
result = CardPrinted.makeFoiled(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,7 @@ public class PreconDeck implements InventoryItemFromSet {
|
||||
return "Prebuilt Deck";
|
||||
}
|
||||
|
||||
public PreconDeck(final File f)
|
||||
{
|
||||
public PreconDeck(final File f) {
|
||||
List<String> deckLines = FileUtil.readFile(f);
|
||||
Map<String, List<String>> sections = SectionUtil.parseSections(deckLines);
|
||||
deck = DeckIO.readDeck(deckLines);
|
||||
@@ -50,11 +49,13 @@ public class PreconDeck implements InventoryItemFromSet {
|
||||
List<String> metadata = sections.get("metadata");
|
||||
if (null != metadata && !metadata.isEmpty()) for (String s : metadata) {
|
||||
String[] kv = s.split("=");
|
||||
if( "Image".equalsIgnoreCase(kv[0]))
|
||||
if ("Image".equalsIgnoreCase(kv[0])) {
|
||||
filenameProxy = kv[1];
|
||||
if( "set".equalsIgnoreCase(kv[0]) && SetUtils.getSetByCode(kv[1].toUpperCase()) != null )
|
||||
}
|
||||
if ("set".equalsIgnoreCase(kv[0]) && SetUtils.getSetByCode(kv[1].toUpperCase()) != null) {
|
||||
setProxy = kv[1];
|
||||
}
|
||||
}
|
||||
imageFilename = filenameProxy;
|
||||
set = setProxy;
|
||||
recommendedDeals = new SellRules(sections.get("shop"));
|
||||
|
||||
Reference in New Issue
Block a user