mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-26 16:30:52 +01:00
small refactor
This commit is contained in:
parent
3bb8ce1624
commit
c4865f8fbd
@ -105,7 +105,7 @@ public class BotManager {
|
|||||||
|
|
||||||
if (room != null && bot != null && habbo != null) {
|
if (room != null && bot != null && habbo != null) {
|
||||||
if (room.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasRight(Permission.ACC_ANYROOMOWNER) || habbo.hasRight(Permission.ACC_PLACEFURNI)) {
|
if (room.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasRight(Permission.ACC_ANYROOMOWNER) || habbo.hasRight(Permission.ACC_PLACEFURNI)) {
|
||||||
if (room.getCurrentBots().size() >= Room.MAXIMUM_BOTS && !habbo.hasRight(Permission.ACC_UNLIMITED_BOTS)) {
|
if (room.getCurrentBots().size() >= RoomConfiguration.MAXIMUM_BOTS && !habbo.hasRight(Permission.ACC_UNLIMITED_BOTS)) {
|
||||||
habbo.getClient().sendResponse(new BotErrorComposer(BotErrorComposer.ROOM_ERROR_MAX_BOTS));
|
habbo.getClient().sendResponse(new BotErrorComposer(BotErrorComposer.ROOM_ERROR_MAX_BOTS));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.achievements.Achievement;
|
|||||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||||
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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@ -43,4 +44,9 @@ public class InteractionBlackHole extends InteractionGate {
|
|||||||
|
|
||||||
super.onPlace(room);
|
super.onPlace(room);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
}
|
}
|
@ -4,6 +4,7 @@ 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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTileState;
|
import com.eu.habbo.habbohotel.rooms.RoomTileState;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
@ -241,4 +242,9 @@ public class InteractionBuildArea extends InteractionCustomValues {
|
|||||||
public boolean isBuilder(String Username) {
|
public boolean isBuilder(String Username) {
|
||||||
return Arrays.asList(this.values.get("builders").split(";")).contains(Username);
|
return Arrays.asList(this.values.get("builders").split(";")).contains(Username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,7 @@ import com.eu.habbo.Emulator;
|
|||||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||||
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.*;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomLayout;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||||
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
|
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
|
||||||
@ -138,4 +135,9 @@ public class InteractionFireworks extends InteractionDefault {
|
|||||||
room.updateItemState(this);
|
room.updateItemState(this);
|
||||||
}, explodeDuration);
|
}, explodeDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ 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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
@ -63,7 +64,10 @@ public class InteractionJukeBox extends HabboItem {
|
|||||||
this.setExtradata("0");
|
this.setExtradata("0");
|
||||||
room.getTraxManager().removeTraxOnRoom(this);
|
room.getTraxManager().removeTraxOnRoom(this);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onPlace(Room room) {
|
public void onPlace(Room room) {
|
||||||
super.onPlace(room);
|
super.onPlace(room);
|
||||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
|
|||||||
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.RoomMoodlightData;
|
import com.eu.habbo.habbohotel.rooms.RoomMoodlightData;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
@ -58,7 +59,10 @@ public class InteractionMoodLight extends HabboItem {
|
|||||||
|
|
||||||
super.onPlace(room);
|
super.onPlace(room);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean isUsable() {
|
public boolean isUsable() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions;
|
|||||||
|
|
||||||
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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
@ -83,4 +84,9 @@ public class InteractionMusicDisc extends HabboItem {
|
|||||||
|
|
||||||
room.getTraxManager().sendUpdatedSongList();
|
room.getTraxManager().sendUpdatedSongList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ 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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTileState;
|
import com.eu.habbo.habbohotel.rooms.RoomTileState;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
@ -144,4 +145,9 @@ public class InteractionMuteArea extends InteractionCustomValues {
|
|||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ 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.RoomSpecialTypes;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -43,7 +44,10 @@ public class InteractionPyramid extends InteractionGate {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(GameClient client, Room room, Object[] objects) {
|
public void onClick(GameClient client, Room room, Object[] objects) {
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean isUsable() {
|
public boolean isUsable() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -3,6 +3,7 @@ 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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
@ -84,4 +85,9 @@ public class InteractionRoller extends HabboItem {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addRoller(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,7 @@ import com.eu.habbo.Emulator;
|
|||||||
import com.eu.habbo.habbohotel.achievements.Achievement;
|
import com.eu.habbo.habbohotel.achievements.Achievement;
|
||||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||||
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.*;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomLayout;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import gnu.trove.set.hash.THashSet;
|
import gnu.trove.set.hash.THashSet;
|
||||||
@ -84,4 +81,8 @@ public class InteractionSnowboardSlope extends InteractionMultiHeight {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.eu.habbo.habbohotel.items.interactions;
|
package com.eu.habbo.habbohotel.items.interactions;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomSpecialTypes;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -13,4 +14,9 @@ public class InteractionStickyPole extends InteractionDefault {
|
|||||||
public InteractionStickyPole(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
public InteractionStickyPole(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||||
super(id, userId, item, extradata, limitedStack, limitedSells);
|
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.eu.habbo.habbohotel.items.interactions;
|
package com.eu.habbo.habbohotel.items.interactions;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomSpecialTypes;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -13,4 +14,9 @@ public class InteractionTalkingFurniture extends InteractionDefault {
|
|||||||
public InteractionTalkingFurniture(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
public InteractionTalkingFurniture(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||||
super(id, userId, item, extradata, limitedStack, limitedSells);
|
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ 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.RoomSpecialTypes;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -20,4 +21,9 @@ public class InteractionTent extends InteractionDefault {
|
|||||||
public void onClick(GameClient client, Room room, Object[] objects) {
|
public void onClick(GameClient client, Room room, Object[] objects) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,4 +301,8 @@ public class InteractionWater extends InteractionDefault {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ 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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import gnu.trove.set.hash.THashSet;
|
import gnu.trove.set.hash.THashSet;
|
||||||
@ -84,7 +85,10 @@ public class InteractionWaterItem extends InteractionMultiHeight {
|
|||||||
room.updateItemState(this);
|
room.updateItemState(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean allowWiredResetState() {
|
public boolean allowWiredResetState() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -4,6 +4,7 @@ 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.items.interactions.wired.WiredSettings;
|
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredConditionOperator;
|
import com.eu.habbo.habbohotel.wired.WiredConditionOperator;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
||||||
@ -48,5 +49,8 @@ public abstract class InteractionWiredCondition extends InteractionWired {
|
|||||||
public WiredConditionOperator operator() {
|
public WiredConditionOperator operator() {
|
||||||
return WiredConditionOperator.AND;
|
return WiredConditionOperator.AND;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addCondition(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ 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.items.interactions.wired.WiredSettings;
|
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||||
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
||||||
@ -59,4 +60,9 @@ public abstract class InteractionWiredEffect extends InteractionWired {
|
|||||||
public boolean requiresTriggeringUser() {
|
public boolean requiresTriggeringUser() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addEffect(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ 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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@ -35,4 +36,9 @@ public abstract class InteractionWiredExtra extends InteractionWired {
|
|||||||
public boolean isWalkable() {
|
public boolean isWalkable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addExtra(this);
|
||||||
|
}
|
||||||
}
|
}
|
@ -4,6 +4,7 @@ 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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||||
@ -151,4 +152,8 @@ public class InteractionWiredHighscore extends HabboItem {
|
|||||||
public void reloadData() {
|
public void reloadData() {
|
||||||
this.data = Emulator.getGameEnvironment().getItemManager().getHighscoreManager().getHighscoreRowsForItem(this.getId(), this.clearType, this.scoreType);
|
this.data = Emulator.getGameEnvironment().getItemManager().getHighscoreManager().getHighscoreRowsForItem(this.getId(), this.clearType, this.scoreType);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ 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.items.interactions.wired.WiredSettings;
|
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||||
import com.eu.habbo.messages.outgoing.wired.WiredTriggerDataComposer;
|
import com.eu.habbo.messages.outgoing.wired.WiredTriggerDataComposer;
|
||||||
@ -58,4 +59,8 @@ public abstract class InteractionWiredTrigger extends InteractionWired {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addTrigger(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.games.Game;
|
|||||||
import com.eu.habbo.habbohotel.games.GameTeamColors;
|
import com.eu.habbo.habbohotel.games.GameTeamColors;
|
||||||
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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
|
|
||||||
@ -52,4 +53,9 @@ public abstract class InteractionGameGate extends InteractionGameTeamItem {
|
|||||||
this.setExtradata(memberCount + "");
|
this.setExtradata(memberCount + "");
|
||||||
game.getRoom().updateItem(this);
|
game.getRoom().updateItem(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addGameGate(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.games;
|
|||||||
import com.eu.habbo.habbohotel.games.GameTeamColors;
|
import com.eu.habbo.habbohotel.games.GameTeamColors;
|
||||||
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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@ -31,4 +32,8 @@ public abstract class InteractionGameScoreboard extends InteractionGameTeamItem
|
|||||||
public void onPickUp(Room room) {
|
public void onPickUp(Room room) {
|
||||||
this.setExtradata("0");
|
this.setExtradata("0");
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addGameScoreboard(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ 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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||||
@ -334,4 +335,8 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
|
|||||||
this.timeNow--;
|
this.timeNow--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addGameTimer(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai;
|
|||||||
|
|
||||||
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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
@ -41,4 +42,9 @@ public class InteractionBattleBanzaiSphere extends HabboItem {
|
|||||||
@Override
|
@Override
|
||||||
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) {
|
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ 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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
|
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
@ -73,4 +74,9 @@ public class InteractionBattleBanzaiTeleporter extends HabboItem {
|
|||||||
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||||
super.onWalkOff(roomUnit, room, objects);
|
super.onWalkOff(roomUnit, room, objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addBanzaiTeleporter(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.freeze;
|
|||||||
|
|
||||||
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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
@ -47,4 +48,9 @@ public class InteractionFreezeExitTile extends HabboItem {
|
|||||||
|
|
||||||
super.serializeExtradata(serverMessage);
|
super.serializeExtradata(serverMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addFreezeExitTile(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.games.Game;
|
|||||||
import com.eu.habbo.habbohotel.games.tag.TagGame;
|
import com.eu.habbo.habbohotel.games.tag.TagGame;
|
||||||
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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
@ -71,7 +72,10 @@ public abstract class InteractionTagField extends HabboItem {
|
|||||||
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void serializeExtradata(ServerMessage serverMessage) {
|
public void serializeExtradata(ServerMessage serverMessage) {
|
||||||
serverMessage.appendInt((this.isLimited() ? 256 : 0));
|
serverMessage.appendInt((this.isLimited() ? 256 : 0));
|
||||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.tag;
|
|||||||
|
|
||||||
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.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
@ -40,7 +41,10 @@ public class InteractionTagPole extends HabboItem {
|
|||||||
|
|
||||||
super.serializeExtradata(serverMessage);
|
super.serializeExtradata(serverMessage);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onPickUp(Room room) {
|
public void onPickUp(Room room) {
|
||||||
this.setExtradata("0");
|
this.setExtradata("0");
|
||||||
|
@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.pets.Pet;
|
|||||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||||
import com.eu.habbo.habbohotel.pets.RideablePet;
|
import com.eu.habbo.habbohotel.pets.RideablePet;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
|
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
@ -82,4 +83,9 @@ public class InteractionNest extends HabboItem {
|
|||||||
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||||
super.onWalkOff(roomUnit, room, objects);
|
super.onWalkOff(roomUnit, room, objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addNest(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.pets.Pet;
|
|||||||
import com.eu.habbo.habbohotel.pets.PetManager;
|
import com.eu.habbo.habbohotel.pets.PetManager;
|
||||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
@ -165,4 +166,8 @@ public class InteractionPetBreedingNest extends HabboItem {
|
|||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
}
|
}
|
@ -121,4 +121,9 @@ public class InteractionPetDrink extends InteractionDefault {
|
|||||||
room.updateItemState(this);
|
room.updateItemState(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addPetDrink(this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,7 @@ import com.eu.habbo.habbohotel.items.Item;
|
|||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionDefault;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionDefault;
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.*;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUserRotation;
|
|
||||||
import com.eu.habbo.messages.outgoing.rooms.users.UserUpdateComposer;
|
import com.eu.habbo.messages.outgoing.rooms.users.UserUpdateComposer;
|
||||||
import com.eu.habbo.threading.runnables.PetEatAction;
|
import com.eu.habbo.threading.runnables.PetEatAction;
|
||||||
|
|
||||||
@ -54,4 +51,8 @@ public class InteractionPetFood extends InteractionDefault {
|
|||||||
public boolean allowWiredResetState() {
|
public boolean allowWiredResetState() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addPetFood(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,4 +101,9 @@ public class InteractionPetToy extends InteractionDefault {
|
|||||||
public boolean allowWiredResetState() {
|
public boolean allowWiredResetState() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addPetToy(this);
|
||||||
|
}
|
||||||
}
|
}
|
@ -98,4 +98,8 @@ public class InteractionPetTrampoline extends InteractionDefault {
|
|||||||
public boolean allowWiredResetState() {
|
public boolean allowWiredResetState() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
}
|
}
|
@ -97,4 +97,9 @@ public class InteractionPetTree extends InteractionDefault {
|
|||||||
public boolean allowWiredResetState() {
|
public boolean allowWiredResetState() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
}
|
}
|
@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.games.battlebanzai.BattleBanzaiGame;
|
|||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionDefault;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionDefault;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomSpecialTypes;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||||
@ -116,4 +117,9 @@ public class WiredBlob extends InteractionDefault {
|
|||||||
|
|
||||||
this.RESETS_WITH_GAME = params[1].equalsIgnoreCase("true");
|
this.RESETS_WITH_GAME = params[1].equalsIgnoreCase("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
roomSpecialTypes.addUndefined(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,9 @@ 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.PetManager;
|
import com.eu.habbo.habbohotel.pets.PetManager;
|
||||||
import com.eu.habbo.habbohotel.pets.RideablePet;
|
import com.eu.habbo.habbohotel.pets.RideablePet;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.utils.HabboItemGetter;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.utils.IHabboItemGetter;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.utils.RoomLoader;
|
||||||
import com.eu.habbo.habbohotel.users.*;
|
import com.eu.habbo.habbohotel.users.*;
|
||||||
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;
|
||||||
@ -83,28 +86,14 @@ import java.util.regex.Pattern;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.eu.habbo.database.DatabaseConstants.CAUGHT_SQL_EXCEPTION;
|
import static com.eu.habbo.database.DatabaseConstants.CAUGHT_SQL_EXCEPTION;
|
||||||
|
import static com.eu.habbo.habbohotel.rooms.RoomConfiguration.*;
|
||||||
|
import static com.eu.habbo.habbohotel.rooms.utils.RoomLoader.*;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class Room implements Comparable<Room>, ISerialize, Runnable {
|
public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||||
private static final String CAUGHT_EXCEPTION = "Caught exception";
|
private static final TIntObjectHashMap<RoomMoodlightData> defaultMoodData = new TIntObjectHashMap<>();
|
||||||
|
|
||||||
public static final Comparator<Room> SORT_SCORE = (o1, o2) -> o2.getScore() - o1.getScore();
|
public static final Comparator<Room> SORT_SCORE = (o1, o2) -> o2.getScore() - o1.getScore();
|
||||||
public static final Comparator<Room> SORT_ID = (o1, o2) -> o2.getId() - o1.getId();
|
public static final Comparator<Room> SORT_ID = (o1, o2) -> o2.getId() - o1.getId();
|
||||||
private static final TIntObjectHashMap<RoomMoodlightData> defaultMoodData = new TIntObjectHashMap<>();
|
|
||||||
//Configuration. Loaded from database & updated accordingly.
|
|
||||||
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 MAXIMUM_POSTITNOTES = 200;
|
|
||||||
public static int HAND_ITEM_TIME = 10;
|
|
||||||
public static int IDLE_CYCLES = 240;
|
|
||||||
public static int IDLE_CYCLES_KICK = 480;
|
|
||||||
public static String PREFIX_FORMAT = "[<font color=\"%color%\">%prefix%</font>] ";
|
|
||||||
public static int ROLLERS_MAXIMUM_ROLL_AVATARS = 1;
|
|
||||||
public static boolean MUTEAREA_CAN_WHISPER = false;
|
|
||||||
public static final double MAXIMUM_FURNI_HEIGHT = 40d;
|
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (int i = 1; i <= 3; i++) {
|
for (int i = 1; i <= 3; i++) {
|
||||||
@ -116,7 +105,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
public final Object roomUnitLock = new Object();
|
public final Object roomUnitLock = new Object();
|
||||||
public final ConcurrentHashMap<RoomTile, THashSet<HabboItem>> tileCache = new ConcurrentHashMap<>();
|
public final ConcurrentHashMap<RoomTile, THashSet<HabboItem>> tileCache = new ConcurrentHashMap<>();
|
||||||
public final List<Integer> userVotes;
|
public List<Integer> userVotes;
|
||||||
@Getter
|
@Getter
|
||||||
private final ConcurrentHashMap<Integer, Habbo> currentHabbos = new ConcurrentHashMap<>(3);
|
private final ConcurrentHashMap<Integer, Habbo> currentHabbos = new ConcurrentHashMap<>(3);
|
||||||
@Getter
|
@Getter
|
||||||
@ -125,22 +114,22 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
private final TIntObjectMap<Bot> currentBots = TCollections.synchronizedMap(new TIntObjectHashMap<>(0));
|
private final TIntObjectMap<Bot> currentBots = TCollections.synchronizedMap(new TIntObjectHashMap<>(0));
|
||||||
@Getter
|
@Getter
|
||||||
private final TIntObjectMap<Pet> currentPets = TCollections.synchronizedMap(new TIntObjectHashMap<>(0));
|
private final TIntObjectMap<Pet> currentPets = TCollections.synchronizedMap(new TIntObjectHashMap<>(0));
|
||||||
private final THashSet<RoomTrade> activeTrades;
|
private THashSet<RoomTrade> activeTrades;
|
||||||
@Getter
|
@Getter
|
||||||
private final TIntArrayList rights;
|
private TIntArrayList rights;
|
||||||
private final TIntIntHashMap mutedHabbos;
|
private TIntIntHashMap mutedHabbos;
|
||||||
private final TIntObjectHashMap<RoomBan> bannedHabbos;
|
private TIntObjectHashMap<RoomBan> bannedHabbos;
|
||||||
@Getter
|
@Getter
|
||||||
private final ConcurrentSet<Game> games;
|
private ConcurrentSet<Game> games;
|
||||||
@Getter
|
@Getter
|
||||||
private final TIntObjectMap<String> furniOwnerNames;
|
private TIntObjectMap<String> furniOwnerNames;
|
||||||
@Getter
|
@Getter
|
||||||
private final TIntIntMap furniOwnerCount;
|
private TIntIntMap furniOwnerCount;
|
||||||
@Getter
|
@Getter
|
||||||
private final TIntObjectMap<RoomMoodlightData> moodlightData;
|
private TIntObjectMap<RoomMoodlightData> moodlightData;
|
||||||
@Getter
|
@Getter
|
||||||
private final THashSet<String> wordFilterWords;
|
private THashSet<String> wordFilterWords;
|
||||||
private final TIntObjectMap<HabboItem> roomItems;
|
private TIntObjectMap<HabboItem> roomItems;
|
||||||
private final Object loadLock = new Object();
|
private final Object loadLock = new Object();
|
||||||
//Use appropriately. Could potentially cause memory leaks when used incorrectly.
|
//Use appropriately. Could potentially cause memory leaks when used incorrectly.
|
||||||
public volatile boolean preventUnloading = false;
|
public volatile boolean preventUnloading = false;
|
||||||
@ -157,7 +146,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
private int wordQuizEnd = 0;
|
private int wordQuizEnd = 0;
|
||||||
public ScheduledFuture<?> roomCycleTask;
|
public ScheduledFuture<?> roomCycleTask;
|
||||||
@Getter
|
@Getter
|
||||||
private final int id;
|
private int id;
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private int ownerId;
|
private int ownerId;
|
||||||
@ -172,7 +161,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
@Setter
|
@Setter
|
||||||
private RoomLayout layout;
|
private RoomLayout layout;
|
||||||
private boolean overrideModel;
|
private boolean overrideModel;
|
||||||
private final String layoutName;
|
private String layoutName;
|
||||||
@Getter
|
@Getter
|
||||||
private String password;
|
private String password;
|
||||||
@Getter
|
@Getter
|
||||||
@ -296,7 +285,35 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
@Getter
|
@Getter
|
||||||
private long cycleTimestamp;
|
private long cycleTimestamp;
|
||||||
|
|
||||||
|
private final HabboItemGetter habboItemGetter = new HabboItemGetter();
|
||||||
|
|
||||||
public Room(ResultSet set) throws SQLException {
|
public Room(ResultSet set) throws SQLException {
|
||||||
|
loadRoomProperties(set);
|
||||||
|
loadPromotion(set);
|
||||||
|
loadBans();
|
||||||
|
initializeCollections(set);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadPromotion(ResultSet set) throws SQLException {
|
||||||
|
this.promoted = set.getString("promoted").equals("1");
|
||||||
|
if (this.promoted) {
|
||||||
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection();
|
||||||
|
PreparedStatement statement = connection.prepareStatement(
|
||||||
|
"SELECT * FROM room_promotions WHERE room_id = ? AND end_timestamp > ? LIMIT 1")) {
|
||||||
|
statement.setInt(1, this.id);
|
||||||
|
statement.setInt(2, Emulator.getIntUnixTimestamp());
|
||||||
|
this.promoted = false;
|
||||||
|
try (ResultSet promotionSet = statement.executeQuery()) {
|
||||||
|
if (promotionSet.next()) {
|
||||||
|
this.promoted = true;
|
||||||
|
this.promotion = new RoomPromotion(this, promotionSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadRoomProperties(ResultSet set) throws SQLException {
|
||||||
this.id = set.getInt("id");
|
this.id = set.getInt("id");
|
||||||
this.ownerId = set.getInt("owner_id");
|
this.ownerId = set.getInt("owner_id");
|
||||||
this.ownerName = set.getString("owner_name");
|
this.ownerName = set.getString("owner_name");
|
||||||
@ -333,51 +350,28 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
this.rollerSpeed = set.getInt("roller_speed");
|
this.rollerSpeed = set.getInt("roller_speed");
|
||||||
this.overrideModel = set.getString("override_model").equals("1");
|
this.overrideModel = set.getString("override_model").equals("1");
|
||||||
this.layoutName = set.getString("model");
|
this.layoutName = set.getString("model");
|
||||||
this.promoted = set.getString("promoted").equals("1");
|
|
||||||
this.jukeboxActive = set.getString("jukebox_active").equals("1");
|
|
||||||
this.hideWired = set.getString("hidewired").equals("1");
|
|
||||||
|
|
||||||
this.bannedHabbos = new TIntObjectHashMap<>();
|
|
||||||
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM room_promotions WHERE room_id = ? AND end_timestamp > ? LIMIT 1")) {
|
|
||||||
if (this.promoted) {
|
|
||||||
statement.setInt(1, this.id);
|
|
||||||
statement.setInt(2, Emulator.getIntUnixTimestamp());
|
|
||||||
|
|
||||||
try (ResultSet promotionSet = statement.executeQuery()) {
|
|
||||||
this.promoted = false;
|
|
||||||
if (promotionSet.next()) {
|
|
||||||
this.promoted = true;
|
|
||||||
this.promotion = new RoomPromotion(this, promotionSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadBans(connection);
|
private void loadBans() {
|
||||||
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
|
||||||
|
this.bannedHabbos = RoomLoader.loadBans(connection, id);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error(CAUGHT_SQL_EXCEPTION, e);
|
log.error(CAUGHT_SQL_EXCEPTION, e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.tradeMode = set.getInt("trade_mode");
|
private void initializeCollections(ResultSet set) throws SQLException {
|
||||||
this.moveDiagonally = set.getString("move_diagonally").equals("1");
|
|
||||||
|
|
||||||
this.preLoaded = true;
|
|
||||||
this.allowBotsWalk = true;
|
|
||||||
this.allowEffects = true;
|
|
||||||
this.furniOwnerNames = TCollections.synchronizedMap(new TIntObjectHashMap<>(0));
|
this.furniOwnerNames = TCollections.synchronizedMap(new TIntObjectHashMap<>(0));
|
||||||
this.furniOwnerCount = TCollections.synchronizedMap(new TIntIntHashMap(0));
|
this.furniOwnerCount = TCollections.synchronizedMap(new TIntIntHashMap(0));
|
||||||
this.roomItems = TCollections.synchronizedMap(new TIntObjectHashMap<>(0));
|
this.roomItems = TCollections.synchronizedMap(new TIntObjectHashMap<>(0));
|
||||||
|
this.bannedHabbos = new TIntObjectHashMap<>();
|
||||||
this.wordFilterWords = new THashSet<>(0);
|
this.wordFilterWords = new THashSet<>(0);
|
||||||
this.moodlightData = new TIntObjectHashMap<>(defaultMoodData);
|
this.moodlightData = new TIntObjectHashMap<>(defaultMoodData);
|
||||||
|
Arrays.stream(set.getString("moodlight_data").split(";"))
|
||||||
for (String s : set.getString("moodlight_data").split(";")) {
|
.map(RoomMoodlightData::fromString)
|
||||||
RoomMoodlightData data = RoomMoodlightData.fromString(s);
|
.forEach(data -> this.moodlightData.put(data.getId(), data));
|
||||||
this.moodlightData.put(data.getId(), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.mutedHabbos = new TIntIntHashMap();
|
this.mutedHabbos = new TIntIntHashMap();
|
||||||
this.games = new ConcurrentSet<>();
|
this.games = new ConcurrentSet<>();
|
||||||
|
|
||||||
this.activeTrades = new THashSet<>(0);
|
this.activeTrades = new THashSet<>(0);
|
||||||
this.rights = new TIntArrayList();
|
this.rights = new TIntArrayList();
|
||||||
this.userVotes = new ArrayList<>();
|
this.userVotes = new ArrayList<>();
|
||||||
@ -401,13 +395,17 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
this.roomSpecialTypes = new RoomSpecialTypes();
|
this.roomSpecialTypes = new RoomSpecialTypes();
|
||||||
|
|
||||||
this.loadLayout();
|
this.loadLayout();
|
||||||
this.loadRights(connection);
|
this.rights = loadRights(connection, this.id);
|
||||||
this.loadItems(connection);
|
this.roomItems.clear();
|
||||||
this.loadHeightmap();
|
loadItems(connection, id, this);
|
||||||
this.loadBots(connection);
|
if (this.itemCount() > RoomConfiguration.MAXIMUM_FURNI) {
|
||||||
this.loadPets(connection);
|
log.error("Room ID: {} has exceeded the furniture limit ({} > {}).", this.getId(), this.itemCount(), RoomConfiguration.MAXIMUM_FURNI);
|
||||||
this.loadWordFilter(connection);
|
}
|
||||||
this.loadWiredData(connection);
|
loadHeightmap(this, id);
|
||||||
|
loadBots(connection, id, this);
|
||||||
|
loadPets(connection, id, this);
|
||||||
|
loadWordFilter(connection, id, wordFilterWords);
|
||||||
|
loadWiredData(connection, id, this);
|
||||||
|
|
||||||
this.idleCycles = 0;
|
this.idleCycles = 0;
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
@ -448,161 +446,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void loadHeightmap() {
|
|
||||||
try {
|
|
||||||
if (this.layout != null) {
|
|
||||||
for (short x = 0; x < this.layout.getMapSizeX(); x++) {
|
|
||||||
for (short y = 0; y < this.layout.getMapSizeY(); y++) {
|
|
||||||
RoomTile tile = this.layout.getTile(x, y);
|
|
||||||
if (tile != null) {
|
|
||||||
this.updateTile(tile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.error("Unknown Room Layout for Room (ID: {})", this.id);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(CAUGHT_EXCEPTION, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void loadItems(Connection connection) {
|
|
||||||
this.roomItems.clear();
|
|
||||||
|
|
||||||
try (PreparedStatement statement = connection.prepareStatement("SELECT * FROM items WHERE room_id = ?")) {
|
|
||||||
statement.setInt(1, this.id);
|
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
|
||||||
while (set.next()) {
|
|
||||||
this.addHabboItem(Emulator.getGameEnvironment().getItemManager().loadHabboItem(set));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
log.error(CAUGHT_SQL_EXCEPTION, e);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(CAUGHT_EXCEPTION, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.itemCount() > Room.MAXIMUM_FURNI) {
|
|
||||||
log.error("Room ID: {} has exceeded the furniture limit ({} > {}).", this.getId(), this.itemCount(), Room.MAXIMUM_FURNI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void loadWiredData(Connection connection) {
|
|
||||||
try (PreparedStatement statement = connection.prepareStatement("SELECT id, wired_data FROM items WHERE room_id = ? AND wired_data<>''")) {
|
|
||||||
statement.setInt(1, this.id);
|
|
||||||
|
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
|
||||||
while (set.next()) {
|
|
||||||
try {
|
|
||||||
HabboItem item = this.getHabboItem(set.getInt("id"));
|
|
||||||
|
|
||||||
if (item instanceof InteractionWired interactionWired) {
|
|
||||||
interactionWired.loadWiredData(set, this);
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
log.error(CAUGHT_SQL_EXCEPTION, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
log.error(CAUGHT_SQL_EXCEPTION, e);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(CAUGHT_EXCEPTION, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void loadBots(Connection connection) {
|
|
||||||
this.currentBots.clear();
|
|
||||||
|
|
||||||
try (PreparedStatement statement = connection.prepareStatement("SELECT users.username AS owner_name, bots.* FROM bots INNER JOIN users ON bots.user_id = users.id WHERE room_id = ?")) {
|
|
||||||
statement.setInt(1, this.id);
|
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
|
||||||
while (set.next()) {
|
|
||||||
Bot b = Emulator.getGameEnvironment().getBotManager().loadBot(set);
|
|
||||||
|
|
||||||
if (b != null) {
|
|
||||||
b.setRoom(this);
|
|
||||||
b.setRoomUnit(new RoomUnit());
|
|
||||||
b.getRoomUnit().setPathFinderRoom(this);
|
|
||||||
b.getRoomUnit().setLocation(this.layout.getTile((short) set.getInt("x"), (short) set.getInt("y")));
|
|
||||||
if (b.getRoomUnit().getCurrentLocation() == null || b.getRoomUnit().getCurrentLocation().getState() == RoomTileState.INVALID) {
|
|
||||||
b.getRoomUnit().setZ(this.getLayout().getDoorTile().getStackHeight());
|
|
||||||
b.getRoomUnit().setLocation(this.getLayout().getDoorTile());
|
|
||||||
b.getRoomUnit().setRotation(RoomUserRotation.fromValue(this.getLayout().getDoorDirection()));
|
|
||||||
} else {
|
|
||||||
b.getRoomUnit().setZ(set.getDouble("z"));
|
|
||||||
b.getRoomUnit().setPreviousLocationZ(set.getDouble("z"));
|
|
||||||
b.getRoomUnit().setRotation(RoomUserRotation.values()[set.getInt("rot")]);
|
|
||||||
}
|
|
||||||
b.getRoomUnit().setRoomUnitType(RoomUnitType.BOT);
|
|
||||||
b.getRoomUnit().setDanceType(DanceType.values()[set.getInt("dance")]);
|
|
||||||
b.getRoomUnit().setInRoom(true);
|
|
||||||
this.giveEffect(b.getRoomUnit(), set.getInt("effect"), Integer.MAX_VALUE);
|
|
||||||
this.addBot(b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
log.error(CAUGHT_SQL_EXCEPTION, e);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(CAUGHT_EXCEPTION, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void loadPets(Connection connection) {
|
|
||||||
|
|
||||||
this.currentPets.clear();
|
|
||||||
|
|
||||||
try (PreparedStatement statement = connection.prepareStatement("SELECT users.username as pet_owner_name, users_pets.* FROM users_pets INNER JOIN users ON users_pets.user_id = users.id WHERE room_id = ?")) {
|
|
||||||
statement.setInt(1, this.id);
|
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
|
||||||
while (set.next()) {
|
|
||||||
Pet pet = PetManager.loadPet(set);
|
|
||||||
pet.setRoom(this);
|
|
||||||
pet.setRoomUnit(new RoomUnit());
|
|
||||||
pet.getRoomUnit().setPathFinderRoom(this);
|
|
||||||
pet.getRoomUnit().setLocation(this.layout.getTile((short) set.getInt("x"), (short) set.getInt("y")));
|
|
||||||
if (pet.getRoomUnit().getCurrentLocation() == null || pet.getRoomUnit().getCurrentLocation().getState() == RoomTileState.INVALID) {
|
|
||||||
pet.getRoomUnit().setZ(this.getLayout().getDoorTile().getStackHeight());
|
|
||||||
pet.getRoomUnit().setLocation(this.getLayout().getDoorTile());
|
|
||||||
pet.getRoomUnit().setRotation(RoomUserRotation.fromValue(this.getLayout().getDoorDirection()));
|
|
||||||
} else {
|
|
||||||
pet.getRoomUnit().setZ(set.getDouble("z"));
|
|
||||||
pet.getRoomUnit().setRotation(RoomUserRotation.values()[set.getInt("rot")]);
|
|
||||||
}
|
|
||||||
pet.getRoomUnit().setRoomUnitType(RoomUnitType.PET);
|
|
||||||
pet.getRoomUnit().setCanWalk(true);
|
|
||||||
this.addPet(pet);
|
|
||||||
|
|
||||||
this.getFurniOwnerNames().put(pet.getUserId(), set.getString("pet_owner_name"));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
log.error(CAUGHT_SQL_EXCEPTION, e);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(CAUGHT_EXCEPTION, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void loadWordFilter(Connection connection) {
|
|
||||||
this.wordFilterWords.clear();
|
|
||||||
|
|
||||||
try (PreparedStatement statement = connection.prepareStatement("SELECT * FROM room_wordfilter WHERE room_id = ?")) {
|
|
||||||
statement.setInt(1, this.id);
|
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
|
||||||
while (set.next()) {
|
|
||||||
this.wordFilterWords.add(set.getString("word"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
log.error(CAUGHT_SQL_EXCEPTION, e);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(CAUGHT_EXCEPTION, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateTile(RoomTile tile) {
|
public void updateTile(RoomTile tile) {
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
tile.setStackHeight(this.getStackHeight(tile.getX(), tile.getY(), false));
|
tile.setStackHeight(this.getStackHeight(tile.getX(), tile.getY(), false));
|
||||||
@ -613,8 +456,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
public void updateTiles(THashSet<RoomTile> tiles) {
|
public void updateTiles(THashSet<RoomTile> tiles) {
|
||||||
for (RoomTile tile : tiles) {
|
for (RoomTile tile : tiles) {
|
||||||
this.tileCache.remove(tile);
|
this.tileCache.remove(tile);
|
||||||
tile.setStackHeight(this.getStackHeight(tile.getX(), tile.getY(), false));
|
updateTile(tile);
|
||||||
tile.setState(this.calculateTileState(tile));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sendComposer(new HeightMapUpdateMessageComposer(this, tiles).compose());
|
this.sendComposer(new HeightMapUpdateMessageComposer(this, tiles).compose());
|
||||||
@ -738,15 +580,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
Emulator.getThreading().run(item);
|
Emulator.getThreading().run(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateHabbosAt(Rectangle rectangle) {
|
|
||||||
for (short i = (short) rectangle.x; i < rectangle.x + rectangle.width; i++) {
|
|
||||||
for (short j = (short) rectangle.y; j < rectangle.y + rectangle.height; j++) {
|
|
||||||
this.updateHabbosAt(i, j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateHabbo(Habbo habbo) {
|
public void updateHabbo(Habbo habbo) {
|
||||||
this.updateRoomUnit(habbo.getRoomUnit());
|
this.updateRoomUnit(habbo.getRoomUnit());
|
||||||
}
|
}
|
||||||
@ -779,6 +612,13 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
this.sendComposer(new UserUpdateComposer(roomUnit).compose());
|
this.sendComposer(new UserUpdateComposer(roomUnit).compose());
|
||||||
}
|
}
|
||||||
|
public void updateHabbosAt(Rectangle rectangle) {
|
||||||
|
for (short i = (short) rectangle.x; i < rectangle.x + rectangle.width; i++) {
|
||||||
|
for (short j = (short) rectangle.y; j < rectangle.y + rectangle.height; j++) {
|
||||||
|
this.updateHabbosAt(i, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void updateHabbosAt(short x, short y) {
|
public void updateHabbosAt(short x, short y) {
|
||||||
this.updateHabbosAt(x, y, this.getHabbosAt(x, y));
|
this.updateHabbosAt(x, y, this.getHabbosAt(x, y));
|
||||||
@ -1241,7 +1081,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
} else {
|
} else {
|
||||||
habbo.getRoomUnit().increaseIdleTimer();
|
habbo.getRoomUnit().increaseIdleTimer();
|
||||||
|
|
||||||
if (!this.isOwner(habbo) && habbo.getRoomUnit().getIdleTimer() >= Room.IDLE_CYCLES_KICK) {
|
if (!this.isOwner(habbo) && habbo.getRoomUnit().getIdleTimer() >= RoomConfiguration.IDLE_CYCLES_KICK) {
|
||||||
UserExitRoomEvent event = new UserExitRoomEvent(habbo, UserExitRoomEvent.UserExitRoomReason.KICKED_IDLE);
|
UserExitRoomEvent event = new UserExitRoomEvent(habbo, UserExitRoomEvent.UserExitRoomReason.KICKED_IDLE);
|
||||||
Emulator.getPluginManager().fireEvent(event);
|
Emulator.getPluginManager().fireEvent(event);
|
||||||
|
|
||||||
@ -1464,7 +1304,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
for (RoomUnit unit : unitsOnTile) {
|
for (RoomUnit unit : unitsOnTile) {
|
||||||
if (rolledUnitIds.contains(unit.getId())) continue;
|
if (rolledUnitIds.contains(unit.getId())) continue;
|
||||||
|
|
||||||
if (usersRolledThisTile.size() >= Room.ROLLERS_MAXIMUM_ROLL_AVATARS) break;
|
if (usersRolledThisTile.size() >= RoomConfiguration.ROLLERS_MAXIMUM_ROLL_AVATARS) break;
|
||||||
|
|
||||||
if (stackContainsRoller && !allowFurniture && !(topItem != null && topItem.isWalkable()))
|
if (stackContainsRoller && !allowFurniture && !(topItem != null && topItem.isWalkable()))
|
||||||
continue;
|
continue;
|
||||||
@ -1995,80 +1835,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
this.roomSpecialTypes.addCycleTask((ICycleable) item);
|
this.roomSpecialTypes.addCycleTask((ICycleable) item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item instanceof InteractionWiredTrigger interactionWiredTrigger) {
|
item.addToSpecialRoomTypes(roomSpecialTypes);
|
||||||
this.roomSpecialTypes.addTrigger(interactionWiredTrigger);
|
|
||||||
} else if (item instanceof InteractionWiredEffect interactionWiredEffect) {
|
|
||||||
this.roomSpecialTypes.addEffect(interactionWiredEffect);
|
|
||||||
} else if (item instanceof InteractionWiredCondition interactionWiredCondition) {
|
|
||||||
this.roomSpecialTypes.addCondition(interactionWiredCondition);
|
|
||||||
} else if (item instanceof InteractionWiredExtra interactionWiredExtra) {
|
|
||||||
this.roomSpecialTypes.addExtra(interactionWiredExtra);
|
|
||||||
} else if (item instanceof InteractionBattleBanzaiTeleporter interactionBattleBanzaiTeleporter) {
|
|
||||||
this.roomSpecialTypes.addBanzaiTeleporter(interactionBattleBanzaiTeleporter);
|
|
||||||
} else if (item instanceof InteractionRoller interactionRoller) {
|
|
||||||
this.roomSpecialTypes.addRoller(interactionRoller);
|
|
||||||
} else if (item instanceof InteractionGameScoreboard interactionGameScoreboard) {
|
|
||||||
this.roomSpecialTypes.addGameScoreboard(interactionGameScoreboard);
|
|
||||||
} else if (item instanceof InteractionGameGate interactionGameGate) {
|
|
||||||
this.roomSpecialTypes.addGameGate(interactionGameGate);
|
|
||||||
} else if (item instanceof InteractionGameTimer interactionGameTimer) {
|
|
||||||
this.roomSpecialTypes.addGameTimer(interactionGameTimer);
|
|
||||||
} else if (item instanceof InteractionFreezeExitTile interactionFreezeExitTile) {
|
|
||||||
this.roomSpecialTypes.addFreezeExitTile(interactionFreezeExitTile);
|
|
||||||
} else if (item instanceof InteractionNest interactionNest) {
|
|
||||||
this.roomSpecialTypes.addNest(interactionNest);
|
|
||||||
} else if (item instanceof InteractionPetDrink interactionPetDrink) {
|
|
||||||
this.roomSpecialTypes.addPetDrink(interactionPetDrink);
|
|
||||||
} else if (item instanceof InteractionPetFood interactionPetFood) {
|
|
||||||
this.roomSpecialTypes.addPetFood(interactionPetFood);
|
|
||||||
} else if (item instanceof InteractionPetToy interactionPetToy) {
|
|
||||||
this.roomSpecialTypes.addPetToy(interactionPetToy);
|
|
||||||
} else if (item instanceof InteractionPetTree) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionPetTrampoline) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionMoodLight) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionPyramid) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionMusicDisc) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionBattleBanzaiSphere) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionTalkingFurniture) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionWater) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionWaterItem) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionMuteArea) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionBuildArea) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionTagPole) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionTagField) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionJukeBox) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionPetBreedingNest) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionBlackHole) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionWiredHighscore) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionStickyPole) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof WiredBlob) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionTent) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionSnowboardSlope) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
} else if (item instanceof InteractionFireworks) {
|
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2081,41 +1848,14 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
item = this.roomItems.get(id);
|
item = this.roomItems.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == null)
|
if (item == null) {
|
||||||
item = this.roomSpecialTypes.getBanzaiTeleporter(id);
|
for (IHabboItemGetter itemGetter : habboItemGetter.getItemGetters()) {
|
||||||
|
item = itemGetter.get(id, roomSpecialTypes);
|
||||||
if (item == null)
|
if (item != null) {
|
||||||
item = this.roomSpecialTypes.getTrigger(id);
|
break;
|
||||||
|
}
|
||||||
if (item == null)
|
}
|
||||||
item = this.roomSpecialTypes.getEffect(id);
|
}
|
||||||
|
|
||||||
if (item == null)
|
|
||||||
item = this.roomSpecialTypes.getCondition(id);
|
|
||||||
|
|
||||||
if (item == null)
|
|
||||||
item = this.roomSpecialTypes.getGameGate(id);
|
|
||||||
|
|
||||||
if (item == null)
|
|
||||||
item = this.roomSpecialTypes.getGameScorebord(id);
|
|
||||||
|
|
||||||
if (item == null)
|
|
||||||
item = this.roomSpecialTypes.getGameTimer(id);
|
|
||||||
|
|
||||||
if (item == null)
|
|
||||||
item = this.roomSpecialTypes.getFreezeExitTiles().get(id);
|
|
||||||
|
|
||||||
if (item == null)
|
|
||||||
item = this.roomSpecialTypes.getRoller(id);
|
|
||||||
|
|
||||||
if (item == null)
|
|
||||||
item = this.roomSpecialTypes.getNest(id);
|
|
||||||
|
|
||||||
if (item == null)
|
|
||||||
item = this.roomSpecialTypes.getPetDrink(id);
|
|
||||||
|
|
||||||
if (item == null)
|
|
||||||
item = this.roomSpecialTypes.getPetFood(id);
|
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
@ -2126,7 +1866,9 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
|
|
||||||
public void removeHabboItem(HabboItem item) {
|
public void removeHabboItem(HabboItem item) {
|
||||||
if (item != null) {
|
if (item == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
HabboItem i;
|
HabboItem i;
|
||||||
synchronized (this.roomItems) {
|
synchronized (this.roomItems) {
|
||||||
@ -2224,7 +1966,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public List<HabboItem> getFloorItems() {
|
public List<HabboItem> getFloorItems() {
|
||||||
return roomItems.valueCollection().stream().filter(i -> i.getBaseItem().getType() == FurnitureType.FLOOR).toList();
|
return roomItems.valueCollection().stream().filter(i -> i.getBaseItem().getType() == FurnitureType.FLOOR).toList();
|
||||||
@ -3320,47 +3061,14 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Habbo habbo : this.getHabbos()) {
|
for (Habbo habbo : this.getHabbos()) {
|
||||||
if (habbo == null) { return ; }
|
if (habbo == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!habbo.getHabboStats().isIgnoreBots())
|
if (!habbo.getHabboStats().isIgnoreBots())
|
||||||
habbo.getClient().sendResponse(message);
|
habbo.getClient().sendResponse(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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.id);
|
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
|
||||||
while (set.next()) {
|
|
||||||
this.rights.add(set.getInt(DatabaseConstants.USER_ID));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
log.error(CAUGHT_SQL_EXCEPTION, e);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(CAUGHT_EXCEPTION, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadBans(Connection connection) {
|
|
||||||
this.bannedHabbos.clear();
|
|
||||||
|
|
||||||
try (PreparedStatement statement = connection.prepareStatement("SELECT users.username, users.id, room_bans.* FROM room_bans INNER JOIN users ON room_bans.user_id = users.id WHERE ends > ? AND room_bans.room_id = ?")) {
|
|
||||||
statement.setInt(1, Emulator.getIntUnixTimestamp());
|
|
||||||
statement.setInt(2, this.id);
|
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
|
||||||
while (set.next()) {
|
|
||||||
if (this.bannedHabbos.containsKey(set.getInt(DatabaseConstants.USER_ID)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
this.bannedHabbos.put(set.getInt(DatabaseConstants.USER_ID), new RoomBan(set));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
log.error(CAUGHT_SQL_EXCEPTION, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public RoomRightLevels getGuildRightLevel(Habbo habbo) {
|
public RoomRightLevels getGuildRightLevel(Habbo habbo) {
|
||||||
if (this.guildId > 0 && habbo.getHabboStats().hasGuild(this.guildId)) {
|
if (this.guildId > 0 && habbo.getHabboStats().hasGuild(this.guildId)) {
|
||||||
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(this.guildId);
|
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(this.guildId);
|
||||||
@ -3609,7 +3317,9 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
Habbo habbo = roomUnit.getRoom().getHabbo(roomUnit);
|
Habbo habbo = roomUnit.getRoom().getHabbo(roomUnit);
|
||||||
|
|
||||||
if (roomUnit.getRoomUnitType() == RoomUnitType.USER && (habbo == null || habbo.getHabboInfo().isInGame() && !ignoreChecks)) { return; }
|
if (roomUnit.getRoomUnitType() == RoomUnitType.USER && (habbo == null || habbo.getHabboInfo().isInGame() && !ignoreChecks)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (duration == -1 || duration == Integer.MAX_VALUE) {
|
if (duration == -1 || duration == Integer.MAX_VALUE) {
|
||||||
duration = Integer.MAX_VALUE;
|
duration = Integer.MAX_VALUE;
|
||||||
} else {
|
} else {
|
||||||
@ -3951,7 +3661,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FurnitureMovementError canPlaceFurnitureAt(HabboItem item, Habbo habbo, RoomTile tile, int rotation) {
|
public FurnitureMovementError canPlaceFurnitureAt(HabboItem item, Habbo habbo, RoomTile tile, int rotation) {
|
||||||
if (this.itemCount() >= Room.MAXIMUM_FURNI) {
|
if (this.itemCount() >= RoomConfiguration.MAXIMUM_FURNI) {
|
||||||
return FurnitureMovementError.MAX_ITEMS;
|
return FurnitureMovementError.MAX_ITEMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.eu.habbo.habbohotel.rooms;
|
||||||
|
|
||||||
|
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||||
|
|
||||||
|
public class RoomConfiguration {
|
||||||
|
//Configuration. Loaded from database & updated accordingly.
|
||||||
|
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 MAXIMUM_POSTITNOTES = 200;
|
||||||
|
public static int HAND_ITEM_TIME = 10;
|
||||||
|
public static int IDLE_CYCLES = 240;
|
||||||
|
public static int IDLE_CYCLES_KICK = 480;
|
||||||
|
public static String PREFIX_FORMAT = "[<font color=\"%color%\">%prefix%</font>] ";
|
||||||
|
public static int ROLLERS_MAXIMUM_ROLL_AVATARS = 1;
|
||||||
|
public static boolean MUTEAREA_CAN_WHISPER = false;
|
||||||
|
public static final double MAXIMUM_FURNI_HEIGHT = 40d;
|
||||||
|
|
||||||
|
public static final String CAUGHT_EXCEPTION = "Caught exception";
|
||||||
|
}
|
@ -1,12 +1,12 @@
|
|||||||
package com.eu.habbo.habbohotel.rooms;
|
package com.eu.habbo.habbohotel.rooms;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import gnu.trove.set.hash.THashSet;
|
import gnu.trove.set.hash.THashSet;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -229,6 +229,9 @@ public class RoomLayout {
|
|||||||
return this.roomTiles[x][y].relativeHeight();
|
return this.roomTiles[x][y].relativeHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RoomTile getTile(HabboItem tile){
|
||||||
|
return getTile(tile.getX(), tile.getY());
|
||||||
|
}
|
||||||
public RoomTile getTile(short x, short y) {
|
public RoomTile getTile(short x, short y) {
|
||||||
if (this.tileExists(x, y)) {
|
if (this.tileExists(x, y)) {
|
||||||
return this.roomTiles[x][y];
|
return this.roomTiles[x][y];
|
||||||
@ -645,37 +648,37 @@ public class RoomLayout {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public THashSet<RoomTile> getTilesAt(RoomTile tile, HabboItem item) {
|
||||||
|
return getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation());
|
||||||
|
}
|
||||||
|
|
||||||
public THashSet<RoomTile> getTilesAt(RoomTile tile, int width, int length, int rotation) {
|
public THashSet<RoomTile> getTilesAt(RoomTile tile, int width, int length, int rotation) {
|
||||||
THashSet<RoomTile> pointList = new THashSet<>(width * length, 0.1f);
|
THashSet<RoomTile> pointList = new THashSet<>(width * length, 0.1f);
|
||||||
|
|
||||||
if (tile != null) {
|
short x = tile.getX();
|
||||||
if (rotation == 0 || rotation == 4) {
|
short y = tile.getY();
|
||||||
for (short i = tile.getX(); i <= (tile.getX() + (width - 1)); i++) {
|
short addWidth = (short) (x + (width - 1));
|
||||||
for (short j = tile.getY(); j <= (tile.getY() + (length - 1)); j++) {
|
short addLength = (short) (y + (length - 1));
|
||||||
RoomTile t = this.getTile(i, j);
|
|
||||||
|
|
||||||
if (t != null) {
|
switch (rotation) {
|
||||||
|
case 0, 4 -> addRoomTilesToPointsList(x, addWidth, y, addLength, pointList);
|
||||||
|
case 2, 6 -> addRoomTilesToPointsList(x, addLength, y, addWidth, pointList);
|
||||||
|
default -> {
|
||||||
|
RoomTile t = this.getTile(x, y);
|
||||||
|
if (t != null)
|
||||||
pointList.add(t);
|
pointList.add(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (rotation == 2 || rotation == 6) {
|
|
||||||
for (short i = tile.getX(); i <= (tile.getX() + (length - 1)); i++) {
|
|
||||||
for (short j = tile.getY(); j <= (tile.getY() + (width - 1)); j++) {
|
|
||||||
RoomTile t = this.getTile(i, j);
|
|
||||||
|
|
||||||
if (t != null) {
|
|
||||||
pointList.add(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (rotation == 1 || rotation == 3 || rotation == 5 || rotation == 7) {
|
|
||||||
RoomTile t = this.getTile(tile.getX(), tile.getY());
|
|
||||||
if (t != null) {
|
|
||||||
pointList.add(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return pointList;
|
return pointList;
|
||||||
}
|
}
|
||||||
|
private void addRoomTilesToPointsList (short minX, short maxX, short minY, short maxY, THashSet<RoomTile> pointList){
|
||||||
|
for (short i = minX; i <= maxX; i++) {
|
||||||
|
for (short j = minY; j <= maxY; j++) {
|
||||||
|
RoomTile t = this.getTile(i, j);
|
||||||
|
if (t != null)
|
||||||
|
pointList.add(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -670,10 +670,9 @@ public class RoomSpecialTypes {
|
|||||||
public THashSet<HabboItem> getItemsOfType(Class<? extends HabboItem> type) {
|
public THashSet<HabboItem> getItemsOfType(Class<? extends HabboItem> type) {
|
||||||
THashSet<HabboItem> items = new THashSet<>();
|
THashSet<HabboItem> items = new THashSet<>();
|
||||||
synchronized (this.undefined) {
|
synchronized (this.undefined) {
|
||||||
for (HabboItem item : this.undefined.values()) {
|
this.undefined.values().stream()
|
||||||
if (item.getClass() == type)
|
.filter(item -> item.getClass() == type)
|
||||||
items.add(item);
|
.forEach(items::add);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
|
@ -635,7 +635,7 @@ public class RoomUnit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIdle() {
|
public boolean isIdle() {
|
||||||
return this.idleTimer > Room.IDLE_CYCLES; //Amount of room cycles / 2 = seconds.
|
return this.idleTimer > RoomConfiguration.IDLE_CYCLES; //Amount of room cycles / 2 = seconds.
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIdleTimer() {
|
public int getIdleTimer() {
|
||||||
@ -647,7 +647,7 @@ public class RoomUnit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setIdle() {
|
public void setIdle() {
|
||||||
this.idleTimer = Room.IDLE_CYCLES + 1;
|
this.idleTimer = RoomConfiguration.IDLE_CYCLES + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void lookAtPoint(RoomTile location) {
|
public void lookAtPoint(RoomTile location) {
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.eu.habbo.habbohotel.rooms.utils;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public class HabboItemGetter {
|
||||||
|
List<IHabboItemGetter> itemGetters;
|
||||||
|
|
||||||
|
public HabboItemGetter() {
|
||||||
|
itemGetters = Arrays.asList(new BanzaiTeleporterGetter(), new TriggerGetter(), new EffectGetter(), new ConditionGetter(), new GameGateGetter(), new GameScoreboardGetter(), new GameTimerGetter(), new FreezeExitTilesGetter(), new RollerGetter(), new NestGetter(), new PetDrinkGetter(), new PetFoodGetter());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
package com.eu.habbo.habbohotel.rooms.utils;
|
||||||
|
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomSpecialTypes;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
|
|
||||||
|
public interface IHabboItemGetter {
|
||||||
|
HabboItem get(int id, RoomSpecialTypes roomSpecialTypes);
|
||||||
|
}
|
||||||
|
|
||||||
|
class BanzaiTeleporterGetter implements IHabboItemGetter {
|
||||||
|
public HabboItem get(int id, RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
return roomSpecialTypes.getBanzaiTeleporter(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TriggerGetter implements IHabboItemGetter {
|
||||||
|
public HabboItem get(int id, RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
return roomSpecialTypes.getTrigger(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class EffectGetter implements IHabboItemGetter {
|
||||||
|
public HabboItem get(int id, RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
return roomSpecialTypes.getEffect(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ConditionGetter implements IHabboItemGetter {
|
||||||
|
public HabboItem get(int id, RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
return roomSpecialTypes.getCondition(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class GameGateGetter implements IHabboItemGetter {
|
||||||
|
public HabboItem get(int id, RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
return roomSpecialTypes.getGameGate(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class GameScoreboardGetter implements IHabboItemGetter {
|
||||||
|
public HabboItem get(int id, RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
return roomSpecialTypes.getGameScorebord(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class GameTimerGetter implements IHabboItemGetter {
|
||||||
|
public HabboItem get(int id, RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
return roomSpecialTypes.getGameTimer(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FreezeExitTilesGetter implements IHabboItemGetter {
|
||||||
|
public HabboItem get(int id, RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
return roomSpecialTypes.getFreezeExitTiles().get(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RollerGetter implements IHabboItemGetter {
|
||||||
|
public HabboItem get(int id, RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
return roomSpecialTypes.getRoller(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class NestGetter implements IHabboItemGetter {
|
||||||
|
public HabboItem get(int id, RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
return roomSpecialTypes.getNest(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PetDrinkGetter implements IHabboItemGetter {
|
||||||
|
public HabboItem get(int id, RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
return roomSpecialTypes.getPetDrink(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PetFoodGetter implements IHabboItemGetter {
|
||||||
|
public HabboItem get(int id, RoomSpecialTypes roomSpecialTypes) {
|
||||||
|
return roomSpecialTypes.getPetFood(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,213 @@
|
|||||||
|
package com.eu.habbo.habbohotel.rooms.utils;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.database.DatabaseConstants;
|
||||||
|
import com.eu.habbo.habbohotel.bots.Bot;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.InteractionWired;
|
||||||
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
|
import com.eu.habbo.habbohotel.pets.PetManager;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.*;
|
||||||
|
import com.eu.habbo.habbohotel.users.DanceType;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
|
import gnu.trove.list.array.TIntArrayList;
|
||||||
|
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||||
|
import gnu.trove.set.hash.THashSet;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import static com.eu.habbo.database.DatabaseConstants.CAUGHT_SQL_EXCEPTION;
|
||||||
|
import static com.eu.habbo.habbohotel.rooms.RoomConfiguration.CAUGHT_EXCEPTION;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class RoomLoader {
|
||||||
|
public static TIntArrayList loadRights(Connection connection, int id) {
|
||||||
|
TIntArrayList rights = new TIntArrayList();
|
||||||
|
try (PreparedStatement statement = connection.prepareStatement("SELECT user_id FROM room_rights WHERE room_id = ?")) {
|
||||||
|
statement.setInt(1, id);
|
||||||
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
|
while (set.next()) {
|
||||||
|
rights.add(set.getInt(DatabaseConstants.USER_ID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error(CAUGHT_SQL_EXCEPTION, e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(CAUGHT_EXCEPTION, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rights;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TIntObjectHashMap<RoomBan> loadBans(Connection connection, int id) {
|
||||||
|
TIntObjectHashMap<RoomBan> bannedHabbos = new TIntObjectHashMap<>();
|
||||||
|
try (PreparedStatement statement = connection.prepareStatement("SELECT users.username, users.id, room_bans.* FROM room_bans INNER JOIN users ON room_bans.user_id = users.id WHERE ends > ? AND room_bans.room_id = ?")) {
|
||||||
|
statement.setInt(1, Emulator.getIntUnixTimestamp());
|
||||||
|
statement.setInt(2, id);
|
||||||
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
|
while (set.next()) {
|
||||||
|
if (bannedHabbos.containsKey(set.getInt(DatabaseConstants.USER_ID)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bannedHabbos.put(set.getInt(DatabaseConstants.USER_ID), new RoomBan(set));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error(CAUGHT_SQL_EXCEPTION, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bannedHabbos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static synchronized void loadBots(Connection connection, int id, Room room) {
|
||||||
|
try (PreparedStatement statement = connection.prepareStatement("SELECT users.username AS owner_name, bots.* FROM bots INNER JOIN users ON bots.user_id = users.id WHERE room_id = ?")) {
|
||||||
|
statement.setInt(1, id);
|
||||||
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
|
while (set.next()) {
|
||||||
|
Bot b = Emulator.getGameEnvironment().getBotManager().loadBot(set);
|
||||||
|
|
||||||
|
if (b != null) {
|
||||||
|
b.setRoom(room);
|
||||||
|
b.setRoomUnit(new RoomUnit());
|
||||||
|
b.getRoomUnit().setPathFinderRoom(room);
|
||||||
|
b.getRoomUnit().setLocation(room.getLayout().getTile((short) set.getInt("x"), (short) set.getInt("y")));
|
||||||
|
if (b.getRoomUnit().getCurrentLocation() == null || b.getRoomUnit().getCurrentLocation().getState() == RoomTileState.INVALID) {
|
||||||
|
b.getRoomUnit().setZ(room.getLayout().getDoorTile().getStackHeight());
|
||||||
|
b.getRoomUnit().setLocation(room.getLayout().getDoorTile());
|
||||||
|
b.getRoomUnit().setRotation(RoomUserRotation.fromValue(room.getLayout().getDoorDirection()));
|
||||||
|
} else {
|
||||||
|
b.getRoomUnit().setZ(set.getDouble("z"));
|
||||||
|
b.getRoomUnit().setPreviousLocationZ(set.getDouble("z"));
|
||||||
|
b.getRoomUnit().setRotation(RoomUserRotation.values()[set.getInt("rot")]);
|
||||||
|
}
|
||||||
|
b.getRoomUnit().setRoomUnitType(RoomUnitType.BOT);
|
||||||
|
b.getRoomUnit().setDanceType(DanceType.values()[set.getInt("dance")]);
|
||||||
|
b.getRoomUnit().setInRoom(true);
|
||||||
|
room.giveEffect(b.getRoomUnit(), set.getInt("effect"), Integer.MAX_VALUE);
|
||||||
|
room.addBot(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error(CAUGHT_SQL_EXCEPTION, e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(CAUGHT_EXCEPTION, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static synchronized void loadPets(Connection connection, int id, Room room) {
|
||||||
|
|
||||||
|
|
||||||
|
try (PreparedStatement statement = connection.prepareStatement("SELECT users.username as pet_owner_name, users_pets.* FROM users_pets INNER JOIN users ON users_pets.user_id = users.id WHERE room_id = ?")) {
|
||||||
|
statement.setInt(1, id);
|
||||||
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
|
while (set.next()) {
|
||||||
|
Pet pet = PetManager.loadPet(set);
|
||||||
|
pet.setRoom(room);
|
||||||
|
pet.setRoomUnit(new RoomUnit());
|
||||||
|
pet.getRoomUnit().setPathFinderRoom(room);
|
||||||
|
pet.getRoomUnit().setLocation(room.getLayout().getTile((short) set.getInt("x"), (short) set.getInt("y")));
|
||||||
|
if (pet.getRoomUnit().getCurrentLocation() == null || pet.getRoomUnit().getCurrentLocation().getState() == RoomTileState.INVALID) {
|
||||||
|
pet.getRoomUnit().setZ(room.getLayout().getDoorTile().getStackHeight());
|
||||||
|
pet.getRoomUnit().setLocation(room.getLayout().getDoorTile());
|
||||||
|
pet.getRoomUnit().setRotation(RoomUserRotation.fromValue(room.getLayout().getDoorDirection()));
|
||||||
|
} else {
|
||||||
|
pet.getRoomUnit().setZ(set.getDouble("z"));
|
||||||
|
pet.getRoomUnit().setRotation(RoomUserRotation.values()[set.getInt("rot")]);
|
||||||
|
}
|
||||||
|
pet.getRoomUnit().setRoomUnitType(RoomUnitType.PET);
|
||||||
|
pet.getRoomUnit().setCanWalk(true);
|
||||||
|
room.addPet(pet);
|
||||||
|
|
||||||
|
room.getFurniOwnerNames().put(pet.getUserId(), set.getString("pet_owner_name"));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error(CAUGHT_SQL_EXCEPTION, e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(CAUGHT_EXCEPTION, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static synchronized void loadWordFilter(Connection connection, int id, THashSet<String> wordFilterWords) {
|
||||||
|
wordFilterWords.clear();
|
||||||
|
|
||||||
|
try (PreparedStatement statement = connection.prepareStatement("SELECT * FROM room_wordfilter WHERE room_id = ?")) {
|
||||||
|
statement.setInt(1, id);
|
||||||
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
|
while (set.next()) {
|
||||||
|
wordFilterWords.add(set.getString("word"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error(CAUGHT_SQL_EXCEPTION, e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(CAUGHT_EXCEPTION, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static synchronized void loadHeightmap(Room room, int id) {
|
||||||
|
try {
|
||||||
|
if (room.getLayout() != null) {
|
||||||
|
for (short x = 0; x < room.getLayout().getMapSizeX(); x++) {
|
||||||
|
for (short y = 0; y < room.getLayout().getMapSizeY(); y++) {
|
||||||
|
RoomTile tile = room.getLayout().getTile(x, y);
|
||||||
|
if (tile != null) {
|
||||||
|
room.updateTile(tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.error("Unknown Room Layout for Room (ID: {})", id);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(CAUGHT_EXCEPTION, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static synchronized void loadItems(Connection connection,int id, Room room) {
|
||||||
|
try (PreparedStatement statement = connection.prepareStatement("SELECT * FROM items WHERE room_id = ?")) {
|
||||||
|
statement.setInt(1, id);
|
||||||
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
|
while (set.next()) {
|
||||||
|
room.addHabboItem(Emulator.getGameEnvironment().getItemManager().loadHabboItem(set));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error(CAUGHT_SQL_EXCEPTION, e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(CAUGHT_EXCEPTION, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static synchronized void loadWiredData(Connection connection, int id, Room room) {
|
||||||
|
try (PreparedStatement statement = connection.prepareStatement("SELECT id, wired_data FROM items WHERE room_id = ? AND wired_data<>''")) {
|
||||||
|
statement.setInt(1, id);
|
||||||
|
|
||||||
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
|
while (set.next()) {
|
||||||
|
try {
|
||||||
|
HabboItem item = room.getHabboItem(set.getInt("id"));
|
||||||
|
|
||||||
|
if (item instanceof InteractionWired interactionWired) {
|
||||||
|
interactionWired.loadWiredData(set, room);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error(CAUGHT_SQL_EXCEPTION, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error(CAUGHT_SQL_EXCEPTION, e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(CAUGHT_EXCEPTION, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -505,4 +505,6 @@ public abstract class HabboItem implements Runnable, IEventTriggers {
|
|||||||
this.getBaseItem().getLength() + (marginY * 2),
|
this.getBaseItem().getLength() + (marginY * 2),
|
||||||
this.getRotation());
|
this.getRotation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addToSpecialRoomTypes(RoomSpecialTypes roomSpecialTypes){}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionPostIt;
|
|||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionStickyPole;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionStickyPole;
|
||||||
import com.eu.habbo.habbohotel.rooms.FurnitureMovementError;
|
import com.eu.habbo.habbohotel.rooms.FurnitureMovementError;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomConfiguration;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
||||||
@ -26,7 +27,7 @@ public class PlacePostItEvent extends MessageHandler {
|
|||||||
HabboItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(itemId);
|
HabboItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(itemId);
|
||||||
|
|
||||||
if (item instanceof InteractionPostIt) {
|
if (item instanceof InteractionPostIt) {
|
||||||
if (room.getPostItNotes().size() < Room.MAXIMUM_POSTITNOTES) {
|
if (room.getPostItNotes().size() < RoomConfiguration.MAXIMUM_POSTITNOTES) {
|
||||||
room.addHabboItem(item);
|
room.addHabboItem(item);
|
||||||
item.setExtradata("FFFF33");
|
item.setExtradata("FFFF33");
|
||||||
item.setRoomId(this.client.getHabbo().getHabboInfo().getCurrentRoom().getId());
|
item.setRoomId(this.client.getHabbo().getHabboInfo().getCurrentRoom().getId());
|
||||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.messages.incoming.rooms.items;
|
|||||||
|
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionStackHelper;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionStackHelper;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomConfiguration;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
@ -34,7 +35,7 @@ public class SetCustomStackingHeightEvent extends MessageHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
stackerHeight = Math.min(Math.max(stackerHeight, itemTile.getZ() * 100.0), Room.MAXIMUM_FURNI_HEIGHT * 100);
|
stackerHeight = Math.min(Math.max(stackerHeight, itemTile.getZ() * 100.0), RoomConfiguration.MAXIMUM_FURNI_HEIGHT * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
double height = 0;
|
double height = 0;
|
||||||
|
@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWired;
|
|||||||
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionMonsterPlantSeed;
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionMonsterPlantSeed;
|
||||||
import com.eu.habbo.habbohotel.pets.MonsterplantPet;
|
import com.eu.habbo.habbohotel.pets.MonsterplantPet;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomConfiguration;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer;
|
import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer;
|
||||||
@ -50,7 +51,7 @@ public class UseFurnitureEvent extends MessageHandler {
|
|||||||
if (handleMonsterPlantSeed(room, item)) return;
|
if (handleMonsterPlantSeed(room, item)) return;
|
||||||
|
|
||||||
|
|
||||||
if (PET_PRESENTS.contains(item.getBaseItem().getName().toLowerCase()) && room.getCurrentPets().size() < Room.MAXIMUM_PETS) {
|
if (PET_PRESENTS.contains(item.getBaseItem().getName().toLowerCase()) && room.getCurrentPets().size() < RoomConfiguration.MAXIMUM_PETS) {
|
||||||
this.client.sendResponse(new OpenPetPackageRequestedMessageComposer(item));
|
this.client.sendResponse(new OpenPetPackageRequestedMessageComposer(item));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class PlacePetEvent extends MessageHandler {
|
|||||||
if (pet == null) {
|
if (pet == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (room.getCurrentPets().size() >= Room.MAXIMUM_PETS && !this.client.getHabbo().hasRight(Permission.ACC_UNLIMITED_PETS)) {
|
if (room.getCurrentPets().size() >= RoomConfiguration.MAXIMUM_PETS && !this.client.getHabbo().hasRight(Permission.ACC_UNLIMITED_PETS)) {
|
||||||
this.client.sendResponse(new PetPlacingErrorComposer(PetPlacingErrorComposer.ROOM_ERROR_MAX_PETS));
|
this.client.sendResponse(new PetPlacingErrorComposer(PetPlacingErrorComposer.ROOM_ERROR_MAX_PETS));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.eu.habbo.messages.outgoing.rooms.items;
|
package com.eu.habbo.messages.outgoing.rooms.items;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomLayout;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
@ -50,7 +51,8 @@ public class FloorItemOnRollerComposer extends MessageComposer {
|
|||||||
this.response.appendInt(this.roller != null ? this.roller.getId() : -1);
|
this.response.appendInt(this.roller != null ? this.roller.getId() : -1);
|
||||||
|
|
||||||
if (this.oldLocation == null) {
|
if (this.oldLocation == null) {
|
||||||
this.item.onMove(this.room, this.room.getLayout().getTile(this.item.getX(), this.item.getY()), this.newLocation);
|
RoomLayout roomLayout = this.room.getLayout();
|
||||||
|
this.item.onMove(this.room, roomLayout.getTile(this.item.getX(), this.item.getY()), this.newLocation);
|
||||||
this.item.setX(this.newLocation.getX());
|
this.item.setX(this.newLocation.getX());
|
||||||
this.item.setY(this.newLocation.getY());
|
this.item.setY(this.newLocation.getY());
|
||||||
this.item.setZ(this.item.getZ() + this.heightOffset);
|
this.item.setZ(this.item.getZ() + this.heightOffset);
|
||||||
@ -58,8 +60,8 @@ public class FloorItemOnRollerComposer extends MessageComposer {
|
|||||||
|
|
||||||
//TODO This is bad
|
//TODO This is bad
|
||||||
//
|
//
|
||||||
THashSet<RoomTile> tiles = this.room.getLayout().getTilesAt(this.room.getLayout().getTile(oldX, oldY), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation());
|
THashSet<RoomTile> tiles = roomLayout.getTilesAt(roomLayout.getTile(oldX, oldY), this.item);
|
||||||
tiles.addAll(this.room.getLayout().getTilesAt(this.room.getLayout().getTile(this.item.getX(), this.item.getY()), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation()));
|
tiles.addAll(roomLayout.getTilesAt(roomLayout.getTile(this.item), this.item));
|
||||||
this.room.updateTiles(tiles);
|
this.room.updateTiles(tiles);
|
||||||
//this.room.sendComposer(new UpdateStackHeightComposer(oldX, oldY, this.room.getStackHeight(oldX, oldY, true)).compose());
|
//this.room.sendComposer(new UpdateStackHeightComposer(oldX, oldY, this.room.getStackHeight(oldX, oldY, true)).compose());
|
||||||
//
|
//
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.eu.habbo.messages.outgoing.rooms.users;
|
package com.eu.habbo.messages.outgoing.rooms.users;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomConfiguration;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
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;
|
||||||
@ -21,7 +22,7 @@ public class UserNameChangedMessageComposer extends MessageComposer {
|
|||||||
public UserNameChangedMessageComposer(Habbo habbo, boolean includePrefix) {
|
public UserNameChangedMessageComposer(Habbo habbo, boolean includePrefix) {
|
||||||
this.userId = habbo.getHabboInfo().getId();
|
this.userId = habbo.getHabboInfo().getId();
|
||||||
this.roomId = habbo.getRoomUnit().getId();
|
this.roomId = habbo.getRoomUnit().getId();
|
||||||
this.name = (includePrefix ? Room.PREFIX_FORMAT.replace("%color%", habbo.getHabboInfo().getPermissionGroup().getPrefixColor()).replace("%prefix%", habbo.getHabboInfo().getPermissionGroup().getPrefix()) : "") + habbo.getHabboInfo().getUsername();
|
this.name = (includePrefix ? RoomConfiguration.PREFIX_FORMAT.replace("%color%", habbo.getHabboInfo().getPermissionGroup().getPrefixColor()).replace("%prefix%", habbo.getHabboInfo().getPermissionGroup().getPrefix()) : "") + habbo.getHabboInfo().getUsername();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -76,8 +76,8 @@ public class PluginManager {
|
|||||||
Messenger.SAVE_PRIVATE_CHATS = Emulator.getConfig().getBoolean("save.private.chats", false);
|
Messenger.SAVE_PRIVATE_CHATS = Emulator.getConfig().getBoolean("save.private.chats", false);
|
||||||
PacketManager.DEBUG_SHOW_PACKETS = Emulator.getConfig().getBoolean("debug.show.packets");
|
PacketManager.DEBUG_SHOW_PACKETS = Emulator.getConfig().getBoolean("debug.show.packets");
|
||||||
PacketManager.MULTI_THREADED_PACKET_HANDLING = Emulator.getConfig().getBoolean("io.client.multithreaded.handler");
|
PacketManager.MULTI_THREADED_PACKET_HANDLING = Emulator.getConfig().getBoolean("io.client.multithreaded.handler");
|
||||||
Room.HABBO_CHAT_DELAY = Emulator.getConfig().getBoolean("room.chat.delay", false);
|
RoomConfiguration.HABBO_CHAT_DELAY = Emulator.getConfig().getBoolean("room.chat.delay", false);
|
||||||
Room.MUTEAREA_CAN_WHISPER = Emulator.getConfig().getBoolean("room.chat.mutearea.allow_whisper", false);
|
RoomConfiguration.MUTEAREA_CAN_WHISPER = Emulator.getConfig().getBoolean("room.chat.mutearea.allow_whisper", false);
|
||||||
RoomChatMessage.SAVE_ROOM_CHATS = Emulator.getConfig().getBoolean("save.room.chats", false);
|
RoomChatMessage.SAVE_ROOM_CHATS = Emulator.getConfig().getBoolean("save.room.chats", false);
|
||||||
RoomLayout.MAXIMUM_STEP_HEIGHT = Emulator.getConfig().getDouble("pathfinder.step.maximum.height", 1.1);
|
RoomLayout.MAXIMUM_STEP_HEIGHT = Emulator.getConfig().getDouble("pathfinder.step.maximum.height", 1.1);
|
||||||
RoomLayout.ALLOW_FALLING = Emulator.getConfig().getBoolean("pathfinder.step.allow.falling", true);
|
RoomLayout.ALLOW_FALLING = Emulator.getConfig().getBoolean("pathfinder.step.allow.falling", true);
|
||||||
@ -99,14 +99,14 @@ public class PluginManager {
|
|||||||
HabboInventory.MAXIMUM_ITEMS = Emulator.getConfig().getInt("hotel.inventory.max.items");
|
HabboInventory.MAXIMUM_ITEMS = Emulator.getConfig().getInt("hotel.inventory.max.items");
|
||||||
Messenger.MAXIMUM_FRIENDS = Emulator.getConfig().getInt("hotel.users.max.friends", 300);
|
Messenger.MAXIMUM_FRIENDS = Emulator.getConfig().getInt("hotel.users.max.friends", 300);
|
||||||
Messenger.MAXIMUM_FRIENDS_HC = Emulator.getConfig().getInt("hotel.users.max.friends.hc", 1100);
|
Messenger.MAXIMUM_FRIENDS_HC = Emulator.getConfig().getInt("hotel.users.max.friends.hc", 1100);
|
||||||
Room.MAXIMUM_BOTS = Emulator.getConfig().getInt("hotel.max.bots.room");
|
RoomConfiguration.MAXIMUM_BOTS = Emulator.getConfig().getInt("hotel.max.bots.room");
|
||||||
Room.MAXIMUM_PETS = Emulator.getConfig().getInt("hotel.pets.max.room");
|
RoomConfiguration.MAXIMUM_PETS = Emulator.getConfig().getInt("hotel.pets.max.room");
|
||||||
Room.MAXIMUM_FURNI = Emulator.getConfig().getInt("hotel.room.furni.max", 2500);
|
RoomConfiguration.MAXIMUM_FURNI = Emulator.getConfig().getInt("hotel.room.furni.max", 2500);
|
||||||
Room.MAXIMUM_POSTITNOTES = Emulator.getConfig().getInt("hotel.room.stickies.max", 200);
|
RoomConfiguration.MAXIMUM_POSTITNOTES = Emulator.getConfig().getInt("hotel.room.stickies.max", 200);
|
||||||
Room.HAND_ITEM_TIME = Emulator.getConfig().getInt("hotel.rooms.handitem.time");
|
RoomConfiguration.HAND_ITEM_TIME = Emulator.getConfig().getInt("hotel.rooms.handitem.time");
|
||||||
Room.IDLE_CYCLES = Emulator.getConfig().getInt("hotel.roomuser.idle.cycles", 240);
|
RoomConfiguration.IDLE_CYCLES = Emulator.getConfig().getInt("hotel.roomuser.idle.cycles", 240);
|
||||||
Room.IDLE_CYCLES_KICK = Emulator.getConfig().getInt("hotel.roomuser.idle.cycles.kick", 480);
|
RoomConfiguration.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);
|
RoomConfiguration.ROLLERS_MAXIMUM_ROLL_AVATARS = Emulator.getConfig().getInt("hotel.room.rollers.roll_avatars.max", 1);
|
||||||
RoomManager.MAXIMUM_ROOMS_USER = Emulator.getConfig().getInt("hotel.users.max.rooms", 50);
|
RoomManager.MAXIMUM_ROOMS_USER = Emulator.getConfig().getInt("hotel.users.max.rooms", 50);
|
||||||
RoomManager.MAXIMUM_ROOMS_HC = Emulator.getConfig().getInt("hotel.users.max.rooms.hc", 75);
|
RoomManager.MAXIMUM_ROOMS_HC = Emulator.getConfig().getInt("hotel.users.max.rooms.hc", 75);
|
||||||
RoomManager.HOME_ROOM_ID = Emulator.getConfig().getInt("hotel.home.room");
|
RoomManager.HOME_ROOM_ID = Emulator.getConfig().getInt("hotel.home.room");
|
||||||
@ -129,7 +129,7 @@ public class PluginManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HabboManager.WELCOME_MESSAGE = Emulator.getConfig().getValue("hotel.welcome.alert.message").replace("<br>", "<br/>").replace("<br />", "<br/>").replace("\\r", "\r").replace("\\n", "\n").replace("\\t", "\t");
|
HabboManager.WELCOME_MESSAGE = Emulator.getConfig().getValue("hotel.welcome.alert.message").replace("<br>", "<br/>").replace("<br />", "<br/>").replace("\\r", "\r").replace("\\n", "\n").replace("\\t", "\t");
|
||||||
Room.PREFIX_FORMAT = Emulator.getConfig().getValue("room.chat.prefix.format");
|
RoomConfiguration.PREFIX_FORMAT = Emulator.getConfig().getValue("room.chat.prefix.format");
|
||||||
UpdateFloorPropertiesEvent.MAXIMUM_FLOORPLAN_WIDTH_LENGTH = Emulator.getConfig().getInt("hotel.floorplan.max.widthlength");
|
UpdateFloorPropertiesEvent.MAXIMUM_FLOORPLAN_WIDTH_LENGTH = Emulator.getConfig().getInt("hotel.floorplan.max.widthlength");
|
||||||
UpdateFloorPropertiesEvent.MAXIMUM_FLOORPLAN_SIZE = Emulator.getConfig().getInt("hotel.floorplan.max.totalarea");
|
UpdateFloorPropertiesEvent.MAXIMUM_FLOORPLAN_SIZE = Emulator.getConfig().getInt("hotel.floorplan.max.totalarea");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user