mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-27 00:40:52 +01:00
Fix for duplicating room tags #2000
This commit is contained in:
parent
0a6355996a
commit
c22c7cf186
@ -10,6 +10,9 @@ import com.eu.habbo.messages.outgoing.rooms.*;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class RoomSettingsSaveEvent extends MessageHandler {
|
public class RoomSettingsSaveEvent extends MessageHandler {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(RoomSettingsSaveEvent.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(RoomSettingsSaveEvent.class);
|
||||||
|
|
||||||
@ -55,6 +58,7 @@ public class RoomSettingsSaveEvent 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 RoomSettingsSaveEvent extends MessageHandler {
|
|||||||
this.client.sendResponse(new RoomEditSettingsErrorComposer(room.getId(), RoomEditSettingsErrorComposer.TAGS_TOO_LONG, ""));
|
this.client.sendResponse(new RoomEditSettingsErrorComposer(room.getId(), RoomEditSettingsErrorComposer.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 RoomEditSettingsErrorComposer(room.getId(), RoomEditSettingsErrorComposer.ROOM_TAGS_BADWWORDS, ""));
|
this.client.sendResponse(new RoomEditSettingsErrorComposer(room.getId(), RoomEditSettingsErrorComposer.ROOM_TAGS_BADWWORDS, ""));
|
||||||
|
Loading…
Reference in New Issue
Block a user