Fixed wrong Valid until date in catalog for non hc

This commit is contained in:
Beny 2020-10-06 00:47:15 +02:00
parent 0b4a5b000f
commit b75225e707
2 changed files with 10 additions and 7 deletions

View File

@ -82,7 +82,7 @@ public class ClubOffer implements ISerialize {
} }
public void serialize(ServerMessage message, int hcExpireTimestamp) { public void serialize(ServerMessage message, int hcExpireTimestamp) {
hcExpireTimestamp = Math.min(Emulator.getIntUnixTimestamp(), hcExpireTimestamp); hcExpireTimestamp = Math.max(Emulator.getIntUnixTimestamp(), hcExpireTimestamp);
message.appendInt(this.id); message.appendInt(this.id);
message.appendString(this.name); message.appendString(this.name);
message.appendBoolean(false); //unused message.appendBoolean(false); //unused

View File

@ -9,7 +9,11 @@ import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.IOException; import java.io.IOException;
import java.io.StringWriter;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
@ -38,12 +42,11 @@ public class Figuredata {
Element rootElement = document.getDocumentElement(); Element rootElement = document.getDocumentElement();
if(!rootElement.getTagName().equalsIgnoreCase("figuredata")) { if(!rootElement.getTagName().equalsIgnoreCase("figuredata") || document.getElementsByTagName("colors") == null || document.getElementsByTagName("sets") == null) {
throw new Exception("The passed file is not in figuredata format. Received " + document.toString()); StringWriter writer = new StringWriter();
} TransformerFactory.newInstance().newTransformer().transform(new DOMSource(document), new StreamResult(writer));
String documentString = writer.getBuffer().toString();
if(document.getElementsByTagName("colors") == null || document.getElementsByTagName("sets") == null) { throw new Exception("The passed file is not in figuredata format. Received " + documentString.substring(0, Math.min(documentString.length(), 200)));
throw new Exception("The passed file is not in figuredata format. Received " + document.toString());
} }
NodeList palettesList = document.getElementsByTagName("colors").item(0).getChildNodes(); NodeList palettesList = document.getElementsByTagName("colors").item(0).getChildNodes();