mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-30 01:50:50 +01:00
Room.java clean-up
This commit is contained in:
parent
4c5b362b87
commit
2eec0dc0ba
@ -88,7 +88,7 @@ public class CommandsManager {
|
|||||||
String commandKey = parts[0];
|
String commandKey = parts[0];
|
||||||
Room currentRoom = gameClient.getHabbo().getRoomUnit().getRoom();
|
Room currentRoom = gameClient.getHabbo().getRoomUnit().getRoom();
|
||||||
boolean hasRights = currentRoom != null &&
|
boolean hasRights = currentRoom != null &&
|
||||||
(currentRoom.hasRights(gameClient.getHabbo())) ||
|
(currentRoom.getRoomRightsManager().hasRights(gameClient.getHabbo())) ||
|
||||||
gameClient.getHabbo().hasRight(Permission.ACC_PLACEFURNI) ||
|
gameClient.getHabbo().hasRight(Permission.ACC_PLACEFURNI) ||
|
||||||
currentRoom.getRoomInfo().getGuild().getId() > 0 && currentRoom.getGuildRightLevel(gameClient.getHabbo()).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS);
|
currentRoom.getRoomInfo().getGuild().getId() > 0 && currentRoom.getGuildRightLevel(gameClient.getHabbo()).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS);
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ public class BotsCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
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;
|
return false;
|
||||||
|
|
||||||
StringBuilder data = new StringBuilder(getTextsValue("total") + ": " + gameClient.getHabbo().getRoomUnit().getRoom().getRoomUnitManager().getCurrentRoomBots().values().size());
|
StringBuilder data = new StringBuilder(getTextsValue("total") + ": " + gameClient.getHabbo().getRoomUnit().getRoom().getRoomUnitManager().getCurrentRoomBots().values().size());
|
||||||
|
@ -11,7 +11,7 @@ public class DiagonalCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
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());
|
gameClient.getHabbo().getRoomUnit().getRoom().setDiagonalMoveEnabled(!gameClient.getHabbo().getRoomUnit().getRoom().getRoomInfo().isDiagonalMoveEnabled());
|
||||||
|
|
||||||
if (!gameClient.getHabbo().getRoomUnit().getRoom().getRoomInfo().isDiagonalMoveEnabled()) {
|
if (!gameClient.getHabbo().getRoomUnit().getRoom().getRoomInfo().isDiagonalMoveEnabled()) {
|
||||||
|
@ -17,7 +17,7 @@ public class EjectAllCommand extends Command {
|
|||||||
if (room != null) {
|
if (room != null) {
|
||||||
if (room.getRoomInfo().isRoomOwner(gameClient.getHabbo())
|
if (room.getRoomInfo().isRoomOwner(gameClient.getHabbo())
|
||||||
|| (room.getRoomInfo().hasGuild() && room.getGuildRightLevel(gameClient.getHabbo()).equals(RoomRightLevels.GUILD_ADMIN))) {
|
|| (room.getRoomInfo().hasGuild() && room.getGuildRightLevel(gameClient.getHabbo()).equals(RoomRightLevels.GUILD_ADMIN))) {
|
||||||
room.ejectAll(gameClient.getHabbo());
|
room.ejectAllFurni(gameClient.getHabbo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public class HideWiredCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (room.getRoomInfo().isRoomOwner(gameClient.getHabbo())) {
|
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")));
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_hidewired." + (room.getRoomInfo().isHiddenWiredEnabled() ? "hidden" : "shown")));
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(getTextsValue("commands.errors.cmd_hidewired.permission"));
|
gameClient.getHabbo().whisper(getTextsValue("commands.errors.cmd_hidewired.permission"));
|
||||||
|
@ -18,7 +18,7 @@ public class PickallCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (room.getRoomInfo().isRoomOwner(gameClient.getHabbo())) {
|
if (room.getRoomInfo().isRoomOwner(gameClient.getHabbo())) {
|
||||||
room.ejectAll();
|
room.ejectAllFurni();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ public class SetSpeedCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
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();
|
Room room = gameClient.getHabbo().getRoomUnit().getRoom();
|
||||||
|
|
||||||
int oldSpeed = room.getRoomInfo().getRollerSpeed();
|
int oldSpeed = room.getRoomInfo().getRollerSpeed();
|
||||||
|
@ -61,7 +61,7 @@ public class InteractionBackgroundToner extends RoomItem {
|
|||||||
|
|
||||||
if(client != null)
|
if(client != null)
|
||||||
{
|
{
|
||||||
if (!client.getHabbo().getRoomUnit().getRoom().hasRights(client.getHabbo())) {
|
if (!client.getHabbo().getRoomUnit().getRoom().getRoomRightsManager().hasRights(client.getHabbo())) {
|
||||||
ScripterManager.scripterDetected(
|
ScripterManager.scripterDetected(
|
||||||
client,
|
client,
|
||||||
Emulator.getTexts().getValue("scripter.warning.item.bgtoner.permission").replace("%username%", client.getHabbo().getHabboInfo().getUsername())
|
Emulator.getTexts().getValue("scripter.warning.item.bgtoner.permission").replace("%username%", client.getHabbo().getHabboInfo().getUsername())
|
||||||
|
@ -4,8 +4,8 @@ import com.eu.habbo.Emulator;
|
|||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
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.items.RoomItem;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.items.ItemUpdateMessageComposer;
|
import com.eu.habbo.messages.outgoing.rooms.items.ItemUpdateMessageComposer;
|
||||||
import com.eu.habbo.threading.runnables.RandomDiceNumber;
|
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 {
|
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
|
||||||
super.onClick(client, room, objects);
|
super.onClick(client, room, objects);
|
||||||
|
|
||||||
if (!room.hasRights(client.getHabbo()))
|
if (!room.getRoomRightsManager().hasRights(client.getHabbo()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this.rollTaks == null && !this.getExtradata().equalsIgnoreCase("-1")) {
|
if (this.rollTaks == null && !this.getExtradata().equalsIgnoreCase("-1")) {
|
||||||
|
@ -215,7 +215,7 @@ public class InteractionDefault extends RoomItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canToggle(Habbo habbo, Room room) {
|
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;
|
if (!habbo.getHabboStats().isRentingSpace()) return false;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ public class InteractionEffectToggle extends InteractionDefault {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
if (room.hasRights(client.getHabbo())) {
|
if (room.getRoomRightsManager().hasRights(client.getHabbo())) {
|
||||||
if (Integer.parseInt(this.getExtradata()) < this.getBaseItem().getStateCount() - 1) {
|
if (Integer.parseInt(this.getExtradata()) < this.getBaseItem().getStateCount() - 1) {
|
||||||
if ((client.getHabbo().getHabboInfo().getGender() == HabboGender.M && client.getHabbo().getRoomUnit().getEffectId() == this.getBaseItem().getEffectM()) ||
|
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())) {
|
(client.getHabbo().getHabboInfo().getGender() == HabboGender.F && client.getHabbo().getRoomUnit().getEffectId() == this.getBaseItem().getEffectF())) {
|
||||||
|
@ -115,7 +115,7 @@ public class InteractionFireworks extends InteractionDefault {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canToggle(Habbo habbo, Room room) {
|
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()),
|
room.getLayout().getTile(this.getX(), this.getY()),
|
||||||
habbo.getRoomUnit().getCurrentPosition()
|
habbo.getRoomUnit().getCurrentPosition()
|
||||||
);
|
);
|
||||||
|
@ -41,8 +41,7 @@ public class InteractionGate extends RoomItem {
|
|||||||
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
|
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);
|
boolean executedByWired = (objects.length >= 2 && objects[1] instanceof WiredEffectType && objects[1] == WiredEffectType.TOGGLE_STATE);
|
||||||
|
|
||||||
if (client != null && !room.hasRights(client.getHabbo()) && !executedByWired)
|
if (client != null && !room.getRoomRightsManager().hasRights(client.getHabbo()) && !executedByWired) return;
|
||||||
return;
|
|
||||||
|
|
||||||
// If a Habbo is standing on a tile occupied by the gate, the gate shouldn't open/close
|
// 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()))
|
for (RoomTile tile : room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()))
|
||||||
|
@ -49,7 +49,7 @@ public class InteractionMultiHeight extends RoomItem {
|
|||||||
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
|
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
|
||||||
super.onClick(client, room, objects);
|
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;
|
return;
|
||||||
|
|
||||||
if (objects.length <= 0) {
|
if (objects.length <= 0) {
|
||||||
|
@ -48,7 +48,7 @@ public class InteractionMuteArea extends InteractionCustomValues {
|
|||||||
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
|
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
|
||||||
super.onClick(client, room, objects);
|
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");
|
this.values.put("state", this.values.get("state").equals("0") ? "1" : "0");
|
||||||
room.sendComposer(new ObjectDataUpdateMessageComposer(this).compose());
|
room.sendComposer(new ObjectDataUpdateMessageComposer(this).compose());
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@ package com.eu.habbo.habbohotel.items.interactions;
|
|||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
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.items.RoomItem;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ public class InteractionVoteCounter extends RoomItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(GameClient client, Room room, Object[] objects) {
|
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;
|
return;
|
||||||
|
|
||||||
this.frozen = !this.frozen;
|
this.frozen = !this.frozen;
|
||||||
|
@ -79,7 +79,7 @@ public abstract class InteractionWired extends InteractionDefault implements IWi
|
|||||||
this.wiredSettings.getItems(room);
|
this.wiredSettings.getItems(room);
|
||||||
|
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
if (room.hasRights(client.getHabbo())) {
|
if (room.getRoomRightsManager().hasRights(client.getHabbo())) {
|
||||||
MessageComposer composer = null;
|
MessageComposer composer = null;
|
||||||
if(this instanceof InteractionWiredEffect) {
|
if(this instanceof InteractionWiredEffect) {
|
||||||
composer = new WiredEffectDataComposer((InteractionWiredEffect) this, room);
|
composer = new WiredEffectDataComposer((InteractionWiredEffect) this, room);
|
||||||
|
@ -20,7 +20,7 @@ public abstract class InteractionWiredExtra extends InteractionWired {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(GameClient client, Room room, Object[] objects) {
|
public void onClick(GameClient client, Room room, Object[] objects) {
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
if (room.hasRights(client.getHabbo())) {
|
if (room.getRoomRightsManager().hasRights(client.getHabbo())) {
|
||||||
this.activateBox(room);
|
this.activateBox(room);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@ import com.eu.habbo.Emulator;
|
|||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
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.items.RoomItem;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||||
@ -81,7 +81,7 @@ public class InteractionWiredHighscore extends RoomItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(GameClient client, Room room, Object[] objects) {
|
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;
|
return;
|
||||||
|
|
||||||
if (this.getExtradata() == null || this.getExtradata().isEmpty() || this.getExtradata().length() == 0) {
|
if (this.getExtradata() == null || this.getExtradata().isEmpty() || this.getExtradata().length() == 0) {
|
||||||
|
@ -8,8 +8,8 @@ import com.eu.habbo.habbohotel.games.wired.WiredGame;
|
|||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
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.items.RoomItem;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
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);
|
Emulator.getThreading().run(new GameTimer(this), 1000);
|
||||||
}
|
}
|
||||||
} else if (client != null) {
|
} 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;
|
return;
|
||||||
|
|
||||||
InteractionGameTimerAction state = InteractionGameTimerAction.START_STOP;
|
InteractionGameTimerAction state = InteractionGameTimerAction.START_STOP;
|
||||||
|
@ -74,7 +74,7 @@ public class InteractionTotemHead extends InteractionDefault {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(GameClient client, Room room, Object[] objects) {
|
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;
|
return;
|
||||||
|
|
||||||
TotemType newType = TotemType.fromInt(getTotemType().getType() + 1);
|
TotemType newType = TotemType.fromInt(getTotemType().getType() + 1);
|
||||||
|
@ -51,7 +51,7 @@ public class InteractionTotemLegs extends InteractionDefault {
|
|||||||
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
|
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
|
||||||
super.onClick(client, room, objects);
|
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;
|
return;
|
||||||
|
|
||||||
updateHead(room, room.getLayout().getTile(this.getX(), this.getY()));
|
updateHead(room, room.getLayout().getTile(this.getX(), this.getY()));
|
||||||
|
@ -36,7 +36,7 @@ public class WiredEffectMuteRoom extends InteractionWiredEffect {
|
|||||||
Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit);
|
Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit);
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
if (room.hasRights(habbo))
|
if (room.getRoomRightsManager().hasRights(habbo))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
room.muteHabbo(habbo, 60);
|
room.muteHabbo(habbo, 60);
|
||||||
|
@ -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.games.tag.InteractionTagPole;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.pets.*;
|
import com.eu.habbo.habbohotel.items.interactions.pets.*;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredBlob;
|
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.permissions.Permission;
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
import com.eu.habbo.habbohotel.pets.RideablePet;
|
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.inventory.UnseenItemsComposer;
|
||||||
import com.eu.habbo.messages.outgoing.polls.infobus.QuestionAnsweredComposer;
|
import com.eu.habbo.messages.outgoing.polls.infobus.QuestionAnsweredComposer;
|
||||||
import com.eu.habbo.messages.outgoing.polls.infobus.QuestionComposer;
|
import com.eu.habbo.messages.outgoing.polls.infobus.QuestionComposer;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.*;
|
import com.eu.habbo.messages.outgoing.rooms.FlatAccessDeniedMessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.items.*;
|
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.rooms.users.*;
|
||||||
import com.eu.habbo.messages.outgoing.users.RemainingMutePeriodComposer;
|
import com.eu.habbo.messages.outgoing.users.RemainingMutePeriodComposer;
|
||||||
import com.eu.habbo.plugin.Event;
|
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.RoomLoadedEvent;
|
||||||
import com.eu.habbo.plugin.events.rooms.RoomUnloadedEvent;
|
import com.eu.habbo.plugin.events.rooms.RoomUnloadedEvent;
|
||||||
import com.eu.habbo.plugin.events.rooms.RoomUnloadingEvent;
|
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 com.eu.habbo.threading.runnables.YouAreAPirate;
|
||||||
import gnu.trove.TCollections;
|
import gnu.trove.TCollections;
|
||||||
import gnu.trove.iterator.TIntObjectIterator;
|
import gnu.trove.iterator.TIntObjectIterator;
|
||||||
import gnu.trove.list.array.TIntArrayList;
|
|
||||||
import gnu.trove.map.TIntIntMap;
|
import gnu.trove.map.TIntIntMap;
|
||||||
import gnu.trove.map.TIntObjectMap;
|
import gnu.trove.map.TIntObjectMap;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
@ -96,6 +102,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
@Getter
|
@Getter
|
||||||
private final RoomItemManager roomItemManager;
|
private final RoomItemManager roomItemManager;
|
||||||
@Getter
|
@Getter
|
||||||
|
private final RoomRightsManager roomRightsManager;
|
||||||
|
@Getter
|
||||||
private TraxManager traxManager;
|
private TraxManager traxManager;
|
||||||
private static final String CAUGHT_EXCEPTION = "Caught exception";
|
private static final String CAUGHT_EXCEPTION = "Caught exception";
|
||||||
public static final Comparator<Room> SORT_SCORE = (o1, o2) -> o2.roomInfo.getScore() - o1.roomInfo.getScore();
|
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
|
@Getter
|
||||||
private final TIntObjectMap<Habbo> habboQueue = TCollections.synchronizedMap(new TIntObjectHashMap<>(0));
|
private final TIntObjectMap<Habbo> habboQueue = TCollections.synchronizedMap(new TIntObjectHashMap<>(0));
|
||||||
private final THashSet<RoomTrade> activeTrades;
|
private final THashSet<RoomTrade> activeTrades;
|
||||||
@Getter
|
|
||||||
private final TIntArrayList rights;
|
|
||||||
private final TIntIntHashMap mutedHabbos;
|
private final TIntIntHashMap mutedHabbos;
|
||||||
private final TIntObjectHashMap<RoomBan> bannedHabbos;
|
private final TIntObjectHashMap<RoomBan> bannedHabbos;
|
||||||
@Getter
|
@Getter
|
||||||
@ -184,6 +190,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
this.roomInfo = new RoomInfo(set);
|
this.roomInfo = new RoomInfo(set);
|
||||||
this.roomUnitManager = new RoomUnitManager(this);
|
this.roomUnitManager = new RoomUnitManager(this);
|
||||||
this.roomItemManager = new RoomItemManager(this);
|
this.roomItemManager = new RoomItemManager(this);
|
||||||
|
this.roomRightsManager = new RoomRightsManager(this);
|
||||||
|
|
||||||
this.layoutName = set.getString("model");
|
this.layoutName = set.getString("model");
|
||||||
this.bannedHabbos = new TIntObjectHashMap<>();
|
this.bannedHabbos = new TIntObjectHashMap<>();
|
||||||
@ -219,7 +226,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
this.games = new ConcurrentSet<>();
|
this.games = new ConcurrentSet<>();
|
||||||
|
|
||||||
this.activeTrades = new THashSet<>(0);
|
this.activeTrades = new THashSet<>(0);
|
||||||
this.rights = new TIntArrayList();
|
|
||||||
this.userVotes = new ArrayList<>();
|
this.userVotes = new ArrayList<>();
|
||||||
|
|
||||||
this.triggersOnRoom = new HashMap<>();
|
this.triggersOnRoom = new HashMap<>();
|
||||||
@ -238,7 +244,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
this.roomSpecialTypes = new RoomSpecialTypes();
|
this.roomSpecialTypes = new RoomSpecialTypes();
|
||||||
|
|
||||||
this.loadLayout();
|
this.loadLayout();
|
||||||
this.loadRights(connection);
|
this.roomRightsManager.load(connection);
|
||||||
|
|
||||||
//TODO Deprecated
|
//TODO Deprecated
|
||||||
this.loadItems(connection);
|
this.loadItems(connection);
|
||||||
@ -1791,7 +1797,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMuted(Habbo habbo) {
|
public boolean isMuted(Habbo habbo) {
|
||||||
if (this.getRoomInfo().isRoomOwner(habbo) || this.hasRights(habbo))
|
if (this.getRoomInfo().isRoomOwner(habbo) || this.roomRightsManager.hasRights(habbo))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (this.mutedHabbos.containsKey(habbo.getHabboInfo().getId())) {
|
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 (!habbo.hasRight(Permission.ACC_NOMUTE)) {
|
||||||
if (this.isMuted() && !this.hasRights(habbo)) {
|
if (this.isMuted() && !this.roomRightsManager.hasRights(habbo)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1935,7 +1941,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
if (chatCounter > 3) {
|
if (chatCounter > 3) {
|
||||||
final boolean floodRights = Emulator.getConfig().getBoolean("flood.with.rights");
|
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 (floodRights || !hasRights) {
|
||||||
if (this.roomInfo.getChatProtection() == 0 || (this.roomInfo.getChatProtection() == 1 && chatCounter > 4) || (this.roomInfo.getChatProtection() == 2 && chatCounter > 5)) {
|
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()) {
|
for (Habbo h : this.roomUnitManager.getRoomHabbos()) {
|
||||||
if ((h.getRoomUnit().getCurrentPosition().distance(habbo.getRoomUnit().getCurrentPosition()) <= this.roomInfo.getChatDistance() ||
|
if ((h.getRoomUnit().getCurrentPosition().distance(habbo.getRoomUnit().getCurrentPosition()) <= this.roomInfo.getChatDistance() ||
|
||||||
h.equals(habbo) ||
|
h.equals(habbo) ||
|
||||||
this.hasRights(h) ||
|
this.roomRightsManager.hasRights(h) ||
|
||||||
noChatLimit) && (tentRectangle == null || RoomLayout.tileInSquare(tentRectangle, h.getRoomUnit().getCurrentPosition()))) {
|
noChatLimit) && (tentRectangle == null || RoomLayout.tileInSquare(tentRectangle, h.getRoomUnit().getCurrentPosition()))) {
|
||||||
if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) {
|
if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) {
|
||||||
if (prefixMessage != null && !h.getHabboStats().isPreferOldChat()) {
|
if (prefixMessage != null && !h.getHabboStats().isPreferOldChat()) {
|
||||||
@ -2528,6 +2534,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void alert(String message) {
|
||||||
|
this.sendComposer(new HabboBroadcastMessageComposer(message).compose());
|
||||||
|
}
|
||||||
|
|
||||||
public void sendComposer(ServerMessage message) {
|
public void sendComposer(ServerMessage message) {
|
||||||
for (Habbo habbo : this.roomUnitManager.getRoomHabbos()) {
|
for (Habbo habbo : this.roomUnitManager.getRoomHabbos()) {
|
||||||
if (habbo.getClient() == null) continue;
|
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) {
|
private void loadBans(Connection connection) {
|
||||||
this.bannedHabbos.clear();
|
this.bannedHabbos.clear();
|
||||||
|
|
||||||
@ -2607,150 +2601,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
return RoomRightLevels.NONE;
|
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) {
|
public void unbanHabbo(int userId) {
|
||||||
RoomBan ban = this.bannedHabbos.remove(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()) {
|
for (Habbo habbo : this.roomUnitManager.getRoomHabbos()) {
|
||||||
if ((habbo.getRoomUnit().getRoom() == this && habbo.getHabboInfo().getId() != this.roomInfo.getOwnerInfo().getId())
|
if ((habbo.getRoomUnit().getRoom() == this && habbo.getHabboInfo().getId() != this.roomInfo.getOwnerInfo().getId())
|
||||||
&& (!(habbo.hasRight(Permission.ACC_ANYROOMOWNER) || habbo.hasRight(Permission.ACC_MOVEROTATE))))
|
&& (!(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) {
|
public boolean hasVotedInWordQuiz(Habbo habbo) {
|
||||||
return this.userVotes.contains(habbo.getHabboInfo().getId());
|
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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public class RoomItemManager {
|
|||||||
public RoomItemManager(Room room) {
|
public RoomItemManager(Room room) {
|
||||||
this.room = room;
|
this.room = room;
|
||||||
this.currentItems = new ConcurrentHashMap<>();
|
this.currentItems = new ConcurrentHashMap<>();
|
||||||
this.wiredManager = new RoomWiredManager();
|
this.wiredManager = new RoomWiredManager(room);
|
||||||
|
|
||||||
this.floorItems = new ConcurrentHashMap<>();
|
this.floorItems = new ConcurrentHashMap<>();
|
||||||
this.wallItems = new ConcurrentHashMap<>();
|
this.wallItems = new ConcurrentHashMap<>();
|
||||||
@ -236,7 +236,7 @@ public class RoomItemManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rotation %= 8;
|
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;
|
return FurnitureMovementError.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ public class RoomItemManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FurnitureMovementError placeWallFurniAt(RoomItem item, String wallPosition, Habbo owner) {
|
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;
|
return FurnitureMovementError.NO_RIGHTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,7 +497,7 @@ public class RoomManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//If room is full AND user doesn't have Permissions can't enter to room
|
//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));
|
habbo.getClient().sendResponse(new CantConnectMessageComposer(CantConnectMessageComposer.ROOM_ERROR_GUESTROOM_FULL));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -517,14 +517,14 @@ public class RoomManager {
|
|||||||
* If habbo has permissions open room
|
* If habbo has permissions open room
|
||||||
* If habbo has guild rights 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);
|
this.openRoom(habbo, room, spawnLocation);
|
||||||
} else if (room.getRoomInfo().getState() == RoomState.LOCKED) {
|
} else if (room.getRoomInfo().getState() == RoomState.LOCKED) {
|
||||||
boolean habbosWithRights = false;
|
boolean habbosWithRights = false;
|
||||||
|
|
||||||
synchronized (room.getRoomUnitManager().roomUnitLock) {
|
synchronized (room.getRoomUnitManager().roomUnitLock) {
|
||||||
for (Habbo current : room.getRoomUnitManager().getRoomHabbos()) {
|
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()));
|
current.getClient().sendResponse(new DoorbellMessageComposer(habbo.getHabboInfo().getUsername()));
|
||||||
habbosWithRights = true;
|
habbosWithRights = true;
|
||||||
}
|
}
|
||||||
@ -623,11 +623,11 @@ public class RoomManager {
|
|||||||
|
|
||||||
habbo.getClient().sendResponse(new RoomPropertyMessageComposer("landscape", room.getRoomInfo().getLandscapePaint()));
|
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)));
|
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()) {
|
if (room.isPromoted()) {
|
||||||
habbo.getClient().sendResponse(new RoomEventComposer(room, room.getPromotion()));
|
habbo.getClient().sendResponse(new RoomEventComposer(room, room.getPromotion()));
|
||||||
@ -657,7 +657,7 @@ public class RoomManager {
|
|||||||
roomHabbo.setRoom(room);
|
roomHabbo.setRoom(room);
|
||||||
roomHabbo.setLoadingRoom(null);
|
roomHabbo.setLoadingRoom(null);
|
||||||
|
|
||||||
room.refreshRightsForHabbo(habbo);
|
room.getRoomRightsManager().refreshRightsForHabbo(habbo);
|
||||||
|
|
||||||
if (habbo.getRoomUnit().isKicked() && !habbo.getRoomUnit().isCanWalk()) {
|
if (habbo.getRoomUnit().isKicked() && !habbo.getRoomUnit().isCanWalk()) {
|
||||||
habbo.getRoomUnit().setCanWalk(true);
|
habbo.getRoomUnit().setCanWalk(true);
|
||||||
@ -823,7 +823,7 @@ public class RoomManager {
|
|||||||
|
|
||||||
habbo.getClient().sendResponse(new HabboGroupBadgesMessageComposer(guildBadges));
|
habbo.getClient().sendResponse(new HabboGroupBadgesMessageComposer(guildBadges));
|
||||||
|
|
||||||
if ((room.hasRights(habbo)
|
if ((room.getRoomRightsManager().hasRights(habbo)
|
||||||
|| (room.getRoomInfo().hasGuild()
|
|| (room.getRoomInfo().hasGuild()
|
||||||
&& room.getGuildRightLevel(habbo).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS)))
|
&& room.getGuildRightLevel(habbo).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS)))
|
||||||
&& !room.getHabboQueue().isEmpty()) {
|
&& !room.getHabboQueue().isEmpty()) {
|
||||||
@ -1162,7 +1162,7 @@ public class RoomManager {
|
|||||||
if (room != null) {
|
if (room != null) {
|
||||||
if (room.getRoomInfo().getState() == RoomState.INVISIBLE) {
|
if (room.getRoomInfo().getState() == RoomState.INVISIBLE) {
|
||||||
room.loadData();
|
room.loadData();
|
||||||
if (!room.hasRights(habbo)) return true;
|
if (!room.getRoomRightsManager().hasRights(habbo)) return true;
|
||||||
}
|
}
|
||||||
rooms.add(room);
|
rooms.add(room);
|
||||||
}
|
}
|
||||||
@ -1226,7 +1226,7 @@ public class RoomManager {
|
|||||||
if (friend == null || friend.getHabboInfo() == null) continue;
|
if (friend == null || friend.getHabboInfo() == null) continue;
|
||||||
|
|
||||||
Room room = friend.getRoomUnit().getRoom();
|
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;
|
if (rooms.size() >= limit) break;
|
||||||
}
|
}
|
||||||
@ -1362,8 +1362,7 @@ public class RoomManager {
|
|||||||
if (room == null)
|
if (room == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (rights != null && !room.hasRights(rights))
|
if (rights != null && !room.getRoomRightsManager().hasRights(rights)) return;
|
||||||
return;
|
|
||||||
|
|
||||||
String name = "";
|
String name = "";
|
||||||
|
|
||||||
|
@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -14,13 +14,15 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Getter
|
@Getter
|
||||||
public class RoomWiredManager {
|
public class RoomWiredManager {
|
||||||
|
private final Room room;
|
||||||
private final ConcurrentHashMap<Integer, InteractionWired> currentWireds;
|
private final ConcurrentHashMap<Integer, InteractionWired> currentWireds;
|
||||||
private final ConcurrentHashMap<WiredTriggerType, Set<InteractionWiredTrigger>> currentWiredTriggers;
|
private final ConcurrentHashMap<WiredTriggerType, Set<InteractionWiredTrigger>> currentWiredTriggers;
|
||||||
private final ConcurrentHashMap<WiredEffectType, Set<InteractionWiredEffect>> currentWiredEffects;
|
private final ConcurrentHashMap<WiredEffectType, Set<InteractionWiredEffect>> currentWiredEffects;
|
||||||
private final ConcurrentHashMap<WiredConditionType, Set<InteractionWiredCondition>> currentWiredConditions;
|
private final ConcurrentHashMap<WiredConditionType, Set<InteractionWiredCondition>> currentWiredConditions;
|
||||||
private final ConcurrentHashMap<Integer, InteractionWiredExtra> currentWiredExtras;
|
private final ConcurrentHashMap<Integer, InteractionWiredExtra> currentWiredExtras;
|
||||||
|
|
||||||
public RoomWiredManager() {
|
public RoomWiredManager(Room room) {
|
||||||
|
this.room = room;
|
||||||
this.currentWireds = new ConcurrentHashMap<>(0);
|
this.currentWireds = new ConcurrentHashMap<>(0);
|
||||||
this.currentWiredTriggers = new ConcurrentHashMap<>(0);
|
this.currentWiredTriggers = new ConcurrentHashMap<>(0);
|
||||||
this.currentWiredEffects = new ConcurrentHashMap<>(0);
|
this.currentWiredEffects = new ConcurrentHashMap<>(0);
|
||||||
@ -113,6 +115,19 @@ public class RoomWiredManager {
|
|||||||
currentWiredExtras.remove(extra.getId());
|
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() {
|
public void clear() {
|
||||||
this.currentWireds.clear();
|
this.currentWireds.clear();
|
||||||
this.currentWiredTriggers.clear();
|
this.currentWiredTriggers.clear();
|
||||||
|
@ -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) {
|
public boolean hasStatus(RoomUnitStatus key) {
|
||||||
return this.statuses.containsKey(key);
|
return this.statuses.containsKey(key);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class AddAdminRightsToMemberEvent extends MessageHandler {
|
|||||||
Room room = habbo.getRoomUnit().getRoom();
|
Room room = habbo.getRoomUnit().getRoom();
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
if (room.getRoomInfo().getGuild().getId() == guildId) {
|
if (room.getRoomInfo().getGuild().getId() == guildId) {
|
||||||
room.refreshRightsForHabbo(habbo);
|
room.getRoomRightsManager().refreshRightsForHabbo(habbo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public class ApproveMembershipRequestEvent extends MessageHandler {
|
|||||||
if (habbo != null && userInfo.isOnline() && habbo.getRoomUnit().getRoom() != null) {
|
if (habbo != null && userInfo.isOnline() && habbo.getRoomUnit().getRoom() != null) {
|
||||||
if (habbo.getRoomUnit().getRoom().getRoomInfo().getGuild().getId() == guildId) {
|
if (habbo.getRoomUnit().getRoom().getRoomInfo().getGuild().getId() == guildId) {
|
||||||
habbo.getClient().sendResponse(new HabboGroupDetailsMessageComposer(guild, habbo.getClient(), false, Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, userId)));
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
Guild guild = Emulator.getGameEnvironment().getGuildManager().createGuild(this.client.getHabbo(), roomId, r.getRoomInfo().getName(), name, description, badge.toString(), colorOne, colorTwo);
|
||||||
|
|
||||||
r.getRoomInfo().setGuild(guild);
|
r.getRoomInfo().setGuild(guild);
|
||||||
r.removeAllRights();
|
r.getRoomRightsManager().removeAllRights(); //TODO Check if this is needed
|
||||||
r.setNeedsUpdate(true);
|
r.setNeedsUpdate(true);
|
||||||
|
|
||||||
if (Emulator.getConfig().getBoolean("imager.internal.enabled")) {
|
if (Emulator.getConfig().getBoolean("imager.internal.enabled")) {
|
||||||
|
@ -34,6 +34,6 @@ public class JoinHabboGroupEvent extends MessageHandler {
|
|||||||
if (room == null || room.getRoomInfo().getGuild().getId() != guildId)
|
if (room == null || room.getRoomInfo().getGuild().getId() != guildId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
room.refreshRightsForHabbo(this.client.getHabbo());
|
room.getRoomRightsManager().refreshRightsForHabbo(this.client.getHabbo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public class KickMemberEvent extends MessageHandler {
|
|||||||
if (habbo.getRoomUnit().getRoom() != null && habbo.getRoomUnit() != null)
|
if (habbo.getRoomUnit().getRoom() != null && habbo.getRoomUnit() != null)
|
||||||
habbo.getRoomUnit().getRoom().sendComposer(new FavoriteMembershipUpdateMessageComposer(habbo.getRoomUnit(), null).compose());
|
habbo.getRoomUnit().getRoom().sendComposer(new FavoriteMembershipUpdateMessageComposer(habbo.getRoomUnit(), null).compose());
|
||||||
if (habbo.getRoomUnit().getRoom() == room)
|
if (habbo.getRoomUnit().getRoom() == room)
|
||||||
room.refreshRightsForHabbo(habbo);
|
room.getRoomRightsManager().refreshRightsForHabbo(habbo);
|
||||||
}
|
}
|
||||||
|
|
||||||
habbo.getClient().sendResponse(new HabboGroupDetailsMessageComposer(guild, habbo.getClient(), false, null));
|
habbo.getClient().sendResponse(new HabboGroupDetailsMessageComposer(guild, habbo.getClient(), false, null));
|
||||||
|
@ -36,7 +36,8 @@ public class RemoveAdminRightsFromMemberEvent extends MessageHandler {
|
|||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
habbo.getClient().sendResponse(new HabboGroupDetailsMessageComposer(guild, this.client, false, Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild.getId(), userId)));
|
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);
|
GuildMember guildMember = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, userId);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public class DeleteRoomEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
room.ejectAll();
|
room.ejectAllFurni();
|
||||||
room.ejectUserFurni(room.getRoomInfo().getOwnerInfo().getId());
|
room.ejectUserFurni(room.getRoomInfo().getOwnerInfo().getId());
|
||||||
|
|
||||||
List<Bot> bots = new ArrayList<>(room.getRoomUnitManager().getCurrentRoomBots().values());
|
List<Bot> bots = new ArrayList<>(room.getRoomUnitManager().getCurrentRoomBots().values());
|
||||||
|
@ -11,7 +11,7 @@ public class GetCustomRoomFilterEvent extends MessageHandler {
|
|||||||
public void handle() {
|
public void handle() {
|
||||||
Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(this.packet.readInt());
|
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));
|
this.client.sendResponse(new RoomFilterSettingsMessageComposer(room));
|
||||||
|
|
||||||
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("SelfModRoomFilterSeen"));
|
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("SelfModRoomFilterSeen"));
|
||||||
|
@ -10,7 +10,7 @@ import com.eu.habbo.messages.outgoing.rooms.FlatAccessibleMessageComposer;
|
|||||||
public class LetUserInEvent extends MessageHandler {
|
public class LetUserInEvent extends MessageHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handle() {
|
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();
|
String username = this.packet.readString();
|
||||||
boolean accepted = this.packet.readBoolean();
|
boolean accepted = this.packet.readBoolean();
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public class RemoveAllRightsEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (room.getRoomInfo().getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
|
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);
|
Habbo habbo = room.getRoomUnitManager().getRoomHabboById(value);
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
@ -26,11 +26,9 @@ public class RemoveAllRightsEvent extends MessageHandler {
|
|||||||
habbo.getRoomUnit().removeStatus(RoomUnitStatus.FLAT_CONTROL);
|
habbo.getRoomUnit().removeStatus(RoomUnitStatus.FLAT_CONTROL);
|
||||||
habbo.getClient().sendResponse(new YouAreControllerMessageComposer(RoomRightLevels.NONE));
|
habbo.getClient().sendResponse(new YouAreControllerMessageComposer(RoomRightLevels.NONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
room.removeAllRights();
|
room.getRoomRightsManager().removeAllRights();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.eu.habbo.messages.incoming.rooms;
|
package com.eu.habbo.messages.incoming.rooms;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
|
|
||||||
public class RemoveOwnRoomRightsRoomEvent extends MessageHandler {
|
public class RemoveOwnRoomRightsRoomEvent extends MessageHandler {
|
||||||
@ -8,6 +9,7 @@ public class RemoveOwnRoomRightsRoomEvent extends MessageHandler {
|
|||||||
public void handle() {
|
public void handle() {
|
||||||
int roomId = this.packet.readInt();
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,7 +17,7 @@ public class RequestRoomPropertySet extends MessageHandler {
|
|||||||
|
|
||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
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();
|
int itemId = this.packet.readInt();
|
||||||
RoomItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(itemId);
|
RoomItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(itemId);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class SetRoomBackgroundColorDataEvent extends MessageHandler {
|
|||||||
if (room == null)
|
if (room == null)
|
||||||
return;
|
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);
|
RoomItem item = room.getHabboItem(itemId);
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
|
@ -26,8 +26,7 @@ public class CustomizeAvatarWithFurniEvent extends MessageHandler {
|
|||||||
public void handle() {
|
public void handle() {
|
||||||
int itemId = this.packet.readInt();
|
int itemId = this.packet.readInt();
|
||||||
|
|
||||||
if (this.client.getHabbo().getRoomUnit().getRoom() != null &&
|
if (this.client.getHabbo().getRoomUnit().getRoom() != null && this.client.getHabbo().getRoomUnit().getRoom().getRoomRightsManager().hasRights(this.client.getHabbo())) {
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().hasRights(this.client.getHabbo())) {
|
|
||||||
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
|
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
|
||||||
|
|
||||||
if (item != null && item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) {
|
if (item != null && item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) {
|
||||||
|
@ -17,7 +17,7 @@ public class MoveWallItemEvent extends MessageHandler {
|
|||||||
if (room == null)
|
if (room == null)
|
||||||
return;
|
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))) {
|
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()));
|
this.client.sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.getKey(), FurnitureMovementError.NO_RIGHTS.getErrorCode()));
|
||||||
return;
|
return;
|
||||||
|
@ -27,7 +27,7 @@ public class PickupObjectEvent extends MessageHandler {
|
|||||||
if (item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) {
|
if (item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) {
|
||||||
room.getRoomItemManager().pickUpItem(item, this.client.getHabbo());
|
room.getRoomItemManager().pickUpItem(item, this.client.getHabbo());
|
||||||
} else {
|
} else {
|
||||||
if (room.hasRights(this.client.getHabbo())) {
|
if (room.getRoomRightsManager().hasRights(this.client.getHabbo())) {
|
||||||
if (this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
|
if (this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
|
||||||
item.setOwnerId(this.client.getHabbo().getHabboInfo().getId());
|
item.setOwnerId(this.client.getHabbo().getHabboInfo().getId());
|
||||||
} else {
|
} else {
|
||||||
|
@ -75,7 +75,7 @@ public class PlaceObjectEvent extends MessageHandler {
|
|||||||
rentSpace = room.getHabboItem(this.client.getHabbo().getHabboStats().getRentedItemId());
|
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 ||
|
if (item instanceof InteractionRoller ||
|
||||||
item instanceof InteractionStackHelper ||
|
item instanceof InteractionStackHelper ||
|
||||||
item instanceof InteractionWired ||
|
item instanceof InteractionWired ||
|
||||||
|
@ -22,7 +22,7 @@ public class PlacePostItEvent extends MessageHandler {
|
|||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
||||||
|
|
||||||
if (room != null) {
|
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);
|
RoomItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(itemId);
|
||||||
|
|
||||||
if (item instanceof InteractionPostIt) {
|
if (item instanceof InteractionPostIt) {
|
||||||
|
@ -14,7 +14,7 @@ public class RoomDimmerChangeStateEvent extends MessageHandler {
|
|||||||
public void handle() {
|
public void handle() {
|
||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
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;
|
return;
|
||||||
|
|
||||||
for (RoomItem moodLight : room.getRoomSpecialTypes().getItemsOfType(InteractionMoodLight.class)) {
|
for (RoomItem moodLight : room.getRoomSpecialTypes().getItemsOfType(InteractionMoodLight.class)) {
|
||||||
|
@ -22,7 +22,7 @@ public class RoomDimmerSavePresetEvent extends MessageHandler {
|
|||||||
public void handle() {
|
public void handle() {
|
||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
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;
|
return;
|
||||||
|
|
||||||
int id = this.packet.readInt();
|
int id = this.packet.readInt();
|
||||||
|
@ -17,7 +17,7 @@ public class SetCustomStackingHeightEvent extends MessageHandler {
|
|||||||
if (this.client.getHabbo().getRoomUnit().getRoom() == null)
|
if (this.client.getHabbo().getRoomUnit().getRoom() == null)
|
||||||
return;
|
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);
|
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
|
||||||
|
|
||||||
if (item instanceof InteractionStackHelper) {
|
if (item instanceof InteractionStackHelper) {
|
||||||
|
@ -39,12 +39,12 @@ public class SetItemDataEvent extends MessageHandler {
|
|||||||
if (!(item instanceof InteractionPostIt))
|
if (!(item instanceof InteractionPostIt))
|
||||||
return;
|
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], ""))) {
|
if (!text.startsWith(item.getExtradata().replace(item.getExtradata().split(" ")[0], ""))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!room.hasRights(this.client.getHabbo()))
|
if (!room.getRoomRightsManager().hasRights(this.client.getHabbo()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class SetObjectDataEvent extends MessageHandler {
|
|||||||
if (room == null)
|
if (room == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!room.hasRights(this.client.getHabbo()))
|
if (!room.getRoomRightsManager().hasRights(this.client.getHabbo()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(this.packet.readInt());
|
RoomItem item = room.getHabboItem(this.packet.readInt());
|
||||||
|
@ -8,7 +8,7 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
|||||||
public class AddJukeboxDiskEvent extends MessageHandler {
|
public class AddJukeboxDiskEvent extends MessageHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handle() {
|
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 itemId = this.packet.readInt();
|
||||||
int slotId = this.packet.readInt();
|
int slotId = this.packet.readInt();
|
||||||
|
@ -15,7 +15,7 @@ public class MovePetEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (pet != null) {
|
if (pet != null) {
|
||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
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) {
|
if (pet.getRoomUnit() != null) {
|
||||||
int x = this.packet.readInt();
|
int x = this.packet.readInt();
|
||||||
int y = this.packet.readInt();
|
int y = this.packet.readInt();
|
||||||
|
@ -38,7 +38,7 @@ public class PurchaseRoomAdEvent extends MessageHandler {
|
|||||||
if (this.client.getHabbo().getHabboInfo().canBuy(item)) {
|
if (this.client.getHabbo().getHabboInfo().canBuy(item)) {
|
||||||
Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(roomId);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,25 +11,26 @@ import com.eu.habbo.plugin.events.users.UserRightsGivenEvent;
|
|||||||
public class AssignRightsEvent extends MessageHandler {
|
public class AssignRightsEvent extends MessageHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handle() {
|
public void handle() {
|
||||||
int userId = this.packet.readInt();
|
int targetId = this.packet.readInt();
|
||||||
|
|
||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
||||||
|
|
||||||
if (room == null)
|
if (room == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (room.getRoomInfo().getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
|
if (room.getRoomInfo().isRoomOwner(this.client.getHabbo()) || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
|
||||||
Habbo target = room.getRoomUnitManager().getRoomHabboById(userId);
|
Habbo target = room.getRoomUnitManager().getRoomHabboById(targetId);
|
||||||
|
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
if (!Emulator.getPluginManager().fireEvent(new UserRightsGivenEvent(this.client.getHabbo(), target)).isCancelled()) {
|
if (!Emulator.getPluginManager().fireEvent(new UserRightsGivenEvent(this.client.getHabbo(), target)).isCancelled()) {
|
||||||
room.giveRights(target);
|
room.getRoomRightsManager().giveRights(target);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MessengerBuddy buddy = this.client.getHabbo().getMessenger().getFriend(userId);
|
MessengerBuddy buddy = this.client.getHabbo().getMessenger().getFriend(targetId);
|
||||||
|
|
||||||
if (buddy != null) {
|
if (buddy != null) {
|
||||||
room.giveRights(userId);
|
room.getRoomRightsManager().giveRights(buddy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ public class RemoveRightsEvent extends MessageHandler {
|
|||||||
for (int i = 0; i < amount; i++) {
|
for (int i = 0; i < amount; i++) {
|
||||||
int userId = this.packet.readInt();
|
int userId = this.packet.readInt();
|
||||||
|
|
||||||
room.removeRights(userId);
|
room.getRoomRightsManager().removeRights(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ public class RoomUserKickEvent extends MessageHandler {
|
|||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
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;
|
if (target.hasRight(Permission.ACC_UNKICKABLE)) return;
|
||||||
|
|
||||||
room.kickHabbo(target, true);
|
room.kickHabbo(target, true);
|
||||||
|
@ -18,7 +18,7 @@ public class RoomUserMuteEvent extends MessageHandler {
|
|||||||
Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(roomId);
|
Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(roomId);
|
||||||
|
|
||||||
if (room != null) {
|
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);
|
Habbo habbo = room.getRoomUnitManager().getRoomHabboById(userId);
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
|
@ -38,7 +38,7 @@ public class ApplySnapshotEvent extends MessageHandler {
|
|||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
||||||
|
|
||||||
// Executing Habbo should be able to edit wireds
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class UpdateActionEvent extends MessageHandler {
|
|||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
||||||
|
|
||||||
if (room != null) {
|
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
|
//TODO Check SUPER WIRED PERMISSIONS TOO
|
||||||
|
|
||||||
InteractionWiredEffect effect = room.getRoomSpecialTypes().getEffect(itemId);
|
InteractionWiredEffect effect = room.getRoomSpecialTypes().getEffect(itemId);
|
||||||
|
@ -16,7 +16,7 @@ public class UpdateConditionEvent extends MessageHandler {
|
|||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
||||||
|
|
||||||
if (room != null) {
|
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);
|
InteractionWiredCondition condition = room.getRoomSpecialTypes().getCondition(itemId);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -16,7 +16,7 @@ public class UpdateTriggerEvent extends MessageHandler {
|
|||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
||||||
|
|
||||||
if (room != null) {
|
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);
|
InteractionWiredTrigger trigger = room.getRoomSpecialTypes().getTrigger(itemId);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -4,9 +4,9 @@ import com.eu.habbo.habbohotel.rooms.Room;
|
|||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.outgoing.MessageComposer;
|
import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.Outgoing;
|
import com.eu.habbo.messages.outgoing.Outgoing;
|
||||||
import gnu.trove.map.hash.THashMap;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@ -18,7 +18,7 @@ public class FlatControllersComposer extends MessageComposer {
|
|||||||
this.response.init(Outgoing.flatControllersComposer);
|
this.response.init(Outgoing.flatControllersComposer);
|
||||||
this.response.appendInt(this.room.getRoomInfo().getId());
|
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());
|
this.response.appendInt(rightsMap.size());
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public class GetGuestRoomResultComposer extends MessageComposer {
|
|||||||
this.response.appendInt(this.room.getRoomInfo().getWhoCanKickOption());
|
this.response.appendInt(this.room.getRoomInfo().getWhoCanKickOption());
|
||||||
this.response.appendInt(this.room.getRoomInfo().getWhoCanBanOption());
|
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().getChatMode());
|
||||||
this.response.appendInt(this.room.getRoomInfo().getChatWeight());
|
this.response.appendInt(this.room.getRoomInfo().getChatWeight());
|
||||||
|
Loading…
Reference in New Issue
Block a user