From e40d8c4f99e278beb23f5277aeef8de9dffa5bca Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 15:16:39 +0300 Subject: [PATCH] Validate post-it color and remove debugging --- .../rooms/items/PostItSaveDataEvent.java | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java index ff4e1fb7..2922fc94 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java @@ -8,30 +8,25 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.incoming.MessageHandler; +import java.util.Arrays; +import java.util.List; + public class PostItSaveDataEvent extends MessageHandler { + private static List COLORS = Arrays.asList("9CCEFF", "FF9CFF", "9CFF9C", "FFFF33"); + @Override public void handle() throws Exception { int itemId = this.packet.readInt(); String color = this.packet.readString(); - String text = this.packet.readString(); + String text = this.packet.readString().replace(((char) 9) + "", ""); if (text.length() > Emulator.getConfig().getInt("postit.charlimit")) { - ScripterManager.scripterDetected(this.client, Emulator.getTexts().getValue("scripter.warning.sticky.size").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%amount%", text.length() + "").replace("%limit%", "366")); - - if (text.length() >= Emulator.getConfig().getInt("postit.charlimit") + 50) { - this.client.getHabbo().alert("8=====D~~~~~

Computer Says:NO"); - } + ScripterManager.scripterDetected(this.client, Emulator.getTexts().getValue("scripter.warning.sticky.size").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%amount%", text.length() + "").replace("%limit%", Emulator.getConfig().getInt("postit.charlimit") + "")); return; } - text = text.replace(((char) 9) + "", ""); - if (text.startsWith("#") || text.startsWith(" #")) { - String colorCheck = text.split(" ")[0].replace(" ", "").replace(" #", "").replace("#", ""); - - if (colorCheck.length() == 6) { - color = colorCheck; - text = text.replace("#" + colorCheck + " ", ""); - } + if (!COLORS.contains(color)) { + return; } Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();