You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-20 15:36:17 +00:00
Merge pull request #212 from simoleo89/fix/room-item-safety
Harden room item packet guards
This commit is contained in:
+10
-1
@@ -1,15 +1,21 @@
|
||||
package com.eu.habbo.messages.incoming.rooms.items;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionPostIt;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
|
||||
public class RoomPickupChooserEvent extends MessageHandler {
|
||||
private static final int MAX_PICKUP_CHOOSER_ITEMS = 100;
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int count = this.packet.readInt();
|
||||
|
||||
if (count <= 0 || count > MAX_PICKUP_CHOOSER_ITEMS)
|
||||
return;
|
||||
|
||||
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
||||
|
||||
if (room == null)
|
||||
@@ -20,6 +26,9 @@ public class RoomPickupChooserEvent extends MessageHandler {
|
||||
HabboItem item = room.getHabboItem(itemId);
|
||||
|
||||
if (item != null) {
|
||||
if (item instanceof InteractionPostIt)
|
||||
continue;
|
||||
|
||||
if (item.getUserId() == this.client.getHabbo().getHabboInfo().getId()) {
|
||||
room.pickUpItem(item, this.client.getHabbo());
|
||||
} else {
|
||||
@@ -36,4 +45,4 @@ public class RoomPickupChooserEvent extends MessageHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-3
@@ -33,16 +33,22 @@ public class SavePostItStickyPoleEvent extends MessageHandler {
|
||||
LOGGER.info("Scripter Alert! {} | {}", this.client.getHabbo().getHabboInfo().getUsername(), this.packet.readString());
|
||||
}
|
||||
} else {
|
||||
String text = this.packet.readString();
|
||||
String text = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString().replace(((char) 9) + "", ""), this.client.getHabbo());
|
||||
|
||||
if (text.length() > Emulator.getConfig().getInt("postit.charlimit"))
|
||||
return;
|
||||
|
||||
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
||||
if (room == null)
|
||||
return;
|
||||
|
||||
HabboItem sticky = room.getHabboItem(itemId);
|
||||
|
||||
if (sticky != null) {
|
||||
if (sticky instanceof InteractionPostIt) {
|
||||
if (sticky.getUserId() == this.client.getHabbo().getHabboInfo().getId()) {
|
||||
sticky.setUserId(room.getOwnerId());
|
||||
|
||||
if (color.equalsIgnoreCase(PostItColor.YELLOW.hexColor)) {
|
||||
if (PostItColor.isCustomColor(color) || color.equalsIgnoreCase(PostItColor.YELLOW.hexColor)) {
|
||||
color = PostItColor.randomColorNotYellow().hexColor;
|
||||
}
|
||||
if (!InteractionPostIt.STICKYPOLE_PREFIX_TEXT.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user