Validate post-it color and remove debugging

This commit is contained in:
Alejandro 2020-06-07 15:16:39 +03:00
parent 3df2f8055d
commit e40d8c4f99

View File

@ -8,30 +8,25 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import java.util.Arrays;
import java.util.List;
public class PostItSaveDataEvent extends MessageHandler { public class PostItSaveDataEvent extends MessageHandler {
private static List<String> COLORS = Arrays.asList("9CCEFF", "FF9CFF", "9CFF9C", "FFFF33");
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
int itemId = this.packet.readInt(); int itemId = this.packet.readInt();
String color = this.packet.readString(); 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")) { 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")); 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") + ""));
if (text.length() >= Emulator.getConfig().getInt("postit.charlimit") + 50) {
this.client.getHabbo().alert("8=====D~~~~~<br><br>Computer Says:<b><u>NO</u></b>");
}
return; return;
} }
text = text.replace(((char) 9) + "", ""); if (!COLORS.contains(color)) {
if (text.startsWith("#") || text.startsWith(" #")) { return;
String colorCheck = text.split(" ")[0].replace(" ", "").replace(" #", "").replace("#", "");
if (colorCheck.length() == 6) {
color = colorCheck;
text = text.replace("#" + colorCheck + " ", "");
}
} }
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();