Figuredata parses correctly with whitespace now

This commit is contained in:
Beny 2020-10-15 13:40:43 +02:00
parent b7b81e8af9
commit 0d0f0d3373

View File

@ -1,5 +1,6 @@
package com.eu.habbo.habbohotel.users.clothingvalidation; package com.eu.habbo.habbohotel.users.clothingvalidation;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -57,12 +58,14 @@ public class Figuredata {
for(int i = 0; i < palettesList.getLength(); i++) { for(int i = 0; i < palettesList.getLength(); i++) {
Node nNode = palettesList.item(i); Node nNode = palettesList.item(i);
if(nNode.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) nNode; Element element = (Element) nNode;
int paletteId = Integer.parseInt(element.getAttribute("id")); int paletteId = Integer.parseInt(element.getAttribute("id"));
FiguredataPalette palette = new FiguredataPalette(paletteId); FiguredataPalette palette = new FiguredataPalette(paletteId);
NodeList colorsList = nNode.getChildNodes(); NodeList colorsList = nNode.getChildNodes();
for (int ii = 0; ii < colorsList.getLength(); ii++) { for (int ii = 0; ii < colorsList.getLength(); ii++) {
if(colorsList.item(ii).getNodeType() == Node.ELEMENT_NODE) {
Element colorElement = (Element) colorsList.item(ii); Element colorElement = (Element) colorsList.item(ii);
FiguredataPaletteColor color = new FiguredataPaletteColor( FiguredataPaletteColor color = new FiguredataPaletteColor(
Integer.parseInt(colorElement.getAttribute("id")), Integer.parseInt(colorElement.getAttribute("id")),
@ -73,12 +76,16 @@ public class Figuredata {
); );
palette.addColor(color); palette.addColor(color);
} }
}
palettes.put(palette.id, palette); palettes.put(palette.id, palette);
} }
}
for(int i = 0; i < settypesList.getLength(); i++) { for(int i = 0; i < settypesList.getLength(); i++) {
Node nNode = settypesList.item(i); Node nNode = settypesList.item(i);
if(nNode.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) nNode; Element element = (Element) nNode;
String type = element.getAttribute("type"); String type = element.getAttribute("type");
@ -92,6 +99,7 @@ public class Figuredata {
NodeList setsList = nNode.getChildNodes(); NodeList setsList = nNode.getChildNodes();
for (int ii = 0; ii < setsList.getLength(); ii++) { for (int ii = 0; ii < setsList.getLength(); ii++) {
if(setsList.item(ii).getNodeType() == Node.ELEMENT_NODE) {
Element setElement = (Element) setsList.item(ii); Element setElement = (Element) setsList.item(ii);
FiguredataSettypeSet set = new FiguredataSettypeSet( FiguredataSettypeSet set = new FiguredataSettypeSet(
Integer.parseInt(setElement.getAttribute("id")), Integer.parseInt(setElement.getAttribute("id")),
@ -104,9 +112,11 @@ public class Figuredata {
); );
settype.addSet(set); settype.addSet(set);
} }
}
settypes.put(settype.type, settype); settypes.put(settype.type, settype);
} }
}
} }
} }