From b629053507012231efd90cfeecb3ebe89c201a59 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 22 Oct 2013 16:51:41 +0200 Subject: [PATCH] * deck text importer, Ignore sum lines eg. "22 craetures". --- .../mage/cards/decks/importer/TxtDeckImporter.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Mage/src/mage/cards/decks/importer/TxtDeckImporter.java b/Mage/src/mage/cards/decks/importer/TxtDeckImporter.java index 12291804e25..d908e6309b8 100644 --- a/Mage/src/mage/cards/decks/importer/TxtDeckImporter.java +++ b/Mage/src/mage/cards/decks/importer/TxtDeckImporter.java @@ -28,10 +28,12 @@ package mage.cards.decks.importer; +import java.util.Arrays; import java.util.Date; import java.util.GregorianCalendar; +import java.util.HashSet; import java.util.List; -import mage.cards.Sets; +import java.util.Set; import mage.cards.decks.DeckCardInfo; import mage.cards.decks.DeckCardLists; import mage.cards.repository.CardInfo; @@ -45,8 +47,12 @@ import mage.cards.repository.ExpansionRepository; */ public class TxtDeckImporter extends DeckImporter { + public static final String[] SET_VALUES = new String[] { "lands", "creatures", "planeswalkers","other spells" }; + public static final Set IGNORE_NAMES = new HashSet(Arrays.asList(SET_VALUES)); + private boolean sideboard = false; + @Override protected void readLine(String line, DeckCardLists deckList) { if (line.length() == 0 || line.startsWith("//")) { @@ -61,6 +67,9 @@ public class TxtDeckImporter extends DeckImporter { int delim = line.indexOf(' '); String lineNum = line.substring(0, delim).trim(); String lineName = line.substring(delim).replace("’","\'").trim(); + if (IGNORE_NAMES.contains(lineName)) { + return; + } try { int num = Integer.parseInt(lineNum); List cards = CardRepository.instance.findCards(lineName);