From f6f1897ab88e388838eb5fec78d001bdfa39e9fd Mon Sep 17 00:00:00 2001 From: Beny Date: Tue, 1 Sep 2020 20:47:49 +0200 Subject: [PATCH] Config value added for amount of users to roll - hotel.room.rollers.roll_avatars.max --- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 7 ++++++- src/main/java/com/eu/habbo/plugin/PluginManager.java | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index d87e5ebd..9a0803fb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -114,6 +114,7 @@ public class Room implements Comparable, ISerialize, Runnable { public static int IDLE_CYCLES = 240; public static int IDLE_CYCLES_KICK = 480; public static String PREFIX_FORMAT = "[%prefix%] "; + public static int ROLLERS_MAXIMUM_ROLL_AVATARS = 1; static { for (int i = 1; i <= 3; i++) { @@ -1409,9 +1410,13 @@ public class Room implements Comparable, ISerialize, Runnable { HabboItem nextTileChair = this.getLowestChair(tileInFront); + THashSet usersRolledThisTile = new THashSet<>(); + for (RoomUnit unit : unitsOnTile) { if (rolledUnitIds.contains(unit.getId())) continue; + if(usersRolledThisTile.size() >= Room.ROLLERS_MAXIMUM_ROLL_AVATARS) break; + if (stackContainsRoller && !allowFurniture && !(topItem != null && topItem.isWalkable())) continue; @@ -1446,6 +1451,7 @@ public class Room implements Comparable, ISerialize, Runnable { } } + usersRolledThisTile.add(unit.getId()); rolledUnitIds.add(unit.getId()); updatedUnit.remove(unit); messages.add(new RoomUnitOnRollerComposer(unit, roller, unit.getCurrentLocation(), unit.getZ() + (isRiding ? 1 : 0), tile, tile.getStackHeight() + (isRiding ? 1 : 0) + (nextTileChair != null ? -1 : 0), room)); @@ -1469,7 +1475,6 @@ public class Room implements Comparable, ISerialize, Runnable { if (unit.hasStatus(RoomUnitStatus.SIT)) { unit.sitUpdate = true; } - break; } } diff --git a/src/main/java/com/eu/habbo/plugin/PluginManager.java b/src/main/java/com/eu/habbo/plugin/PluginManager.java index 0355c04d..52df1e66 100644 --- a/src/main/java/com/eu/habbo/plugin/PluginManager.java +++ b/src/main/java/com/eu/habbo/plugin/PluginManager.java @@ -106,6 +106,7 @@ public class PluginManager { 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); + Room.ROLLERS_MAXIMUM_ROLL_AVATARS = Emulator.getConfig().getInt("hotel.room.rollers.roll_avatars.max", 1); RoomManager.MAXIMUM_ROOMS_VIP = Emulator.getConfig().getInt("hotel.max.rooms.vip"); RoomManager.MAXIMUM_ROOMS_USER = Emulator.getConfig().getInt("hotel.max.rooms.user"); RoomManager.HOME_ROOM_ID = Emulator.getConfig().getInt("hotel.home.room");