mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Merge branch 'fix-duplicate-tags' into 'ms4/dev'
Fix for duplicating room tags #2000 See merge request morningstar/Arcturus-Community!40
This commit is contained in:
commit
3d26fa122d
@ -9,6 +9,9 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
|||||||
import com.eu.habbo.messages.outgoing.rooms.*;
|
import com.eu.habbo.messages.outgoing.rooms.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class SaveRoomSettingsEvent extends MessageHandler {
|
public class SaveRoomSettingsEvent extends MessageHandler {
|
||||||
|
|
||||||
@ -55,6 +58,7 @@ public class SaveRoomSettingsEvent extends MessageHandler {
|
|||||||
int usersMax = this.packet.readInt();
|
int usersMax = this.packet.readInt();
|
||||||
int categoryId = this.packet.readInt();
|
int categoryId = this.packet.readInt();
|
||||||
StringBuilder tags = new StringBuilder();
|
StringBuilder tags = new StringBuilder();
|
||||||
|
Set<String> uniqueTags = new HashSet<>();
|
||||||
int count = Math.min(this.packet.readInt(), 2);
|
int count = Math.min(this.packet.readInt(), 2);
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
String tag = this.packet.readString();
|
String tag = this.packet.readString();
|
||||||
@ -63,8 +67,11 @@ public class SaveRoomSettingsEvent extends MessageHandler {
|
|||||||
this.client.sendResponse(new RoomSettingsSaveErrorComposer(room.getId(), RoomSettingsSaveErrorComposer.TAGS_TOO_LONG, ""));
|
this.client.sendResponse(new RoomSettingsSaveErrorComposer(room.getId(), RoomSettingsSaveErrorComposer.TAGS_TOO_LONG, ""));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(!uniqueTags.contains(tag)) {
|
||||||
|
uniqueTags.add(tag);
|
||||||
tags.append(tag).append(";");
|
tags.append(tag).append(";");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!Emulator.getGameEnvironment().getWordFilter().filter(tags.toString(), this.client.getHabbo()).equals(tags.toString())) {
|
if (!Emulator.getGameEnvironment().getWordFilter().filter(tags.toString(), this.client.getHabbo()).equals(tags.toString())) {
|
||||||
this.client.sendResponse(new RoomSettingsSaveErrorComposer(room.getId(), RoomSettingsSaveErrorComposer.ROOM_TAGS_BADWWORDS, ""));
|
this.client.sendResponse(new RoomSettingsSaveErrorComposer(room.getId(), RoomSettingsSaveErrorComposer.ROOM_TAGS_BADWWORDS, ""));
|
||||||
@ -128,7 +135,6 @@ public class SaveRoomSettingsEvent extends MessageHandler {
|
|||||||
room.sendComposer(new RoomChatSettingsMessageComposer(room).compose());
|
room.sendComposer(new RoomChatSettingsMessageComposer(room).compose());
|
||||||
room.sendComposer(new RoomInfoUpdatedComposer(room).compose());
|
room.sendComposer(new RoomInfoUpdatedComposer(room).compose());
|
||||||
this.client.sendResponse(new RoomSettingsSavedComposer(room));
|
this.client.sendResponse(new RoomSettingsSavedComposer(room));
|
||||||
//TODO Find packet for update room name.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user