does not force deck to have comment or playerType

This commit is contained in:
Maxmtg
2011-09-05 16:09:20 +00:00
parent ef773c9d4c
commit 613d9aef78
2 changed files with 7 additions and 7 deletions

View File

@@ -26,8 +26,8 @@ public final class Deck implements Comparable<Deck>, Serializable {
private String name;
private String deckType;
private String comment;
private PlayerType playerType;
private String comment = null;
private PlayerType playerType = null;
private CardPool main;
private CardPool sideboard;
@@ -152,7 +152,7 @@ public final class Deck implements Comparable<Deck>, Serializable {
* @return a {@link java.lang.String} object.
*/
public String getComment() {
return comment == null ? "" : comment;
return comment;
}
/**

View File

@@ -463,14 +463,14 @@ public class DeckManager {
* @param out a {@link java.io.BufferedWriter} object.
* @throws java.io.IOException if any.
*/
private static void writeDeck(Deck d, BufferedWriter out) throws IOException {
private static void writeDeck(final Deck d, final BufferedWriter out) throws IOException {
out.write("[metadata]\n");
out.write(format("%s=%s%n", NAME, d.getName().replaceAll("\n", "")));
out.write(format("%s=%s%n", DECK_TYPE, d.getDeckType().replaceAll("\n", "")));
out.write(format("%s=%s%n", COMMENT, d.getComment().replaceAll("\n", "")));
out.write(format("%s=%s%n", PLAYER, d.getPlayerType()));
// these are optional
if (d.getComment() != null) { out.write(format("%s=%s%n", COMMENT, d.getComment().replaceAll("\n", ""))); }
if (d.getPlayerType() != null) { out.write(format("%s=%s%n", PLAYER, d.getPlayerType())); }
out.write(format("%s%n", "[main]"));
for (Entry<CardPrinted, Integer> e : d.getMain()) {