From b75225e707e433999502cd59a879570bf196606e Mon Sep 17 00:00:00 2001 From: Beny Date: Tue, 6 Oct 2020 00:47:15 +0200 Subject: [PATCH] Fixed wrong Valid until date in catalog for non hc --- .../eu/habbo/habbohotel/catalog/ClubOffer.java | 2 +- .../users/clothingvalidation/Figuredata.java | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/ClubOffer.java b/src/main/java/com/eu/habbo/habbohotel/catalog/ClubOffer.java index de40e8ef..e615e13d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/ClubOffer.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/ClubOffer.java @@ -82,7 +82,7 @@ public class ClubOffer implements ISerialize { } public void serialize(ServerMessage message, int hcExpireTimestamp) { - hcExpireTimestamp = Math.min(Emulator.getIntUnixTimestamp(), hcExpireTimestamp); + hcExpireTimestamp = Math.max(Emulator.getIntUnixTimestamp(), hcExpireTimestamp); message.appendInt(this.id); message.appendString(this.name); message.appendBoolean(false); //unused diff --git a/src/main/java/com/eu/habbo/habbohotel/users/clothingvalidation/Figuredata.java b/src/main/java/com/eu/habbo/habbohotel/users/clothingvalidation/Figuredata.java index c68eedc5..c8c67671 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/clothingvalidation/Figuredata.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/clothingvalidation/Figuredata.java @@ -9,7 +9,11 @@ import org.xml.sax.SAXException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; 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.StringWriter; import java.util.Map; import java.util.TreeMap; @@ -38,12 +42,11 @@ public class Figuredata { Element rootElement = document.getDocumentElement(); - if(!rootElement.getTagName().equalsIgnoreCase("figuredata")) { - throw new Exception("The passed file is not in figuredata format. Received " + document.toString()); - } - - if(document.getElementsByTagName("colors") == null || document.getElementsByTagName("sets") == null) { - throw new Exception("The passed file is not in figuredata format. Received " + document.toString()); + if(!rootElement.getTagName().equalsIgnoreCase("figuredata") || document.getElementsByTagName("colors") == null || document.getElementsByTagName("sets") == null) { + StringWriter writer = new StringWriter(); + TransformerFactory.newInstance().newTransformer().transform(new DOMSource(document), new StreamResult(writer)); + String documentString = writer.getBuffer().toString(); + throw new Exception("The passed file is not in figuredata format. Received " + documentString.substring(0, Math.min(documentString.length(), 200))); } NodeList palettesList = document.getElementsByTagName("colors").item(0).getChildNodes();