Room.java clean-up

This commit is contained in:
Stankman 2023-07-22 17:04:48 -05:00
parent 4c5b362b87
commit 2eec0dc0ba
65 changed files with 341 additions and 296 deletions

View File

@ -88,7 +88,7 @@ public class CommandsManager {
String commandKey = parts[0];
Room currentRoom = gameClient.getHabbo().getRoomUnit().getRoom();
boolean hasRights = currentRoom != null &&
(currentRoom.hasRights(gameClient.getHabbo())) ||
(currentRoom.getRoomRightsManager().hasRights(gameClient.getHabbo())) ||
gameClient.getHabbo().hasRight(Permission.ACC_PLACEFURNI) ||
currentRoom.getRoomInfo().getGuild().getId() > 0 && currentRoom.getGuildRightLevel(gameClient.getHabbo()).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS);

View File

@ -12,7 +12,7 @@ public class BotsCommand extends Command {
@Override
public boolean handle(GameClient gameClient, String[] params) {
if (gameClient.getHabbo().getRoomUnit().getRoom() == null || !gameClient.getHabbo().getRoomUnit().getRoom().hasRights(gameClient.getHabbo()))
if (gameClient.getHabbo().getRoomUnit().getRoom() == null || !gameClient.getHabbo().getRoomUnit().getRoom().getRoomRightsManager().hasRights(gameClient.getHabbo()))
return false;
StringBuilder data = new StringBuilder(getTextsValue("total") + ": " + gameClient.getHabbo().getRoomUnit().getRoom().getRoomUnitManager().getCurrentRoomBots().values().size());

View File

@ -11,7 +11,7 @@ public class DiagonalCommand extends Command {
@Override
public boolean handle(GameClient gameClient, String[] params) {
if (gameClient.getHabbo().getRoomUnit().getRoom() != null && gameClient.getHabbo().getRoomUnit().getRoom().hasRights(gameClient.getHabbo())) {
if (gameClient.getHabbo().getRoomUnit().getRoom() != null && gameClient.getHabbo().getRoomUnit().getRoom().getRoomRightsManager().hasRights(gameClient.getHabbo())) {
gameClient.getHabbo().getRoomUnit().getRoom().setDiagonalMoveEnabled(!gameClient.getHabbo().getRoomUnit().getRoom().getRoomInfo().isDiagonalMoveEnabled());
if (!gameClient.getHabbo().getRoomUnit().getRoom().getRoomInfo().isDiagonalMoveEnabled()) {

View File

@ -17,7 +17,7 @@ public class EjectAllCommand extends Command {
if (room != null) {
if (room.getRoomInfo().isRoomOwner(gameClient.getHabbo())
|| (room.getRoomInfo().hasGuild() && room.getGuildRightLevel(gameClient.getHabbo()).equals(RoomRightLevels.GUILD_ADMIN))) {
room.ejectAll(gameClient.getHabbo());
room.ejectAllFurni(gameClient.getHabbo());
}
}

View File

@ -17,7 +17,7 @@ public class HideWiredCommand extends Command {
}
if (room.getRoomInfo().isRoomOwner(gameClient.getHabbo())) {
room.setHideWired(!room.getRoomInfo().isHiddenWiredEnabled());
room.getRoomItemManager().getWiredManager().setHideWired(!room.getRoomInfo().isHiddenWiredEnabled());
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_hidewired." + (room.getRoomInfo().isHiddenWiredEnabled() ? "hidden" : "shown")));
} else {
gameClient.getHabbo().whisper(getTextsValue("commands.errors.cmd_hidewired.permission"));

View File

@ -18,7 +18,7 @@ public class PickallCommand extends Command {
}
if (room.getRoomInfo().isRoomOwner(gameClient.getHabbo())) {
room.ejectAll();
room.ejectAllFurni();
return true;
}

View File

@ -13,7 +13,7 @@ public class SetSpeedCommand extends Command {
@Override
public boolean handle(GameClient gameClient, String[] params) {
if (gameClient.getHabbo().getRoomUnit().getRoom() != null && gameClient.getHabbo().getRoomUnit().getRoom().hasRights(gameClient.getHabbo())) {
if (gameClient.getHabbo().getRoomUnit().getRoom() != null && gameClient.getHabbo().getRoomUnit().getRoom().getRoomRightsManager().hasRights(gameClient.getHabbo())) {
Room room = gameClient.getHabbo().getRoomUnit().getRoom();
int oldSpeed = room.getRoomInfo().getRollerSpeed();

View File

@ -61,7 +61,7 @@ public class InteractionBackgroundToner extends RoomItem {
if(client != null)
{
if (!client.getHabbo().getRoomUnit().getRoom().hasRights(client.getHabbo())) {
if (!client.getHabbo().getRoomUnit().getRoom().getRoomRightsManager().hasRights(client.getHabbo())) {
ScripterManager.scripterDetected(
client,
Emulator.getTexts().getValue("scripter.warning.item.bgtoner.permission").replace("%username%", client.getHabbo().getHabboInfo().getUsername())

View File

@ -4,8 +4,8 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.ItemUpdateMessageComposer;
import com.eu.habbo.threading.runnables.RandomDiceNumber;
@ -46,7 +46,7 @@ public class InteractionColorWheel extends RoomItem {
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
super.onClick(client, room, objects);
if (!room.hasRights(client.getHabbo()))
if (!room.getRoomRightsManager().hasRights(client.getHabbo()))
return;
if (this.rollTaks == null && !this.getExtradata().equalsIgnoreCase("-1")) {

View File

@ -215,7 +215,7 @@ public class InteractionDefault extends RoomItem {
}
public boolean canToggle(Habbo habbo, Room room) {
if (room.hasRights(habbo)) return true;
if (room.getRoomRightsManager().hasRights(habbo)) return true;
if (!habbo.getHabboStats().isRentingSpace()) return false;

View File

@ -24,7 +24,7 @@ public class InteractionEffectToggle extends InteractionDefault {
}
if (client != null) {
if (room.hasRights(client.getHabbo())) {
if (room.getRoomRightsManager().hasRights(client.getHabbo())) {
if (Integer.parseInt(this.getExtradata()) < this.getBaseItem().getStateCount() - 1) {
if ((client.getHabbo().getHabboInfo().getGender() == HabboGender.M && client.getHabbo().getRoomUnit().getEffectId() == this.getBaseItem().getEffectM()) ||
(client.getHabbo().getHabboInfo().getGender() == HabboGender.F && client.getHabbo().getRoomUnit().getEffectId() == this.getBaseItem().getEffectF())) {

View File

@ -115,7 +115,7 @@ public class InteractionFireworks extends InteractionDefault {
@Override
public boolean canToggle(Habbo habbo, Room room) {
return room.hasRights(habbo) || RoomLayout.tilesAdjecent(
return room.getRoomRightsManager().hasRights(habbo) || RoomLayout.tilesAdjecent(
room.getLayout().getTile(this.getX(), this.getY()),
habbo.getRoomUnit().getCurrentPosition()
);

View File

@ -41,8 +41,7 @@ public class InteractionGate extends RoomItem {
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
boolean executedByWired = (objects.length >= 2 && objects[1] instanceof WiredEffectType && objects[1] == WiredEffectType.TOGGLE_STATE);
if (client != null && !room.hasRights(client.getHabbo()) && !executedByWired)
return;
if (client != null && !room.getRoomRightsManager().hasRights(client.getHabbo()) && !executedByWired) return;
// If a Habbo is standing on a tile occupied by the gate, the gate shouldn't open/close
for (RoomTile tile : room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()))

View File

@ -49,7 +49,7 @@ public class InteractionMultiHeight extends RoomItem {
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
super.onClick(client, room, objects);
if (client != null && !room.hasRights(client.getHabbo()) && !(objects.length >= 2 && objects[1] instanceof WiredEffectType && objects[1] == WiredEffectType.TOGGLE_STATE))
if (client != null && !room.getRoomRightsManager().hasRights(client.getHabbo()) && !(objects.length >= 2 && objects[1] instanceof WiredEffectType && objects[1] == WiredEffectType.TOGGLE_STATE))
return;
if (objects.length <= 0) {

View File

@ -48,7 +48,7 @@ public class InteractionMuteArea extends InteractionCustomValues {
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
super.onClick(client, room, objects);
if((objects.length >= 2 && objects[1] instanceof WiredEffectType) || (client != null && room.hasRights(client.getHabbo()))) {
if((objects.length >= 2 && objects[1] instanceof WiredEffectType) || (client != null && room.getRoomRightsManager().hasRights(client.getHabbo()))) {
this.values.put("state", this.values.get("state").equals("0") ? "1" : "0");
room.sendComposer(new ObjectDataUpdateMessageComposer(this).compose());
}

View File

@ -3,8 +3,8 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.messages.ServerMessage;
@ -68,7 +68,7 @@ public class InteractionVoteCounter extends RoomItem {
@Override
public void onClick(GameClient client, Room room, Object[] objects) {
if (room == null || !((client != null && room.hasRights(client.getHabbo())) || (objects.length >= 2 && objects[1] instanceof WiredEffectType)))
if (room == null || !((client != null && room.getRoomRightsManager().hasRights(client.getHabbo())) || (objects.length >= 2 && objects[1] instanceof WiredEffectType)))
return;
this.frozen = !this.frozen;

View File

@ -79,7 +79,7 @@ public abstract class InteractionWired extends InteractionDefault implements IWi
this.wiredSettings.getItems(room);
if (client != null) {
if (room.hasRights(client.getHabbo())) {
if (room.getRoomRightsManager().hasRights(client.getHabbo())) {
MessageComposer composer = null;
if(this instanceof InteractionWiredEffect) {
composer = new WiredEffectDataComposer((InteractionWiredEffect) this, room);

View File

@ -20,7 +20,7 @@ public abstract class InteractionWiredExtra extends InteractionWired {
@Override
public void onClick(GameClient client, Room room, Object[] objects) {
if (client != null) {
if (room.hasRights(client.getHabbo())) {
if (room.getRoomRightsManager().hasRights(client.getHabbo())) {
this.activateBox(room);
}
}

View File

@ -4,8 +4,8 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
@ -81,7 +81,7 @@ public class InteractionWiredHighscore extends RoomItem {
@Override
public void onClick(GameClient client, Room room, Object[] objects) {
if (room == null || !((client != null && room.hasRights(client.getHabbo())) || (objects.length >= 2 && objects[1] instanceof WiredEffectType)))
if (room == null || !((client != null && room.getRoomRightsManager().hasRights(client.getHabbo())) || (objects.length >= 2 && objects[1] instanceof WiredEffectType)))
return;
if (this.getExtradata() == null || this.getExtradata().isEmpty() || this.getExtradata().length() == 0) {

View File

@ -8,8 +8,8 @@ import com.eu.habbo.habbohotel.games.wired.WiredGame;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
@ -232,7 +232,7 @@ public class InteractionGameTimer extends RoomItem implements Runnable {
Emulator.getThreading().run(new GameTimer(this), 1000);
}
} else if (client != null) {
if (!(room.hasRights(client.getHabbo()) || client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)))
if (!(room.getRoomRightsManager().hasRights(client.getHabbo()) || client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)))
return;
InteractionGameTimerAction state = InteractionGameTimerAction.START_STOP;

View File

@ -74,7 +74,7 @@ public class InteractionTotemHead extends InteractionDefault {
@Override
public void onClick(GameClient client, Room room, Object[] objects) {
if (!((client != null && room != null && room.hasRights(client.getHabbo())) || (objects.length >= 2 && objects[1] instanceof WiredEffectType)))
if (!((client != null && room != null && room.getRoomRightsManager().hasRights(client.getHabbo())) || (objects.length >= 2 && objects[1] instanceof WiredEffectType)))
return;
TotemType newType = TotemType.fromInt(getTotemType().getType() + 1);

View File

@ -51,7 +51,7 @@ public class InteractionTotemLegs extends InteractionDefault {
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
super.onClick(client, room, objects);
if (room == null || !((client != null && room.hasRights(client.getHabbo())) || (objects.length >= 2 && objects[1] instanceof WiredEffectType)))
if (room == null || !((client != null && room.getRoomRightsManager().hasRights(client.getHabbo())) || (objects.length >= 2 && objects[1] instanceof WiredEffectType)))
return;
updateHead(room, room.getLayout().getTile(this.getX(), this.getY()));

View File

@ -36,7 +36,7 @@ public class WiredEffectMuteRoom extends InteractionWiredEffect {
Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit);
if (habbo != null) {
if (room.hasRights(habbo))
if (room.getRoomRightsManager().hasRights(habbo))
return false;
room.muteHabbo(habbo, 60);

View File

@ -22,7 +22,6 @@ import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField;
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole;
import com.eu.habbo.habbohotel.items.interactions.pets.*;
import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredBlob;
import com.eu.habbo.habbohotel.messenger.MessengerBuddy;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.RideablePet;
@ -47,8 +46,13 @@ import com.eu.habbo.messages.outgoing.guilds.HabboGroupDetailsMessageComposer;
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
import com.eu.habbo.messages.outgoing.polls.infobus.QuestionAnsweredComposer;
import com.eu.habbo.messages.outgoing.polls.infobus.QuestionComposer;
import com.eu.habbo.messages.outgoing.rooms.*;
import com.eu.habbo.messages.outgoing.rooms.items.*;
import com.eu.habbo.messages.outgoing.rooms.FlatAccessDeniedMessageComposer;
import com.eu.habbo.messages.outgoing.rooms.FlatAccessibleMessageComposer;
import com.eu.habbo.messages.outgoing.rooms.HeightMapUpdateMessageComposer;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
import com.eu.habbo.messages.outgoing.rooms.items.ItemUpdateMessageComposer;
import com.eu.habbo.messages.outgoing.rooms.items.ObjectUpdateMessageComposer;
import com.eu.habbo.messages.outgoing.rooms.items.OneWayDoorStatusMessageComposer;
import com.eu.habbo.messages.outgoing.rooms.users.*;
import com.eu.habbo.messages.outgoing.users.RemainingMutePeriodComposer;
import com.eu.habbo.plugin.Event;
@ -57,11 +61,13 @@ import com.eu.habbo.plugin.events.furniture.FurnitureStackHeightEvent;
import com.eu.habbo.plugin.events.rooms.RoomLoadedEvent;
import com.eu.habbo.plugin.events.rooms.RoomUnloadedEvent;
import com.eu.habbo.plugin.events.rooms.RoomUnloadingEvent;
import com.eu.habbo.plugin.events.users.*;
import com.eu.habbo.plugin.events.users.UserExitRoomEvent;
import com.eu.habbo.plugin.events.users.UserIdleEvent;
import com.eu.habbo.plugin.events.users.UserRolledEvent;
import com.eu.habbo.plugin.events.users.UsernameTalkEvent;
import com.eu.habbo.threading.runnables.YouAreAPirate;
import gnu.trove.TCollections;
import gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.list.array.TIntArrayList;
import gnu.trove.map.TIntIntMap;
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap;
@ -96,6 +102,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
@Getter
private final RoomItemManager roomItemManager;
@Getter
private final RoomRightsManager roomRightsManager;
@Getter
private TraxManager traxManager;
private static final String CAUGHT_EXCEPTION = "Caught exception";
public static final Comparator<Room> SORT_SCORE = (o1, o2) -> o2.roomInfo.getScore() - o1.roomInfo.getScore();
@ -118,8 +126,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
@Getter
private final TIntObjectMap<Habbo> habboQueue = TCollections.synchronizedMap(new TIntObjectHashMap<>(0));
private final THashSet<RoomTrade> activeTrades;
@Getter
private final TIntArrayList rights;
private final TIntIntHashMap mutedHabbos;
private final TIntObjectHashMap<RoomBan> bannedHabbos;
@Getter
@ -184,6 +190,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.roomInfo = new RoomInfo(set);
this.roomUnitManager = new RoomUnitManager(this);
this.roomItemManager = new RoomItemManager(this);
this.roomRightsManager = new RoomRightsManager(this);
this.layoutName = set.getString("model");
this.bannedHabbos = new TIntObjectHashMap<>();
@ -219,7 +226,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.games = new ConcurrentSet<>();
this.activeTrades = new THashSet<>(0);
this.rights = new TIntArrayList();
this.userVotes = new ArrayList<>();
this.triggersOnRoom = new HashMap<>();
@ -238,7 +244,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.roomSpecialTypes = new RoomSpecialTypes();
this.loadLayout();
this.loadRights(connection);
this.roomRightsManager.load(connection);
//TODO Deprecated
this.loadItems(connection);
@ -1791,7 +1797,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
}
public boolean isMuted(Habbo habbo) {
if (this.getRoomInfo().isRoomOwner(habbo) || this.hasRights(habbo))
if (this.getRoomInfo().isRoomOwner(habbo) || this.roomRightsManager.hasRights(habbo))
return false;
if (this.mutedHabbos.containsKey(habbo.getHabboInfo().getId())) {
@ -1905,7 +1911,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
}
if (!habbo.hasRight(Permission.ACC_NOMUTE)) {
if (this.isMuted() && !this.hasRights(habbo)) {
if (this.isMuted() && !this.roomRightsManager.hasRights(habbo)) {
return;
}
@ -1935,7 +1941,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
if (chatCounter > 3) {
final boolean floodRights = Emulator.getConfig().getBoolean("flood.with.rights");
final boolean hasRights = this.hasRights(habbo);
final boolean hasRights = this.roomRightsManager.hasRights(habbo);
if (floodRights || !hasRights) {
if (this.roomInfo.getChatProtection() == 0 || (this.roomInfo.getChatProtection() == 1 && chatCounter > 4) || (this.roomInfo.getChatProtection() == 2 && chatCounter > 5)) {
@ -2005,7 +2011,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
for (Habbo h : this.roomUnitManager.getRoomHabbos()) {
if ((h.getRoomUnit().getCurrentPosition().distance(habbo.getRoomUnit().getCurrentPosition()) <= this.roomInfo.getChatDistance() ||
h.equals(habbo) ||
this.hasRights(h) ||
this.roomRightsManager.hasRights(h) ||
noChatLimit) && (tentRectangle == null || RoomLayout.tileInSquare(tentRectangle, h.getRoomUnit().getCurrentPosition()))) {
if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) {
if (prefixMessage != null && !h.getHabboStats().isPreferOldChat()) {
@ -2528,6 +2534,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
return null;
}
public void alert(String message) {
this.sendComposer(new HabboBroadcastMessageComposer(message).compose());
}
public void sendComposer(ServerMessage message) {
for (Habbo habbo : this.roomUnitManager.getRoomHabbos()) {
if (habbo.getClient() == null) continue;
@ -2555,22 +2565,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
}
}
private void loadRights(Connection connection) {
this.rights.clear();
try (PreparedStatement statement = connection.prepareStatement("SELECT user_id FROM room_rights WHERE room_id = ?")) {
statement.setInt(1, this.roomInfo.getId());
try (ResultSet set = statement.executeQuery()) {
while (set.next()) {
this.rights.add(set.getInt(DatabaseConstants.USER_ID));
}
}
} catch (SQLException e) {
log.error(CAUGHT_SQL_EXCEPTION, e);
} catch (Exception e) {
log.error(CAUGHT_EXCEPTION, e);
}
}
private void loadBans(Connection connection) {
this.bannedHabbos.clear();
@ -2607,150 +2601,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
return RoomRightLevels.NONE;
}
public boolean hasRights(Habbo habbo) {
return this.getRoomInfo().isRoomOwner(habbo) || this.rights.contains(habbo.getHabboInfo().getId()) || (habbo.getRoomUnit().getRightsLevel() != RoomRightLevels.NONE && this.roomUnitManager.getCurrentRoomHabbos().containsKey(habbo.getHabboInfo().getId()));
}
public void giveRights(Habbo habbo) {
if (habbo != null) {
this.giveRights(habbo.getHabboInfo().getId());
}
}
public void giveRights(int userId) {
if (this.rights.contains(userId))
return;
if (this.rights.add(userId)) {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO room_rights VALUES (?, ?)")) {
statement.setInt(1, this.roomInfo.getId());
statement.setInt(2, userId);
statement.execute();
} catch (SQLException e) {
log.error(CAUGHT_SQL_EXCEPTION, e);
}
}
Habbo habbo = this.roomUnitManager.getRoomHabboById(userId);
if (habbo != null) {
this.refreshRightsForHabbo(habbo);
this.sendComposer(new FlatControllerAddedComposer(this, habbo.getHabboInfo().getId(), habbo.getHabboInfo().getUsername()).compose());
} else {
Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.roomInfo.getOwnerInfo().getId());
if (owner != null) {
MessengerBuddy buddy = owner.getMessenger().getFriend(userId);
if (buddy != null) {
this.sendComposer(new FlatControllerAddedComposer(this, userId, buddy.getUsername()).compose());
}
}
}
}
public void removeRights(int userId) {
Habbo habbo = this.roomUnitManager.getRoomHabboById(userId);
if (Emulator.getPluginManager().fireEvent(new UserRightsTakenEvent(this.roomUnitManager.getRoomHabboById(this.roomInfo.getOwnerInfo().getId()), userId, habbo)).isCancelled())
return;
this.sendComposer(new FlatControllerRemovedComposer(this, userId).compose());
if (this.rights.remove(userId)) {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM room_rights WHERE room_id = ? AND user_id = ?")) {
statement.setInt(1, this.roomInfo.getId());
statement.setInt(2, userId);
statement.execute();
} catch (SQLException e) {
log.error(CAUGHT_SQL_EXCEPTION, e);
}
}
if (habbo != null) {
this.ejectUserFurni(habbo.getHabboInfo().getId());
habbo.getRoomUnit().setRightsLevel(RoomRightLevels.NONE);
habbo.getRoomUnit().removeStatus(RoomUnitStatus.FLAT_CONTROL);
this.refreshRightsForHabbo(habbo);
}
}
public void removeAllRights() {
for (int userId : rights.toArray()) {
this.ejectUserFurni(userId);
}
this.rights.clear();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM room_rights WHERE room_id = ?")) {
statement.setInt(1, this.roomInfo.getId());
statement.execute();
} catch (SQLException e) {
log.error(CAUGHT_SQL_EXCEPTION, e);
}
this.refreshRightsInRoom();
}
void refreshRightsInRoom() {
Room room = this;
for (Habbo habbo : this.roomUnitManager.getRoomHabbos()) {
if (habbo.getRoomUnit().getRoom() == room) {
this.refreshRightsForHabbo(habbo);
}
}
}
public void refreshRightsForHabbo(Habbo habbo) {
RoomItem item;
RoomRightLevels flatCtrl = RoomRightLevels.NONE;
if (habbo.getHabboStats().isRentingSpace()) {
item = this.getHabboItem(habbo.getHabboStats().getRentedItemId());
if (item != null) {
return;
}
}
if (habbo.hasRight(Permission.ACC_ANYROOMOWNER) || this.getRoomInfo().isRoomOwner(habbo)) {
habbo.getClient().sendResponse(new YouAreOwnerMessageComposer());
flatCtrl = RoomRightLevels.MODERATOR;
} else if (this.hasRights(habbo) && !this.roomInfo.hasGuild()) {
flatCtrl = RoomRightLevels.RIGHTS;
} else if (this.roomInfo.hasGuild()) {
flatCtrl = this.getGuildRightLevel(habbo);
}
habbo.getClient().sendResponse(new YouAreControllerMessageComposer(flatCtrl));
habbo.getRoomUnit().setStatus(RoomUnitStatus.FLAT_CONTROL, String.valueOf(flatCtrl.getLevel()));
habbo.getRoomUnit().setRightsLevel(flatCtrl);
habbo.getRoomUnit().setStatusUpdateNeeded(true);
if (flatCtrl.equals(RoomRightLevels.MODERATOR)) {
habbo.getClient().sendResponse(new FlatControllersComposer(this));
}
}
public THashMap<Integer, String> getUsersWithRights() {
THashMap<Integer, String> rightsMap = new THashMap<>();
if (!this.rights.isEmpty()) {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username AS username, users.id as user_id FROM room_rights INNER JOIN users ON room_rights.user_id = users.id WHERE room_id = ?")) {
statement.setInt(1, this.roomInfo.getId());
try (ResultSet set = statement.executeQuery()) {
while (set.next()) {
rightsMap.put(set.getInt(DatabaseConstants.USER_ID), set.getString("username"));
}
}
} catch (SQLException e) {
log.error(CAUGHT_SQL_EXCEPTION, e);
}
}
return rightsMap;
}
public void unbanHabbo(int userId) {
RoomBan ban = this.bannedHabbos.remove(userId);
@ -2940,7 +2790,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
for (Habbo habbo : this.roomUnitManager.getRoomHabbos()) {
if ((habbo.getRoomUnit().getRoom() == this && habbo.getHabboInfo().getId() != this.roomInfo.getOwnerInfo().getId())
&& (!(habbo.hasRight(Permission.ACC_ANYROOMOWNER) || habbo.hasRight(Permission.ACC_MOVEROTATE))))
this.refreshRightsForHabbo(habbo);
this.getRoomRightsManager().refreshRightsForHabbo(habbo);
}
}
@ -3030,35 +2880,4 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
public boolean hasVotedInWordQuiz(Habbo habbo) {
return this.userVotes.contains(habbo.getHabboInfo().getId());
}
public void alert(String message) {
this.sendComposer(new HabboBroadcastMessageComposer(message).compose());
}
public void setHideWired(boolean hideWired) {
this.roomInfo.setHiddenWiredEnabled(hideWired);
if (this.roomInfo.isHiddenWiredEnabled()) {
for (RoomItem item : this.roomSpecialTypes.getTriggers()) {
this.sendComposer(new RemoveFloorItemComposer(item).compose());
}
for (RoomItem item : this.roomSpecialTypes.getEffects()) {
this.sendComposer(new RemoveFloorItemComposer(item).compose());
}
for (RoomItem item : this.roomSpecialTypes.getConditions()) {
this.sendComposer(new RemoveFloorItemComposer(item).compose());
}
for (RoomItem item : this.roomSpecialTypes.getExtras()) {
this.sendComposer(new RemoveFloorItemComposer(item).compose());
}
} else {
this.sendComposer(new ObjectsMessageComposer(this.furniOwnerNames, this.roomSpecialTypes.getTriggers()).compose());
this.sendComposer(new ObjectsMessageComposer(this.furniOwnerNames, this.roomSpecialTypes.getEffects()).compose());
this.sendComposer(new ObjectsMessageComposer(this.furniOwnerNames, this.roomSpecialTypes.getConditions()).compose());
this.sendComposer(new ObjectsMessageComposer(this.furniOwnerNames, this.roomSpecialTypes.getExtras()).compose());
}
}
}

View File

@ -65,7 +65,7 @@ public class RoomItemManager {
public RoomItemManager(Room room) {
this.room = room;
this.currentItems = new ConcurrentHashMap<>();
this.wiredManager = new RoomWiredManager();
this.wiredManager = new RoomWiredManager(room);
this.floorItems = new ConcurrentHashMap<>();
this.wallItems = new ConcurrentHashMap<>();
@ -236,7 +236,7 @@ public class RoomItemManager {
}
rotation %= 8;
if (this.room.hasRights(habbo) || this.room.getGuildRightLevel(habbo).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS) || habbo.hasRight(Permission.ACC_MOVEROTATE)) {
if (this.room.getRoomRightsManager().hasRights(habbo) || this.room.getGuildRightLevel(habbo).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS) || habbo.hasRight(Permission.ACC_MOVEROTATE)) {
return FurnitureMovementError.NONE;
}
@ -326,7 +326,7 @@ public class RoomItemManager {
}
public FurnitureMovementError placeWallFurniAt(RoomItem item, String wallPosition, Habbo owner) {
if (!(this.room.hasRights(owner) || this.room.getGuildRightLevel(owner).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS))) {
if (!(this.room.getRoomRightsManager().hasRights(owner) || this.room.getGuildRightLevel(owner).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS))) {
return FurnitureMovementError.NO_RIGHTS;
}

View File

@ -497,7 +497,7 @@ public class RoomManager {
}
//If room is full AND user doesn't have Permissions can't enter to room
if (room.getRoomUnitManager().getRoomHabbosCount() >= room.getRoomInfo().getMaxUsers() && !room.hasRights(habbo) && !habbo.hasRight(Permission.ACC_FULLROOMS)) {
if (room.getRoomUnitManager().getRoomHabbosCount() >= room.getRoomInfo().getMaxUsers() && !room.getRoomRightsManager().hasRights(habbo) && !habbo.hasRight(Permission.ACC_FULLROOMS)) {
habbo.getClient().sendResponse(new CantConnectMessageComposer(CantConnectMessageComposer.ROOM_ERROR_GUESTROOM_FULL));
return;
}
@ -517,14 +517,14 @@ public class RoomManager {
* If habbo has permissions open room
* If habbo has guild rights open room
*/
if (forceEnter || room.getRoomInfo().isRoomOwner(habbo) || room.getRoomInfo().getState() == RoomState.OPEN || habbo.hasRight(Permission.ACC_ENTERANYROOM) || room.hasRights(habbo) || (room.getRoomInfo().getState().equals(RoomState.INVISIBLE) && room.hasRights(habbo)) || (room.getRoomInfo().hasGuild() && room.getGuildRightLevel(habbo).isGreaterThan(RoomRightLevels.GUILD_RIGHTS))) {
if (forceEnter || room.getRoomInfo().isRoomOwner(habbo) || room.getRoomInfo().getState() == RoomState.OPEN || habbo.hasRight(Permission.ACC_ENTERANYROOM) || room.getRoomRightsManager().hasRights(habbo) || (room.getRoomInfo().getState().equals(RoomState.INVISIBLE) && room.getRoomRightsManager().hasRights(habbo)) || (room.getRoomInfo().hasGuild() && room.getGuildRightLevel(habbo).isGreaterThan(RoomRightLevels.GUILD_RIGHTS))) {
this.openRoom(habbo, room, spawnLocation);
} else if (room.getRoomInfo().getState() == RoomState.LOCKED) {
boolean habbosWithRights = false;
synchronized (room.getRoomUnitManager().roomUnitLock) {
for (Habbo current : room.getRoomUnitManager().getRoomHabbos()) {
if (room.hasRights(current) || current.getHabboInfo().getId() == room.getRoomInfo().getOwnerInfo().getId() || (room.getRoomInfo().hasGuild() && room.getGuildRightLevel(current).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS))) {
if (room.getRoomRightsManager().hasRights(current) || current.getHabboInfo().getId() == room.getRoomInfo().getOwnerInfo().getId() || (room.getRoomInfo().hasGuild() && room.getGuildRightLevel(current).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS))) {
current.getClient().sendResponse(new DoorbellMessageComposer(habbo.getHabboInfo().getUsername()));
habbosWithRights = true;
}
@ -623,11 +623,11 @@ public class RoomManager {
habbo.getClient().sendResponse(new RoomPropertyMessageComposer("landscape", room.getRoomInfo().getLandscapePaint()));
room.refreshRightsForHabbo(habbo);
room.getRoomRightsManager().refreshRightsForHabbo(habbo);
habbo.getClient().sendResponse(new RoomRatingComposer(room.getRoomInfo().getScore(), !this.hasVotedForRoom(habbo, room)));
roomHabbo.setFastWalkEnabled(roomHabbo.isFastWalkEnabled() && habbo.hasCommand("cmd_fastwalk", room.hasRights(habbo)));
roomHabbo.setFastWalkEnabled(roomHabbo.isFastWalkEnabled() && habbo.hasCommand("cmd_fastwalk", room.getRoomRightsManager().hasRights(habbo)));
if (room.isPromoted()) {
habbo.getClient().sendResponse(new RoomEventComposer(room, room.getPromotion()));
@ -657,7 +657,7 @@ public class RoomManager {
roomHabbo.setRoom(room);
roomHabbo.setLoadingRoom(null);
room.refreshRightsForHabbo(habbo);
room.getRoomRightsManager().refreshRightsForHabbo(habbo);
if (habbo.getRoomUnit().isKicked() && !habbo.getRoomUnit().isCanWalk()) {
habbo.getRoomUnit().setCanWalk(true);
@ -823,7 +823,7 @@ public class RoomManager {
habbo.getClient().sendResponse(new HabboGroupBadgesMessageComposer(guildBadges));
if ((room.hasRights(habbo)
if ((room.getRoomRightsManager().hasRights(habbo)
|| (room.getRoomInfo().hasGuild()
&& room.getGuildRightLevel(habbo).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS)))
&& !room.getHabboQueue().isEmpty()) {
@ -1162,7 +1162,7 @@ public class RoomManager {
if (room != null) {
if (room.getRoomInfo().getState() == RoomState.INVISIBLE) {
room.loadData();
if (!room.hasRights(habbo)) return true;
if (!room.getRoomRightsManager().hasRights(habbo)) return true;
}
rooms.add(room);
}
@ -1226,7 +1226,7 @@ public class RoomManager {
if (friend == null || friend.getHabboInfo() == null) continue;
Room room = friend.getRoomUnit().getRoom();
if (room != null && !rooms.contains(room) && room.hasRights(habbo)) rooms.add(room);
if (room != null && !rooms.contains(room) && room.getRoomRightsManager().hasRights(habbo)) rooms.add(room);
if (rooms.size() >= limit) break;
}
@ -1362,8 +1362,7 @@ public class RoomManager {
if (room == null)
return;
if (rights != null && !room.hasRights(rights))
return;
if (rights != null && !room.getRoomRightsManager().hasRights(rights)) return;
String name = "";

View File

@ -0,0 +1,207 @@
package com.eu.habbo.habbohotel.rooms;
import com.eu.habbo.Emulator;
import com.eu.habbo.database.DatabaseConstants;
import com.eu.habbo.habbohotel.messenger.MessengerBuddy;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.rooms.*;
import com.eu.habbo.plugin.events.users.UserRightsTakenEvent;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import static com.eu.habbo.database.DatabaseConstants.CAUGHT_SQL_EXCEPTION;
@Slf4j
@Getter
@Setter
public class RoomRightsManager {
private final Room room;
private final List<Integer> rights;
public RoomRightsManager(Room room) {
this.room = room;
this.rights = new ArrayList<>();
}
public synchronized void load(Connection connection) {
this.loadRights(connection);
}
private void loadRights(Connection connection) {
this.rights.clear();
try (PreparedStatement statement = connection.prepareStatement("SELECT user_id FROM room_rights WHERE room_id = ?")) {
statement.setInt(1, this.room.getRoomInfo().getId());
try (ResultSet set = statement.executeQuery()) {
while (set.next()) {
this.rights.add(set.getInt(DatabaseConstants.USER_ID));
}
}
} catch (SQLException e) {
log.error(CAUGHT_SQL_EXCEPTION, e);
} catch (Exception e) {
log.error("Caught Exception", e);
}
}
public boolean hasRights(Habbo habbo) {
return this.room.getRoomInfo().isRoomOwner(habbo) || this.rights.contains(habbo.getHabboInfo().getId()) || (habbo.getRoomUnit().getRightsLevel() != RoomRightLevels.NONE && this.room.getRoomUnitManager().getCurrentRoomHabbos().containsKey(habbo.getHabboInfo().getId()));
}
public HashMap<Integer, String> getUsersWithRights() {
HashMap<Integer, String> rightsMap = new HashMap<>();
if (this.rights.isEmpty()) {
return rightsMap;
}
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT users.username AS username, users.id AS user_id FROM room_rights INNER JOIN users ON room_rights.user_id = users.id WHERE room_id = ?")) {
statement.setInt(1, this.room.getRoomInfo().getId());
try (ResultSet set = statement.executeQuery()) {
while (set.next()) {
int userId = set.getInt("user_id");
String username = set.getString("username");
rightsMap.put(userId, username);
}
}
} catch (SQLException e) {
log.error("Error while fetching users with rights:", e);
}
return rightsMap;
}
public void giveRights(Habbo habbo) {
if (this.rights.contains(habbo.getHabboInfo().getId())) {
return;
}
if (this.rights.add(habbo.getHabboInfo().getId())) {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO room_rights VALUES (?, ?)")) {
statement.setInt(1, this.room.getRoomInfo().getId());
statement.setInt(2, habbo.getHabboInfo().getId());
statement.execute();
} catch (SQLException e) {
log.error(CAUGHT_SQL_EXCEPTION, e);
}
}
this.room.getRoomRightsManager().refreshRightsForHabbo(habbo);
this.room.sendComposer(new FlatControllerAddedComposer(this.room, habbo.getHabboInfo().getId(), habbo.getHabboInfo().getUsername()).compose());
}
public void giveRights(MessengerBuddy buddy) {
if (this.rights.contains(buddy.getId())) {
return;
}
this.rights.add(buddy.getId());
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO room_rights VALUES (?, ?)")) {
statement.setInt(1, this.room.getRoomInfo().getId());
statement.setInt(2, buddy.getId());
statement.execute();
} catch (SQLException e) {
log.error(CAUGHT_SQL_EXCEPTION, e);
}
Habbo roomOwner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.room.getRoomInfo().getOwnerInfo().getId());
if (roomOwner != null) {
this.room.sendComposer(new FlatControllerAddedComposer(this.room, buddy.getId(), buddy.getUsername()).compose());
}
}
public void removeRights(int userId) {
Habbo habbo = this.room.getRoomUnitManager().getRoomHabboById(userId);
if (Emulator.getPluginManager().fireEvent(new UserRightsTakenEvent(this.room.getRoomUnitManager().getRoomHabboById(this.room.getRoomInfo().getOwnerInfo().getId()), userId, habbo)).isCancelled())
return;
this.room.sendComposer(new FlatControllerRemovedComposer(this.room, userId).compose());
if (this.rights.remove(Integer.valueOf(userId))) {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM room_rights WHERE room_id = ? AND user_id = ?")) {
statement.setInt(1, this.room.getRoomInfo().getId());
statement.setInt(2, userId);
statement.execute();
} catch (SQLException e) {
log.error(CAUGHT_SQL_EXCEPTION, e);
}
}
if (habbo != null) {
this.room.ejectUserFurni(habbo.getHabboInfo().getId());
habbo.getRoomUnit().setRightsLevel(RoomRightLevels.NONE);
habbo.getRoomUnit().removeStatus(RoomUnitStatus.FLAT_CONTROL);
this.refreshRightsForHabbo(habbo);
}
}
public void removeAllRights() {
for (int userId : this.rights) {
this.room.ejectUserFurni(userId);
}
this.rights.clear();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM room_rights WHERE room_id = ?")) {
statement.setInt(1, this.room.getRoomInfo().getId());
statement.execute();
} catch (SQLException e) {
log.error(CAUGHT_SQL_EXCEPTION, e);
}
this.refreshRightsInRoom();
}
private void refreshRightsInRoom() {
for (Habbo habbo : this.room.getRoomUnitManager().getRoomHabbos()) {
if (habbo.getRoomUnit().getRoom() == room) {
this.refreshRightsForHabbo(habbo);
}
}
}
public void refreshRightsForHabbo(Habbo habbo) {
RoomItem item;
RoomRightLevels flatCtrl = RoomRightLevels.NONE;
if (habbo.getHabboStats().isRentingSpace()) {
item = this.room.getRoomItemManager().getCurrentItems().get(habbo.getHabboStats().getRentedItemId());
if (item != null) {
return;
}
}
if (habbo.hasRight(Permission.ACC_ANYROOMOWNER) || this.room.getRoomInfo().isRoomOwner(habbo)) {
habbo.getClient().sendResponse(new YouAreOwnerMessageComposer());
flatCtrl = RoomRightLevels.MODERATOR;
} else if (this.hasRights(habbo) && !this.room.getRoomInfo().hasGuild()) {
flatCtrl = RoomRightLevels.RIGHTS;
} else if (this.room.getRoomInfo().hasGuild()) {
flatCtrl = this.room.getGuildRightLevel(habbo);
}
habbo.getClient().sendResponse(new YouAreControllerMessageComposer(flatCtrl));
habbo.getRoomUnit().setStatus(RoomUnitStatus.FLAT_CONTROL, String.valueOf(flatCtrl.getLevel()));
habbo.getRoomUnit().setRightsLevel(flatCtrl);
if (flatCtrl.equals(RoomRightLevels.MODERATOR)) {
habbo.getClient().sendResponse(new FlatControllersComposer(this.room));
}
}
}

View File

@ -14,13 +14,15 @@ import java.util.concurrent.ConcurrentHashMap;
@Slf4j
@Getter
public class RoomWiredManager {
private final Room room;
private final ConcurrentHashMap<Integer, InteractionWired> currentWireds;
private final ConcurrentHashMap<WiredTriggerType, Set<InteractionWiredTrigger>> currentWiredTriggers;
private final ConcurrentHashMap<WiredEffectType, Set<InteractionWiredEffect>> currentWiredEffects;
private final ConcurrentHashMap<WiredConditionType, Set<InteractionWiredCondition>> currentWiredConditions;
private final ConcurrentHashMap<Integer, InteractionWiredExtra> currentWiredExtras;
public RoomWiredManager() {
public RoomWiredManager(Room room) {
this.room = room;
this.currentWireds = new ConcurrentHashMap<>(0);
this.currentWiredTriggers = new ConcurrentHashMap<>(0);
this.currentWiredEffects = new ConcurrentHashMap<>(0);
@ -113,6 +115,19 @@ public class RoomWiredManager {
currentWiredExtras.remove(extra.getId());
}
public void setHideWired(boolean hideWired) {
//TODO FIX THIS
// this.room.getRoomInfo().setHiddenWiredEnabled(hideWired);
//
// if (this.room.getRoomInfo().isHiddenWiredEnabled()) {
// for (RoomItem item : this.currentWireds.values()) {
// this.room.sendComposer(new RemoveFloorItemComposer(item).compose());
// }
// } else {
// this.room.sendComposer(new ObjectsMessageComposer(this.room.getFurniOwnerNames(), this.currentWireds).compose());
// }
}
public void clear() {
this.currentWireds.clear();
this.currentWiredTriggers.clear();

View File

@ -264,6 +264,11 @@ public abstract class RoomUnit extends RoomEntity {
}
}
public void setRightsLevel(RoomRightLevels rightsLevel) {
this.rightsLevel = rightsLevel;
this.statusUpdateNeeded = true;
}
public boolean hasStatus(RoomUnitStatus key) {
return this.statuses.containsKey(key);
}

View File

@ -32,7 +32,7 @@ public class AddAdminRightsToMemberEvent extends MessageHandler {
Room room = habbo.getRoomUnit().getRoom();
if (room != null) {
if (room.getRoomInfo().getGuild().getId() == guildId) {
room.refreshRightsForHabbo(habbo);
room.getRoomRightsManager().refreshRightsForHabbo(habbo);
}
}
}

View File

@ -59,7 +59,7 @@ public class ApproveMembershipRequestEvent extends MessageHandler {
if (habbo != null && userInfo.isOnline() && habbo.getRoomUnit().getRoom() != null) {
if (habbo.getRoomUnit().getRoom().getRoomInfo().getGuild().getId() == guildId) {
habbo.getClient().sendResponse(new HabboGroupDetailsMessageComposer(guild, habbo.getClient(), false, Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, userId)));
habbo.getRoomUnit().getRoom().refreshRightsForHabbo(habbo);
habbo.getRoomUnit().getRoom().getRoomRightsManager().refreshRightsForHabbo(habbo);
}
}
}

View File

@ -63,7 +63,7 @@ public class CreateGuildEvent extends GuildBadgeEvent {
Guild guild = Emulator.getGameEnvironment().getGuildManager().createGuild(this.client.getHabbo(), roomId, r.getRoomInfo().getName(), name, description, badge.toString(), colorOne, colorTwo);
r.getRoomInfo().setGuild(guild);
r.removeAllRights();
r.getRoomRightsManager().removeAllRights(); //TODO Check if this is needed
r.setNeedsUpdate(true);
if (Emulator.getConfig().getBoolean("imager.internal.enabled")) {

View File

@ -34,6 +34,6 @@ public class JoinHabboGroupEvent extends MessageHandler {
if (room == null || room.getRoomInfo().getGuild().getId() != guildId)
return;
room.refreshRightsForHabbo(this.client.getHabbo());
room.getRoomRightsManager().refreshRightsForHabbo(this.client.getHabbo());
}
}

View File

@ -49,7 +49,7 @@ public class KickMemberEvent extends MessageHandler {
if (habbo.getRoomUnit().getRoom() != null && habbo.getRoomUnit() != null)
habbo.getRoomUnit().getRoom().sendComposer(new FavoriteMembershipUpdateMessageComposer(habbo.getRoomUnit(), null).compose());
if (habbo.getRoomUnit().getRoom() == room)
room.refreshRightsForHabbo(habbo);
room.getRoomRightsManager().refreshRightsForHabbo(habbo);
}
habbo.getClient().sendResponse(new HabboGroupDetailsMessageComposer(guild, habbo.getClient(), false, null));

View File

@ -36,7 +36,8 @@ public class RemoveAdminRightsFromMemberEvent extends MessageHandler {
if (habbo != null) {
habbo.getClient().sendResponse(new HabboGroupDetailsMessageComposer(guild, this.client, false, Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild.getId(), userId)));
if (room != null && habbo.getRoomUnit().getRoom() != null && habbo.getRoomUnit().getRoom() == room) room.refreshRightsForHabbo(habbo);
if (room != null && habbo.getRoomUnit().getRoom() != null && habbo.getRoomUnit().getRoom() == room)
room.getRoomRightsManager().refreshRightsForHabbo(habbo);
}
GuildMember guildMember = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, userId);

View File

@ -39,7 +39,7 @@ public class DeleteRoomEvent extends MessageHandler {
return;
}
room.ejectAll();
room.ejectAllFurni();
room.ejectUserFurni(room.getRoomInfo().getOwnerInfo().getId());
List<Bot> bots = new ArrayList<>(room.getRoomUnitManager().getCurrentRoomBots().values());

View File

@ -11,7 +11,7 @@ public class GetCustomRoomFilterEvent extends MessageHandler {
public void handle() {
Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(this.packet.readInt());
if (room != null && room.hasRights(this.client.getHabbo())) {
if (room != null && room.getRoomRightsManager().hasRights(this.client.getHabbo())) {
this.client.sendResponse(new RoomFilterSettingsMessageComposer(room));
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("SelfModRoomFilterSeen"));

View File

@ -10,7 +10,7 @@ import com.eu.habbo.messages.outgoing.rooms.FlatAccessibleMessageComposer;
public class LetUserInEvent extends MessageHandler {
@Override
public void handle() {
if (this.client.getHabbo().getRoomUnit().getRoom() != null && this.client.getHabbo().getRoomUnit().getRoom().hasRights(this.client.getHabbo())) {
if (this.client.getHabbo().getRoomUnit().getRoom() != null && this.client.getHabbo().getRoomUnit().getRoom().getRoomRightsManager().hasRights(this.client.getHabbo())) {
String username = this.packet.readString();
boolean accepted = this.packet.readBoolean();

View File

@ -18,7 +18,7 @@ public class RemoveAllRightsEvent extends MessageHandler {
return;
if (room.getRoomInfo().getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
room.getRights().forEach(value -> {
room.getRoomRightsManager().getRights().forEach(value -> {
Habbo habbo = room.getRoomUnitManager().getRoomHabboById(value);
if (habbo != null) {
@ -26,11 +26,9 @@ public class RemoveAllRightsEvent extends MessageHandler {
habbo.getRoomUnit().removeStatus(RoomUnitStatus.FLAT_CONTROL);
habbo.getClient().sendResponse(new YouAreControllerMessageComposer(RoomRightLevels.NONE));
}
return true;
});
room.removeAllRights();
room.getRoomRightsManager().removeAllRights();
}
}
}

View File

@ -1,6 +1,7 @@
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;
public class RemoveOwnRoomRightsRoomEvent extends MessageHandler {
@ -8,6 +9,7 @@ public class RemoveOwnRoomRightsRoomEvent extends MessageHandler {
public void handle() {
int roomId = this.packet.readInt();
Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(roomId).removeRights(this.client.getHabbo().getHabboInfo().getId());
Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(roomId);
room.getRoomRightsManager().removeRights(this.client.getHabbo().getHabboInfo().getId());
}
}

View File

@ -17,7 +17,7 @@ public class RequestRoomPropertySet extends MessageHandler {
Room room = this.client.getHabbo().getRoomUnit().getRoom();
if (room.getRoomInfo().getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() || room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasRight(Permission.ACC_PLACEFURNI)) {
if (room.getRoomInfo().getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() || room.getRoomRightsManager().hasRights(this.client.getHabbo()) || this.client.getHabbo().hasRight(Permission.ACC_PLACEFURNI)) {
int itemId = this.packet.readInt();
RoomItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(itemId);

View File

@ -16,7 +16,7 @@ public class SetRoomBackgroundColorDataEvent extends MessageHandler {
if (room == null)
return;
if (room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasRight(Permission.ACC_PLACEFURNI)) {
if (room.getRoomRightsManager().hasRights(this.client.getHabbo()) || this.client.getHabbo().hasRight(Permission.ACC_PLACEFURNI)) {
RoomItem item = room.getHabboItem(itemId);
if (item == null)

View File

@ -26,8 +26,7 @@ public class CustomizeAvatarWithFurniEvent extends MessageHandler {
public void handle() {
int itemId = this.packet.readInt();
if (this.client.getHabbo().getRoomUnit().getRoom() != null &&
this.client.getHabbo().getRoomUnit().getRoom().hasRights(this.client.getHabbo())) {
if (this.client.getHabbo().getRoomUnit().getRoom() != null && this.client.getHabbo().getRoomUnit().getRoom().getRoomRightsManager().hasRights(this.client.getHabbo())) {
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
if (item != null && item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) {

View File

@ -17,7 +17,7 @@ public class MoveWallItemEvent extends MessageHandler {
if (room == null)
return;
if (!room.hasRights(this.client.getHabbo()) && !this.client.getHabbo().hasRight(Permission.ACC_PLACEFURNI)) {
if (!room.getRoomRightsManager().hasRights(this.client.getHabbo()) && !this.client.getHabbo().hasRight(Permission.ACC_PLACEFURNI)) {
if (!(room.getRoomInfo().getGuild().getId() > 0 && room.getGuildRightLevel(this.client.getHabbo()).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS))) {
this.client.sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.getKey(), FurnitureMovementError.NO_RIGHTS.getErrorCode()));
return;

View File

@ -27,7 +27,7 @@ public class PickupObjectEvent extends MessageHandler {
if (item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) {
room.getRoomItemManager().pickUpItem(item, this.client.getHabbo());
} else {
if (room.hasRights(this.client.getHabbo())) {
if (room.getRoomRightsManager().hasRights(this.client.getHabbo())) {
if (this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
item.setOwnerId(this.client.getHabbo().getHabboInfo().getId());
} else {

View File

@ -75,7 +75,7 @@ public class PlaceObjectEvent extends MessageHandler {
rentSpace = room.getHabboItem(this.client.getHabbo().getHabboStats().getRentedItemId());
}
if ((rentSpace != null || buildArea != null) && !room.hasRights(this.client.getHabbo())) {
if ((rentSpace != null || buildArea != null) && !room.getRoomRightsManager().hasRights(this.client.getHabbo())) {
if (item instanceof InteractionRoller ||
item instanceof InteractionStackHelper ||
item instanceof InteractionWired ||

View File

@ -22,7 +22,7 @@ public class PlacePostItEvent extends MessageHandler {
Room room = this.client.getHabbo().getRoomUnit().getRoom();
if (room != null) {
if (room.hasRights(this.client.getHabbo()) || !room.getRoomSpecialTypes().getItemsOfType(InteractionStickyPole.class).isEmpty()) {
if (room.getRoomRightsManager().hasRights(this.client.getHabbo()) || !room.getRoomSpecialTypes().getItemsOfType(InteractionStickyPole.class).isEmpty()) {
RoomItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(itemId);
if (item instanceof InteractionPostIt) {

View File

@ -14,7 +14,7 @@ public class RoomDimmerChangeStateEvent extends MessageHandler {
public void handle() {
Room room = this.client.getHabbo().getRoomUnit().getRoom();
if ((room.getRoomInfo().getGuild().getId() > 0 && room.getGuildRightLevel(this.client.getHabbo()).isLessThan(RoomRightLevels.GUILD_RIGHTS)) && !room.hasRights(this.client.getHabbo()))
if ((room.getRoomInfo().getGuild().getId() > 0 && room.getGuildRightLevel(this.client.getHabbo()).isLessThan(RoomRightLevels.GUILD_RIGHTS)) && !room.getRoomRightsManager().hasRights(this.client.getHabbo()))
return;
for (RoomItem moodLight : room.getRoomSpecialTypes().getItemsOfType(InteractionMoodLight.class)) {

View File

@ -22,7 +22,7 @@ public class RoomDimmerSavePresetEvent extends MessageHandler {
public void handle() {
Room room = this.client.getHabbo().getRoomUnit().getRoom();
if ((room.getRoomInfo().getGuild().getId() <= 0 && room.getGuildRightLevel(this.client.getHabbo()).isLessThan(RoomRightLevels.GUILD_RIGHTS)) && !room.hasRights(this.client.getHabbo()))
if ((room.getRoomInfo().getGuild().getId() <= 0 && room.getGuildRightLevel(this.client.getHabbo()).isLessThan(RoomRightLevels.GUILD_RIGHTS)) && !room.getRoomRightsManager().hasRights(this.client.getHabbo()))
return;
int id = this.packet.readInt();

View File

@ -17,7 +17,7 @@ public class SetCustomStackingHeightEvent extends MessageHandler {
if (this.client.getHabbo().getRoomUnit().getRoom() == null)
return;
if (this.client.getHabbo().getHabboInfo().getId() == this.client.getHabbo().getRoomUnit().getRoom().getRoomInfo().getOwnerInfo().getId() || this.client.getHabbo().getRoomUnit().getRoom().hasRights(this.client.getHabbo())) {
if (this.client.getHabbo().getHabboInfo().getId() == this.client.getHabbo().getRoomUnit().getRoom().getRoomInfo().getOwnerInfo().getId() || this.client.getHabbo().getRoomUnit().getRoom().getRoomRightsManager().hasRights(this.client.getHabbo())) {
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
if (item instanceof InteractionStackHelper) {

View File

@ -39,12 +39,12 @@ public class SetItemDataEvent extends MessageHandler {
if (!(item instanceof InteractionPostIt))
return;
if (!color.equalsIgnoreCase(PostItColor.YELLOW.hexColor) && !room.hasRights(this.client.getHabbo())) {
if (!color.equalsIgnoreCase(PostItColor.YELLOW.hexColor) && !room.getRoomRightsManager().hasRights(this.client.getHabbo())) {
if (!text.startsWith(item.getExtradata().replace(item.getExtradata().split(" ")[0], ""))) {
return;
}
} else {
if (!room.hasRights(this.client.getHabbo()))
if (!room.getRoomRightsManager().hasRights(this.client.getHabbo()))
return;
}

View File

@ -16,7 +16,7 @@ public class SetObjectDataEvent extends MessageHandler {
if (room == null)
return;
if (!room.hasRights(this.client.getHabbo()))
if (!room.getRoomRightsManager().hasRights(this.client.getHabbo()))
return;
RoomItem item = room.getHabboItem(this.packet.readInt());

View File

@ -8,7 +8,7 @@ import com.eu.habbo.messages.incoming.MessageHandler;
public class AddJukeboxDiskEvent extends MessageHandler {
@Override
public void handle() {
if (!this.client.getHabbo().getRoomUnit().getRoom().hasRights(this.client.getHabbo())) return;
if (!this.client.getHabbo().getRoomUnit().getRoom().getRoomRightsManager().hasRights(this.client.getHabbo())) return;
int itemId = this.packet.readInt();
int slotId = this.packet.readInt();

View File

@ -15,7 +15,7 @@ public class MovePetEvent extends MessageHandler {
if (pet != null) {
Room room = this.client.getHabbo().getRoomUnit().getRoom();
if (room != null && room.hasRights(this.client.getHabbo())) {
if (room != null && room.getRoomRightsManager().hasRights(this.client.getHabbo())) {
if (pet.getRoomUnit() != null) {
int x = this.packet.readInt();
int y = this.packet.readInt();

View File

@ -38,7 +38,7 @@ public class PurchaseRoomAdEvent extends MessageHandler {
if (this.client.getHabbo().getHabboInfo().canBuy(item)) {
Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(roomId);
if (!(room.getRoomInfo().isRoomOwner(this.client.getHabbo()) || room.hasRights(this.client.getHabbo()) || room.getGuildRightLevel(this.client.getHabbo()).equals(RoomRightLevels.GUILD_ADMIN))) {
if (!(room.getRoomInfo().isRoomOwner(this.client.getHabbo()) || room.getRoomRightsManager().hasRights(this.client.getHabbo()) || room.getGuildRightLevel(this.client.getHabbo()).equals(RoomRightLevels.GUILD_ADMIN))) {
return;
}

View File

@ -11,25 +11,26 @@ import com.eu.habbo.plugin.events.users.UserRightsGivenEvent;
public class AssignRightsEvent extends MessageHandler {
@Override
public void handle() {
int userId = this.packet.readInt();
int targetId = this.packet.readInt();
Room room = this.client.getHabbo().getRoomUnit().getRoom();
if (room == null)
if (room == null) {
return;
}
if (room.getRoomInfo().getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
Habbo target = room.getRoomUnitManager().getRoomHabboById(userId);
if (room.getRoomInfo().isRoomOwner(this.client.getHabbo()) || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
Habbo target = room.getRoomUnitManager().getRoomHabboById(targetId);
if (target != null) {
if (!Emulator.getPluginManager().fireEvent(new UserRightsGivenEvent(this.client.getHabbo(), target)).isCancelled()) {
room.giveRights(target);
room.getRoomRightsManager().giveRights(target);
}
} else {
MessengerBuddy buddy = this.client.getHabbo().getMessenger().getFriend(userId);
MessengerBuddy buddy = this.client.getHabbo().getMessenger().getFriend(targetId);
if (buddy != null) {
room.giveRights(userId);
room.getRoomRightsManager().giveRights(buddy);
}
}
}

View File

@ -18,7 +18,7 @@ public class RemoveRightsEvent extends MessageHandler {
for (int i = 0; i < amount; i++) {
int userId = this.packet.readInt();
room.removeRights(userId);
room.getRoomRightsManager().removeRights(userId);
}
}
}

View File

@ -41,7 +41,7 @@ public class RoomUserKickEvent extends MessageHandler {
if (event.isCancelled())
return;
if (room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasRight(Permission.ACC_AMBASSADOR)) {
if (room.getRoomRightsManager().hasRights(this.client.getHabbo()) || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasRight(Permission.ACC_AMBASSADOR)) {
if (target.hasRight(Permission.ACC_UNKICKABLE)) return;
room.kickHabbo(target, true);

View File

@ -18,7 +18,7 @@ public class RoomUserMuteEvent extends MessageHandler {
Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(roomId);
if (room != null) {
if (room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasCommand("cmd_mute") || this.client.getHabbo().hasRight(Permission.ACC_AMBASSADOR)) {
if (room.getRoomRightsManager().hasRights(this.client.getHabbo()) || this.client.getHabbo().hasCommand("cmd_mute") || this.client.getHabbo().hasRight(Permission.ACC_AMBASSADOR)) {
Habbo habbo = room.getRoomUnitManager().getRoomHabboById(userId);
if (habbo != null) {

View File

@ -38,7 +38,7 @@ public class ApplySnapshotEvent extends MessageHandler {
Room room = this.client.getHabbo().getRoomUnit().getRoom();
// Executing Habbo should be able to edit wireds
if (room == null || (!room.hasRights(this.client.getHabbo()) && !room.getRoomInfo().isRoomOwner(this.client.getHabbo()))) {
if (room == null || (!room.getRoomRightsManager().hasRights(this.client.getHabbo()) && !room.getRoomInfo().isRoomOwner(this.client.getHabbo()))) {
return;
}

View File

@ -16,7 +16,7 @@ public class UpdateActionEvent extends MessageHandler {
Room room = this.client.getHabbo().getRoomUnit().getRoom();
if (room != null) {
if (room.hasRights(this.client.getHabbo()) || room.getRoomInfo().getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasRight(Permission.ACC_MOVEROTATE)) {
if (room.getRoomRightsManager().hasRights(this.client.getHabbo()) || room.getRoomInfo().getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasRight(Permission.ACC_MOVEROTATE)) {
//TODO Check SUPER WIRED PERMISSIONS TOO
InteractionWiredEffect effect = room.getRoomSpecialTypes().getEffect(itemId);

View File

@ -16,7 +16,7 @@ public class UpdateConditionEvent extends MessageHandler {
Room room = this.client.getHabbo().getRoomUnit().getRoom();
if (room != null) {
if (room.hasRights(this.client.getHabbo()) || room.getRoomInfo().getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasRight(Permission.ACC_MOVEROTATE)) {
if (room.getRoomRightsManager().hasRights(this.client.getHabbo()) || room.getRoomInfo().getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasRight(Permission.ACC_MOVEROTATE)) {
InteractionWiredCondition condition = room.getRoomSpecialTypes().getCondition(itemId);
try {

View File

@ -16,7 +16,7 @@ public class UpdateTriggerEvent extends MessageHandler {
Room room = this.client.getHabbo().getRoomUnit().getRoom();
if (room != null) {
if (room.hasRights(this.client.getHabbo()) || room.getRoomInfo().getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasRight(Permission.ACC_MOVEROTATE)) {
if (room.getRoomRightsManager().hasRights(this.client.getHabbo()) || room.getRoomInfo().getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasRight(Permission.ACC_MOVEROTATE)) {
InteractionWiredTrigger trigger = room.getRoomSpecialTypes().getTrigger(itemId);
try {

View File

@ -4,9 +4,9 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.MessageComposer;
import com.eu.habbo.messages.outgoing.Outgoing;
import gnu.trove.map.hash.THashMap;
import lombok.AllArgsConstructor;
import java.util.HashMap;
import java.util.Map;
@AllArgsConstructor
@ -18,7 +18,7 @@ public class FlatControllersComposer extends MessageComposer {
this.response.init(Outgoing.flatControllersComposer);
this.response.appendInt(this.room.getRoomInfo().getId());
THashMap<Integer, String> rightsMap = this.room.getUsersWithRights();
HashMap<Integer, String> rightsMap = this.room.getRoomRightsManager().getUsersWithRights();
this.response.appendInt(rightsMap.size());

View File

@ -37,7 +37,7 @@ public class GetGuestRoomResultComposer extends MessageComposer {
this.response.appendInt(this.room.getRoomInfo().getWhoCanKickOption());
this.response.appendInt(this.room.getRoomInfo().getWhoCanBanOption());
this.response.appendBoolean(this.room.hasRights(this.habbo)); //mute all button
this.response.appendBoolean(this.room.getRoomRightsManager().hasRights(this.habbo)); //mute all button
this.response.appendInt(this.room.getRoomInfo().getChatMode());
this.response.appendInt(this.room.getRoomInfo().getChatWeight());