public Element toElement() { Element terrain = new Element("type"); terrain.setAttribute("id", id); terrain.setAttribute("char", text); terrain.setAttribute("color", color); if (modifier != Modifier.NONE) { terrain.setAttribute("mod", modifier.toString()); } if (description != null && !description.isEmpty()) { terrain.setText(description); } if (type != Subtype.NONE) { terrain.setAttribute("sub", type.toString()); } return terrain; }