Arcturus-Community/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomWordFilterModifyEvent.java

29 lines
808 B
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.messages.incoming.rooms;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.messages.incoming.MessageHandler;
2019-05-26 20:14:53 +02:00
public class RoomWordFilterModifyEvent extends MessageHandler {
2018-07-06 15:30:00 +02:00
@Override
2019-05-26 20:14:53 +02:00
public void handle() throws Exception {
2018-07-06 15:30:00 +02:00
int roomId = this.packet.readInt();
boolean add = this.packet.readBoolean();
String word = this.packet.readString();
2019-05-26 20:14:53 +02:00
if (word.length() > 25) {
2018-07-06 15:30:00 +02:00
word = word.substring(0, 24);
}
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId);
2019-05-26 20:14:53 +02:00
if (room != null) {
if (add) {
2018-07-06 15:30:00 +02:00
room.addToWordFilter(word);
2019-05-26 20:14:53 +02:00
} else {
2018-07-06 15:30:00 +02:00
room.removeFromWordFilter(word);
}
}
}
}