mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Fixes wordfilter permission checks (#670).
This commit is contained in:
parent
f4fd43eb89
commit
6615588b34
@ -1,28 +1,37 @@
|
|||||||
package com.eu.habbo.messages.incoming.rooms;
|
package com.eu.habbo.messages.incoming.rooms;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.habbohotel.modtool.ScripterManager;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
|
|
||||||
public class RoomWordFilterModifyEvent extends MessageHandler {
|
public class RoomWordFilterModifyEvent extends MessageHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handle() throws Exception {
|
public void handle() throws Exception {
|
||||||
int roomId = this.packet.readInt();
|
final int roomId = this.packet.readInt();
|
||||||
boolean add = this.packet.readBoolean();
|
final boolean add = this.packet.readBoolean();
|
||||||
String word = this.packet.readString();
|
String word = this.packet.readString();
|
||||||
|
|
||||||
if (word.length() > 25) {
|
if (word.length() > 25) {
|
||||||
word = word.substring(0, 24);
|
word = word.substring(0, 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId);
|
// Get current room of user.
|
||||||
|
final Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
||||||
|
if (room == null || room.getId() != roomId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (room != null) {
|
// Check if owner.
|
||||||
|
if (!room.isOwner(this.client.getHabbo())) {
|
||||||
|
ScripterManager.scripterDetected(this.client, String.format("User (%s) tried to change wordfilter for a not owned room.", this.client.getHabbo().getHabboInfo().getUsername()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Modify word filter.
|
||||||
if (add) {
|
if (add) {
|
||||||
room.addToWordFilter(word);
|
room.addToWordFilter(word);
|
||||||
} else {
|
} else {
|
||||||
room.removeFromWordFilter(word);
|
room.removeFromWordFilter(word);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user