mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-31 12:22:36 +01:00
Limit number of furniture in rooms
This commit is contained in:
parent
eb9a38871d
commit
12b1b7c2ba
@ -12,7 +12,8 @@ public enum FurnitureMovementError {
|
||||
TILE_HAS_PETS("${room.error.cant_set_item}"),
|
||||
TILE_HAS_BOTS("${room.error.cant_set_item}"),
|
||||
MAX_DIMMERS("${room.error.max_dimmers}"),
|
||||
MAX_SOUNDFURNI("${room.errors.max_soundfurni}");
|
||||
MAX_SOUNDFURNI("${room.errors.max_soundfurni}"),
|
||||
MAX_ITEMS("${room.error.max_furniture}");
|
||||
|
||||
public final String errorCode;
|
||||
|
||||
|
@ -105,6 +105,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
public static boolean HABBO_CHAT_DELAY = false;
|
||||
public static int MAXIMUM_BOTS = 10;
|
||||
public static int MAXIMUM_PETS = 10;
|
||||
public static int MAXIMUM_FURNI = 2500;
|
||||
public static int HAND_ITEM_TIME = 10;
|
||||
public static int IDLE_CYCLES = 240;
|
||||
public static int IDLE_CYCLES_KICK = 480;
|
||||
@ -416,6 +417,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
} catch (SQLException e) {
|
||||
Emulator.getLogging().logSQLException(e);
|
||||
}
|
||||
|
||||
if (this.itemCount() > Room.MAXIMUM_FURNI) {
|
||||
Emulator.getLogging().logErrorLine("Room ID: " + this.getId() + " has exceeded the furniture limit (" + this.itemCount() + " > " + Room.MAXIMUM_FURNI + ").");
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void loadWiredData(Connection connection) {
|
||||
@ -4298,6 +4303,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
|
||||
public FurnitureMovementError canPlaceFurnitureAt(HabboItem item, Habbo habbo, RoomTile tile, int rotation) {
|
||||
if (this.itemCount() >= Room.MAXIMUM_FURNI) {
|
||||
return FurnitureMovementError.MAX_ITEMS;
|
||||
}
|
||||
|
||||
rotation %= 8;
|
||||
if (this.hasRights(habbo) || this.guildRightLevel(habbo) >= 2 || habbo.hasPermission(Permission.ACC_MOVEROTATE)) {
|
||||
return FurnitureMovementError.NONE;
|
||||
|
@ -82,6 +82,7 @@ public class PluginManager {
|
||||
Messenger.MAXIMUM_FRIENDS_HC = Emulator.getConfig().getInt("hotel.max.friends.hc");
|
||||
Room.MAXIMUM_BOTS = Emulator.getConfig().getInt("hotel.max.bots.room");
|
||||
Room.MAXIMUM_PETS = Emulator.getConfig().getInt("hotel.pets.max.room");
|
||||
Room.MAXIMUM_FURNI = Emulator.getConfig().getInt("hotel.room.furni.max", 2500);
|
||||
Room.HAND_ITEM_TIME = Emulator.getConfig().getInt("hotel.rooms.handitem.time");
|
||||
Room.IDLE_CYCLES = Emulator.getConfig().getInt("hotel.roomuser.idle.cycles", 240);
|
||||
Room.IDLE_CYCLES_KICK = Emulator.getConfig().getInt("hotel.roomuser.idle.cycles.kick", 480);
|
||||
@ -206,7 +207,7 @@ public class PluginManager {
|
||||
}
|
||||
}
|
||||
|
||||
public Event fireEvent(Event event) {
|
||||
public <T extends Event> T fireEvent(T event) {
|
||||
for (Method method : this.methods) {
|
||||
if (method.getParameterTypes().length == 1 && method.getParameterTypes()[0].isAssignableFrom(event.getClass())) {
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user