mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-18 23:46:28 +01:00
Room.java clean-up
This commit is contained in:
parent
2eec0dc0ba
commit
4d81fc9dd0
@ -14,10 +14,10 @@ import com.eu.habbo.habbohotel.items.interactions.*;
|
|||||||
import com.eu.habbo.habbohotel.modtool.ScripterManager;
|
import com.eu.habbo.habbohotel.modtool.ScripterManager;
|
||||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboBadge;
|
import com.eu.habbo.habbohotel.users.HabboBadge;
|
||||||
import com.eu.habbo.habbohotel.users.HabboGender;
|
import com.eu.habbo.habbohotel.users.HabboGender;
|
||||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
|
||||||
import com.eu.habbo.messages.outgoing.catalog.*;
|
import com.eu.habbo.messages.outgoing.catalog.*;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
||||||
@ -846,7 +846,7 @@ public class CatalogManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
THashSet<RoomItem> itemsList = new THashSet<>();
|
HashSet<RoomItem> itemsList = new HashSet<>();
|
||||||
|
|
||||||
|
|
||||||
if (amount > 1 && !CatalogItem.haveOffer(item)) {
|
if (amount > 1 && !CatalogItem.haveOffer(item)) {
|
||||||
|
@ -73,7 +73,7 @@ public class RoomBundleLayout extends SingleBundle {
|
|||||||
|
|
||||||
THashMap<Item, Integer> items = new THashMap<>();
|
THashMap<Item, Integer> items = new THashMap<>();
|
||||||
|
|
||||||
for (RoomItem i : this.room.getFloorItems()) {
|
for (RoomItem i : this.room.getRoomItemManager().getFloorItems().values()) {
|
||||||
if (!items.contains(i.getBaseItem())) {
|
if (!items.contains(i.getBaseItem())) {
|
||||||
items.put(i.getBaseItem(), 0);
|
items.put(i.getBaseItem(), 0);
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ public class RoomBundleLayout extends SingleBundle {
|
|||||||
items.put(i.getBaseItem(), items.get(i.getBaseItem()) + 1);
|
items.put(i.getBaseItem(), items.get(i.getBaseItem()) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RoomItem i : this.room.getWallItems()) {
|
for (RoomItem i : this.room.getRoomItemManager().getWallItems().values()) {
|
||||||
if (!items.contains(i.getBaseItem())) {
|
if (!items.contains(i.getBaseItem())) {
|
||||||
items.put(i.getBaseItem(), 0);
|
items.put(i.getBaseItem(), 0);
|
||||||
}
|
}
|
||||||
@ -141,11 +141,11 @@ public class RoomBundleLayout extends SingleBundle {
|
|||||||
|
|
||||||
this.room.save();
|
this.room.save();
|
||||||
|
|
||||||
for (RoomItem item : this.room.getFloorItems()) {
|
for (RoomItem item : this.room.getRoomItemManager().getFloorItems().values()) {
|
||||||
item.run();
|
item.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RoomItem item : this.room.getWallItems()) {
|
for (RoomItem item : this.room.getRoomItemManager().getWallItems().values()) {
|
||||||
item.run();
|
item.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,9 +15,8 @@ public class EjectAllCommand extends Command {
|
|||||||
Room room = gameClient.getHabbo().getRoomUnit().getRoom();
|
Room room = gameClient.getHabbo().getRoomUnit().getRoom();
|
||||||
|
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
if (room.getRoomInfo().isRoomOwner(gameClient.getHabbo())
|
if (room.getRoomInfo().isRoomOwner(gameClient.getHabbo()) || (room.getRoomInfo().hasGuild() && room.getGuildRightLevel(gameClient.getHabbo()).equals(RoomRightLevels.GUILD_ADMIN))) {
|
||||||
|| (room.getRoomInfo().hasGuild() && room.getGuildRightLevel(gameClient.getHabbo()).equals(RoomRightLevels.GUILD_ADMIN))) {
|
room.getRoomItemManager().ejectAllFurni(gameClient.getHabbo());
|
||||||
room.ejectAllFurni(gameClient.getHabbo());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,11 +18,11 @@ public class PickallCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (room.getRoomInfo().isRoomOwner(gameClient.getHabbo())) {
|
if (room.getRoomInfo().isRoomOwner(gameClient.getHabbo())) {
|
||||||
room.ejectAllFurni();
|
room.getRoomItemManager().ejectAllFurni();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
room.ejectUserFurni(gameClient.getHabbo().getHabboInfo().getId());
|
room.getRoomItemManager().ejectUserFurni(gameClient.getHabbo().getHabboInfo().getId());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ public abstract class Game implements Runnable {
|
|||||||
this.state = GameState.IDLE;
|
this.state = GameState.IDLE;
|
||||||
|
|
||||||
boolean gamesActive = false;
|
boolean gamesActive = false;
|
||||||
for (RoomItem timer : room.getFloorItems()) {
|
for (RoomItem timer : room.getRoomItemManager().getFloorItems().values()) {
|
||||||
if (timer instanceof InteractionGameTimer) {
|
if (timer instanceof InteractionGameTimer) {
|
||||||
if (((InteractionGameTimer) timer).isRunning())
|
if (((InteractionGameTimer) timer).isRunning())
|
||||||
gamesActive = true;
|
gamesActive = true;
|
||||||
|
@ -11,8 +11,8 @@ import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.scoreboards
|
|||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUserAction;
|
import com.eu.habbo.habbohotel.rooms.RoomUserAction;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||||
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.users.ExpressionMessageComposer;
|
import com.eu.habbo.messages.outgoing.rooms.users.ExpressionMessageComposer;
|
||||||
import com.eu.habbo.threading.runnables.BattleBanzaiTilesFlicker;
|
import com.eu.habbo.threading.runnables.BattleBanzaiTilesFlicker;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
@ -226,7 +226,7 @@ public class BattleBanzaiGame extends Game {
|
|||||||
|
|
||||||
private synchronized void resetMap() {
|
private synchronized void resetMap() {
|
||||||
this.tileCount = 0;
|
this.tileCount = 0;
|
||||||
for (RoomItem item : this.room.getFloorItems()) {
|
for (RoomItem item : this.room.getRoomItemManager().getFloorItems().values()) {
|
||||||
if (item instanceof InteractionBattleBanzaiTile) {
|
if (item instanceof InteractionBattleBanzaiTile) {
|
||||||
item.setExtradata("1");
|
item.setExtradata("1");
|
||||||
this.room.updateItemState(item);
|
this.room.updateItemState(item);
|
||||||
|
@ -78,7 +78,7 @@ public class FreezeGame extends Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
synchronized void resetMap() {
|
synchronized void resetMap() {
|
||||||
for (RoomItem item : this.room.getFloorItems()) {
|
for (RoomItem item : this.room.getRoomItemManager().getFloorItems().values()) {
|
||||||
if (item instanceof InteractionFreezeBlock || item instanceof InteractionFreezeScoreboard) {
|
if (item instanceof InteractionFreezeBlock || item instanceof InteractionFreezeScoreboard) {
|
||||||
item.setExtradata("0");
|
item.setExtradata("0");
|
||||||
this.room.updateItemState(item);
|
this.room.updateItemState(item);
|
||||||
|
@ -219,7 +219,7 @@ public class InteractionDefault extends RoomItem {
|
|||||||
|
|
||||||
if (!habbo.getHabboStats().isRentingSpace()) return false;
|
if (!habbo.getHabboStats().isRentingSpace()) return false;
|
||||||
|
|
||||||
RoomItem rentSpace = room.getHabboItem(habbo.getHabboStats().getRentedItemId());
|
RoomItem rentSpace = room.getRoomItemManager().getRoomItemById(habbo.getHabboStats().getRentedItemId());
|
||||||
|
|
||||||
return rentSpace != null && RoomLayout.squareInSquare(RoomLayout.getRectangle(rentSpace.getX(), rentSpace.getY(), rentSpace.getBaseItem().getWidth(), rentSpace.getBaseItem().getLength(), rentSpace.getRotation()), RoomLayout.getRectangle(this.getX(), this.getY(), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()));
|
return rentSpace != null && RoomLayout.squareInSquare(RoomLayout.getRectangle(rentSpace.getX(), rentSpace.getY(), rentSpace.getBaseItem().getWidth(), rentSpace.getBaseItem().getLength(), rentSpace.getRotation()), RoomLayout.getRectangle(this.getX(), this.getY(), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()));
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class InteractionFXBox extends InteractionDefault {
|
|||||||
|
|
||||||
this.setExtradata("1");
|
this.setExtradata("1");
|
||||||
room.updateItemState(this);
|
room.updateItemState(this);
|
||||||
room.removeHabboItem(this);
|
room.getRoomItemManager().removeRoomItem(this);
|
||||||
RoomItem item = this;
|
RoomItem item = this;
|
||||||
Emulator.getThreading().run(() -> {
|
Emulator.getThreading().run(() -> {
|
||||||
new QueryDeleteHabboItem(item.getId()).run();
|
new QueryDeleteHabboItem(item.getId()).run();
|
||||||
|
@ -4,15 +4,15 @@ import com.eu.habbo.Emulator;
|
|||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import gnu.trove.set.hash.THashSet;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class InteractionGift extends RoomItem {
|
public class InteractionGift extends RoomItem {
|
||||||
@ -121,8 +121,8 @@ public class InteractionGift extends RoomItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public THashSet<RoomItem> loadItems() {
|
public HashSet<RoomItem> loadItems() {
|
||||||
THashSet<RoomItem> items = new THashSet<>();
|
HashSet<RoomItem> items = new HashSet<>();
|
||||||
for (int anItemId : this.itemId) {
|
for (int anItemId : this.itemId) {
|
||||||
if (anItemId == 0)
|
if (anItemId == 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -156,7 +156,7 @@ public class InteractionPetBreedingNest extends RoomItem {
|
|||||||
offspring.setNeedsUpdate(true);
|
offspring.setNeedsUpdate(true);
|
||||||
offspring.run();
|
offspring.run();
|
||||||
InteractionPetBreedingNest.this.freePets();
|
InteractionPetBreedingNest.this.freePets();
|
||||||
habbo.getRoomUnit().getRoom().removeHabboItem(box);
|
habbo.getRoomUnit().getRoom().getRoomItemManager().removeRoomItem(box);
|
||||||
habbo.getClient().sendResponse(new NestBreedingSuccessComposer(offspring.getId(), Emulator.getGameEnvironment().getPetManager().getRarityForOffspring(offspring)));
|
habbo.getClient().sendResponse(new NestBreedingSuccessComposer(offspring.getId(), Emulator.getGameEnvironment().getPetManager().getRarityForOffspring(offspring)));
|
||||||
|
|
||||||
if (box.getBaseItem().getName().startsWith("pet_breeding_")) {
|
if (box.getBaseItem().getName().startsWith("pet_breeding_")) {
|
||||||
|
@ -61,7 +61,7 @@ public class WiredSettings implements IWiredSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < this.itemIds.size(); i++) {
|
for(int i = 0; i < this.itemIds.size(); i++) {
|
||||||
RoomItem item = room.getHabboItem(this.itemIds.get(i));
|
RoomItem item = room.getRoomItemManager().getRoomItemById(this.itemIds.get(i));
|
||||||
|
|
||||||
if(item == null || item.getRoomId() == 0) {
|
if(item == null || item.getRoomId() == 0) {
|
||||||
this.itemIds.remove(i);
|
this.itemIds.remove(i);
|
||||||
|
@ -37,7 +37,11 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bot bot = bots.get(0);
|
Bot bot = bots.get(0);
|
||||||
this.getWiredSettings().getItems(room).removeIf(item -> item == null || item.getRoomId() != this.getRoomId() || Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(this.getRoomId()).getHabboItem(item.getId()) == null);
|
this.getWiredSettings().getItems(room).removeIf(item -> {
|
||||||
|
if (item == null || item.getRoomId() != this.getRoomId()) return true;
|
||||||
|
Room room1 = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(this.getRoomId());
|
||||||
|
return room1.getRoomItemManager().getRoomItemById(item.getId()) == null;
|
||||||
|
});
|
||||||
|
|
||||||
// Bots shouldn't walk to the tile they are already standing on
|
// Bots shouldn't walk to the tile they are already standing on
|
||||||
List<RoomItem> possibleItems = this.getWiredSettings().getItems(room).stream()
|
List<RoomItem> possibleItems = this.getWiredSettings().getItems(room).stream()
|
||||||
|
@ -106,7 +106,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
|
|||||||
if(room.getRoomItemManager().furnitureFitsAt(newTargetTile, item, setting.getRotation(), false) != FurnitureMovementError.NONE)
|
if(room.getRoomItemManager().furnitureFitsAt(newTargetTile, item, setting.getRotation(), false) != FurnitureMovementError.NONE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
room.getRoomItemManager().moveFurniTo(item, newTargetTile, setting.getRotation(), null, true, true);
|
room.getRoomItemManager().moveItemTo(item, newTargetTile, setting.getRotation(), null, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasRoomUnits = false;
|
boolean hasRoomUnits = false;
|
||||||
@ -126,7 +126,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
|
|||||||
if (!hasRoomUnits) {
|
if (!hasRoomUnits) {
|
||||||
RoomTile oldLocation = room.getLayout().getTile(item.getX(), item.getY());
|
RoomTile oldLocation = room.getLayout().getTile(item.getX(), item.getY());
|
||||||
double oldZ = item.getZ();
|
double oldZ = item.getZ();
|
||||||
if (room.getRoomItemManager().moveFurniTo(item, newTargetTile, item.getRotation(), null, false, true) == FurnitureMovementError.NONE) {
|
if (room.getRoomItemManager().moveItemTo(item, newTargetTile, item.getRotation(), null, false, true) == FurnitureMovementError.NONE) {
|
||||||
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, targetTile, item.getZ(), 0, room).compose());
|
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, targetTile, item.getZ(), 0, room).compose());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
|
|||||||
|
|
||||||
if(rotation && !position) {
|
if(rotation && !position) {
|
||||||
if (item.getRotation() != furniSettings.getRotation() && room.getRoomItemManager().furnitureFitsAt(oldLocation, item, furniSettings.getRotation(), false) == FurnitureMovementError.NONE) {
|
if (item.getRotation() != furniSettings.getRotation() && room.getRoomItemManager().furnitureFitsAt(oldLocation, item, furniSettings.getRotation(), false) == FurnitureMovementError.NONE) {
|
||||||
room.getRoomItemManager().moveFurniTo(item, oldLocation, furniSettings.getRotation(), null, true, true);
|
room.getRoomItemManager().moveItemTo(item, oldLocation, furniSettings.getRotation(), null, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(position) {
|
else if(position) {
|
||||||
@ -77,7 +77,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
|
|||||||
|
|
||||||
if (newLocation != null && newLocation.getState() != RoomTileState.INVALID && (newLocation != oldLocation || newRotation != item.getRotation()) && room.getRoomItemManager().furnitureFitsAt(newLocation, item, newRotation, true) == FurnitureMovementError.NONE) {
|
if (newLocation != null && newLocation.getState() != RoomTileState.INVALID && (newLocation != oldLocation || newRotation != item.getRotation()) && room.getRoomItemManager().furnitureFitsAt(newLocation, item, newRotation, true) == FurnitureMovementError.NONE) {
|
||||||
boolean sendUpdates = !slideAnimation;
|
boolean sendUpdates = !slideAnimation;
|
||||||
if (room.getRoomItemManager().moveFurniTo(item, newLocation, newRotation, null, sendUpdates, true) == FurnitureMovementError.NONE) {
|
if (room.getRoomItemManager().moveItemTo(item, newLocation, newRotation, null, sendUpdates, true) == FurnitureMovementError.NONE) {
|
||||||
if (slideAnimation) {
|
if (slideAnimation) {
|
||||||
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getZ(), 0, room).compose());
|
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getZ(), 0, room).compose());
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
|
|||||||
double oldZ = item.getZ();
|
double oldZ = item.getZ();
|
||||||
|
|
||||||
if (newLocation != null && newLocation.getState() != RoomTileState.INVALID && newLocation != oldLocation && room.getRoomItemManager().furnitureFitsAt(newLocation, item, item.getRotation(), true) == FurnitureMovementError.NONE) {
|
if (newLocation != null && newLocation.getState() != RoomTileState.INVALID && newLocation != oldLocation && room.getRoomItemManager().furnitureFitsAt(newLocation, item, item.getRotation(), true) == FurnitureMovementError.NONE) {
|
||||||
if (room.getRoomItemManager().moveFurniTo(item, newLocation, item.getRotation(), null, false, true) == FurnitureMovementError.NONE) {
|
if (room.getRoomItemManager().moveItemTo(item, newLocation, item.getRotation(), null, false, true) == FurnitureMovementError.NONE) {
|
||||||
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getZ(), 0, room).compose());
|
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getZ(), 0, room).compose());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
|
|||||||
if(newTile != null) {
|
if(newTile != null) {
|
||||||
lastDirections.put(item.getId(), moveDirection);
|
lastDirections.put(item.getId(), moveDirection);
|
||||||
if (newTile.getState() != RoomTileState.INVALID && newTile != oldLocation && room.getRoomItemManager().furnitureFitsAt(newTile, item, item.getRotation(), true) == FurnitureMovementError.NONE) {
|
if (newTile.getState() != RoomTileState.INVALID && newTile != oldLocation && room.getRoomItemManager().furnitureFitsAt(newTile, item, item.getRotation(), true) == FurnitureMovementError.NONE) {
|
||||||
if (room.getRoomItemManager().moveFurniTo(item, newTile, item.getRotation(), null, false, true) == FurnitureMovementError.NONE) {
|
if (room.getRoomItemManager().moveItemTo(item, newTile, item.getRotation(), null, false, true) == FurnitureMovementError.NONE) {
|
||||||
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newTile, item.getZ(), 0, room).compose());
|
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newTile, item.getZ(), 0, room).compose());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implement
|
|||||||
if(newLocation != null && newLocation.getState() != RoomTileState.INVALID && (newLocation != oldLocation || newRotation != item.getRotation()) && (furniMoveTest == FurnitureMovementError.NONE || ((furniMoveTest == FurnitureMovementError.TILE_HAS_BOTS || furniMoveTest == FurnitureMovementError.TILE_HAS_HABBOS || furniMoveTest == FurnitureMovementError.TILE_HAS_PETS) && newLocation == oldLocation))) {
|
if(newLocation != null && newLocation.getState() != RoomTileState.INVALID && (newLocation != oldLocation || newRotation != item.getRotation()) && (furniMoveTest == FurnitureMovementError.NONE || ((furniMoveTest == FurnitureMovementError.TILE_HAS_BOTS || furniMoveTest == FurnitureMovementError.TILE_HAS_HABBOS || furniMoveTest == FurnitureMovementError.TILE_HAS_PETS) && newLocation == oldLocation))) {
|
||||||
if(room.getRoomItemManager().furnitureFitsAt(newLocation, item, newRotation, false) == FurnitureMovementError.NONE) {
|
if(room.getRoomItemManager().furnitureFitsAt(newLocation, item, newRotation, false) == FurnitureMovementError.NONE) {
|
||||||
boolean sendUpdates = !slideAnimation;
|
boolean sendUpdates = !slideAnimation;
|
||||||
if (room.getRoomItemManager().moveFurniTo(item, newLocation, newRotation, null, sendUpdates, true) == FurnitureMovementError.NONE) {
|
if (room.getRoomItemManager().moveItemTo(item, newLocation, newRotation, null, sendUpdates, true) == FurnitureMovementError.NONE) {
|
||||||
if (slideAnimation) {
|
if (slideAnimation) {
|
||||||
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getZ(), 0, room).compose());
|
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getZ(), 0, room).compose());
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public class ActionPlayFootball extends PetAction {
|
|||||||
|
|
||||||
RoomItem foundBall = null;
|
RoomItem foundBall = null;
|
||||||
|
|
||||||
for(RoomItem item : room.getFloorItems()) {
|
for(RoomItem item : room.getRoomItemManager().getFloorItems().values()) {
|
||||||
if(item instanceof InteractionPushable) {
|
if(item instanceof InteractionPushable) {
|
||||||
foundBall = item;
|
foundBall = item;
|
||||||
}
|
}
|
||||||
|
@ -12,16 +12,7 @@ import com.eu.habbo.habbohotel.items.FurnitureType;
|
|||||||
import com.eu.habbo.habbohotel.items.ICycleable;
|
import com.eu.habbo.habbohotel.items.ICycleable;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.*;
|
import com.eu.habbo.habbohotel.items.interactions.*;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameGate;
|
|
||||||
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameScoreboard;
|
|
||||||
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
|
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiSphere;
|
|
||||||
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiTeleporter;
|
|
||||||
import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeExitTile;
|
|
||||||
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField;
|
|
||||||
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole;
|
|
||||||
import com.eu.habbo.habbohotel.items.interactions.pets.*;
|
|
||||||
import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredBlob;
|
|
||||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
import com.eu.habbo.habbohotel.pets.RideablePet;
|
import com.eu.habbo.habbohotel.pets.RideablePet;
|
||||||
@ -33,8 +24,6 @@ import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnitType;
|
|||||||
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar;
|
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar;
|
||||||
import com.eu.habbo.habbohotel.users.DanceType;
|
import com.eu.habbo.habbohotel.users.DanceType;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboInfo;
|
|
||||||
import com.eu.habbo.habbohotel.users.HabboManager;
|
|
||||||
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;
|
||||||
import com.eu.habbo.messages.ISerialize;
|
import com.eu.habbo.messages.ISerialize;
|
||||||
@ -43,7 +32,6 @@ import com.eu.habbo.messages.outgoing.MessageComposer;
|
|||||||
import com.eu.habbo.messages.outgoing.generic.alerts.GenericErrorComposer;
|
import com.eu.habbo.messages.outgoing.generic.alerts.GenericErrorComposer;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.HabboBroadcastMessageComposer;
|
import com.eu.habbo.messages.outgoing.generic.alerts.HabboBroadcastMessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.guilds.HabboGroupDetailsMessageComposer;
|
import com.eu.habbo.messages.outgoing.guilds.HabboGroupDetailsMessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.polls.infobus.QuestionAnsweredComposer;
|
import com.eu.habbo.messages.outgoing.polls.infobus.QuestionAnsweredComposer;
|
||||||
import com.eu.habbo.messages.outgoing.polls.infobus.QuestionComposer;
|
import com.eu.habbo.messages.outgoing.polls.infobus.QuestionComposer;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.FlatAccessDeniedMessageComposer;
|
import com.eu.habbo.messages.outgoing.rooms.FlatAccessDeniedMessageComposer;
|
||||||
@ -70,7 +58,6 @@ import gnu.trove.TCollections;
|
|||||||
import gnu.trove.iterator.TIntObjectIterator;
|
import gnu.trove.iterator.TIntObjectIterator;
|
||||||
import gnu.trove.map.TIntIntMap;
|
import gnu.trove.map.TIntIntMap;
|
||||||
import gnu.trove.map.TIntObjectMap;
|
import gnu.trove.map.TIntObjectMap;
|
||||||
import gnu.trove.map.hash.THashMap;
|
|
||||||
import gnu.trove.map.hash.TIntIntHashMap;
|
import gnu.trove.map.hash.TIntIntHashMap;
|
||||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||||
import gnu.trove.set.hash.THashSet;
|
import gnu.trove.set.hash.THashSet;
|
||||||
@ -319,7 +306,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
statement.setInt(1, this.roomInfo.getId());
|
statement.setInt(1, this.roomInfo.getId());
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
this.addHabboItem(Emulator.getGameEnvironment().getItemManager().loadHabboItem(set));
|
RoomItem item = Emulator.getGameEnvironment().getItemManager().loadHabboItem(set);
|
||||||
|
this.getRoomItemManager().addRoomItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@ -1446,274 +1434,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addHabboItem(RoomItem item) {
|
|
||||||
if (item == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
synchronized (this.roomItems) {
|
|
||||||
try {
|
|
||||||
this.roomItems.put(item.getId(), item);
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronized (this.furniOwnerCount) {
|
|
||||||
this.furniOwnerCount.put(item.getOwnerId(), this.furniOwnerCount.get(item.getOwnerId()) + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronized (this.furniOwnerNames) {
|
|
||||||
if (!this.furniOwnerNames.containsKey(item.getOwnerId())) {
|
|
||||||
HabboInfo habbo = HabboManager.getOfflineHabboInfo(item.getOwnerId());
|
|
||||||
|
|
||||||
if (habbo != null) {
|
|
||||||
this.furniOwnerNames.put(item.getOwnerId(), habbo.getUsername());
|
|
||||||
} else {
|
|
||||||
log.error("Failed to find username for item (ID: {}, UserID: {})", item.getId(), item.getOwnerId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Move this list
|
|
||||||
synchronized (this.roomSpecialTypes) {
|
|
||||||
if (item instanceof ICycleable) {
|
|
||||||
this.roomSpecialTypes.addCycleTask((ICycleable) item);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item instanceof InteractionWiredTrigger interactionWiredTrigger) {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public RoomItem getHabboItem(int id) {
|
|
||||||
if (this.roomItems == null || this.roomSpecialTypes == null)
|
|
||||||
return null; // room not loaded completely
|
|
||||||
|
|
||||||
RoomItem item;
|
|
||||||
synchronized (this.roomItems) {
|
|
||||||
item = this.roomItems.get(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item == null)
|
|
||||||
item = this.roomSpecialTypes.getBanzaiTeleporter(id);
|
|
||||||
|
|
||||||
if (item == null)
|
|
||||||
item = this.roomSpecialTypes.getTrigger(id);
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeHabboItem(RoomItem item) {
|
|
||||||
if (item != null) {
|
|
||||||
|
|
||||||
RoomItem i;
|
|
||||||
synchronized (this.roomItems) {
|
|
||||||
i = this.roomItems.remove(item.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i != null) {
|
|
||||||
synchronized (this.furniOwnerCount) {
|
|
||||||
synchronized (this.furniOwnerNames) {
|
|
||||||
int count = this.furniOwnerCount.get(i.getOwnerId());
|
|
||||||
|
|
||||||
if (count > 1)
|
|
||||||
this.furniOwnerCount.put(i.getOwnerId(), count - 1);
|
|
||||||
else {
|
|
||||||
this.furniOwnerCount.remove(i.getOwnerId());
|
|
||||||
this.furniOwnerNames.remove(i.getOwnerId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item instanceof ICycleable) {
|
|
||||||
this.roomSpecialTypes.removeCycleTask((ICycleable) item);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item instanceof InteractionBattleBanzaiTeleporter) {
|
|
||||||
this.roomSpecialTypes.removeBanzaiTeleporter((InteractionBattleBanzaiTeleporter) item);
|
|
||||||
} else if (item instanceof InteractionWiredTrigger) {
|
|
||||||
this.roomSpecialTypes.removeTrigger((InteractionWiredTrigger) item);
|
|
||||||
} else if (item instanceof InteractionWiredEffect) {
|
|
||||||
this.roomSpecialTypes.removeEffect((InteractionWiredEffect) item);
|
|
||||||
} else if (item instanceof InteractionWiredCondition) {
|
|
||||||
this.roomSpecialTypes.removeCondition((InteractionWiredCondition) item);
|
|
||||||
} else if (item instanceof InteractionWiredExtra) {
|
|
||||||
this.roomSpecialTypes.removeExtra((InteractionWiredExtra) item);
|
|
||||||
} else if (item instanceof InteractionRoller) {
|
|
||||||
this.roomSpecialTypes.removeRoller((InteractionRoller) item);
|
|
||||||
} else if (item instanceof InteractionGameScoreboard) {
|
|
||||||
this.roomSpecialTypes.removeScoreboard((InteractionGameScoreboard) item);
|
|
||||||
} else if (item instanceof InteractionGameGate) {
|
|
||||||
this.roomSpecialTypes.removeGameGate((InteractionGameGate) item);
|
|
||||||
} else if (item instanceof InteractionGameTimer) {
|
|
||||||
this.roomSpecialTypes.removeGameTimer((InteractionGameTimer) item);
|
|
||||||
} else if (item instanceof InteractionFreezeExitTile) {
|
|
||||||
this.roomSpecialTypes.removeFreezeExitTile((InteractionFreezeExitTile) item);
|
|
||||||
} else if (item instanceof InteractionNest) {
|
|
||||||
this.roomSpecialTypes.removeNest((InteractionNest) item);
|
|
||||||
} else if (item instanceof InteractionPetDrink) {
|
|
||||||
this.roomSpecialTypes.removePetDrink((InteractionPetDrink) item);
|
|
||||||
} else if (item instanceof InteractionPetFood) {
|
|
||||||
this.roomSpecialTypes.removePetFood((InteractionPetFood) item);
|
|
||||||
} else if (item instanceof InteractionPetToy) {
|
|
||||||
this.roomSpecialTypes.removePetToy((InteractionPetToy) item);
|
|
||||||
} else if (item instanceof InteractionPetTree) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionPetTrampoline) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionMoodLight) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionPyramid) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionMusicDisc) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionBattleBanzaiSphere) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionTalkingFurniture) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionWaterItem) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionWater) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionMuteArea) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionTagPole) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionTagField) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionJukeBox) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionPetBreedingNest) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionBlackHole) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionWiredHighscore) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionStickyPole) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof WiredBlob) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionTent) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionSnowboardSlope) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
} else if (item instanceof InteractionBuildArea) {
|
|
||||||
this.roomSpecialTypes.removeUndefined(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<RoomItem> getFloorItems() {
|
|
||||||
return roomItems.valueCollection().stream().filter(i -> i.getBaseItem().getType() == FurnitureType.FLOOR).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<RoomItem> getWallItems() {
|
|
||||||
return roomItems.valueCollection().stream().filter(i -> i.getBaseItem().getType() == FurnitureType.WALL).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<RoomItem> getPostItNotes() {
|
public List<RoomItem> getPostItNotes() {
|
||||||
return roomItems.valueCollection().stream().filter(i -> i.getBaseItem().getInteractionType().getType() == InteractionPostIt.class).toList();
|
return roomItems.valueCollection().stream().filter(i -> i.getBaseItem().getInteractionType().getType() == InteractionPostIt.class).toList();
|
||||||
}
|
}
|
||||||
@ -2679,77 +2399,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
return items.size();
|
return items.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ejectUserFurni(int userId) {
|
|
||||||
THashSet<RoomItem> items = new THashSet<>();
|
|
||||||
|
|
||||||
TIntObjectIterator<RoomItem> iterator = this.roomItems.iterator();
|
|
||||||
|
|
||||||
for (int i = this.roomItems.size(); i-- > 0; ) {
|
|
||||||
try {
|
|
||||||
iterator.advance();
|
|
||||||
} catch (Exception e) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iterator.value().getOwnerId() == userId) {
|
|
||||||
items.add(iterator.value());
|
|
||||||
iterator.value().setRoomId(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
|
||||||
|
|
||||||
if (habbo != null) {
|
|
||||||
habbo.getInventory().getItemsComponent().addItems(items);
|
|
||||||
habbo.getClient().sendResponse(new UnseenItemsComposer(items));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (RoomItem i : items) {
|
|
||||||
this.getRoomItemManager().pickUpItem(i, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ejectAllFurni() {
|
|
||||||
this.ejectAllFurni(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ejectAllFurni(Habbo habbo) {
|
|
||||||
THashMap<Integer, THashSet<RoomItem>> userItemsMap = new THashMap<>();
|
|
||||||
|
|
||||||
synchronized (this.roomItems) {
|
|
||||||
TIntObjectIterator<RoomItem> iterator = this.roomItems.iterator();
|
|
||||||
|
|
||||||
for (int i = this.roomItems.size(); i-- > 0; ) {
|
|
||||||
try {
|
|
||||||
iterator.advance();
|
|
||||||
} catch (Exception e) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (habbo != null && iterator.value().getOwnerId() == habbo.getHabboInfo().getId())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (iterator.value() instanceof InteractionPostIt)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
userItemsMap.computeIfAbsent(iterator.value().getOwnerId(), k -> new THashSet<>()).add(iterator.value());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Map.Entry<Integer, THashSet<RoomItem>> entrySet : userItemsMap.entrySet()) {
|
|
||||||
for (RoomItem i : entrySet.getValue()) {
|
|
||||||
this.getRoomItemManager().pickUpItem(i, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
Habbo user = Emulator.getGameEnvironment().getHabboManager().getHabbo(entrySet.getKey());
|
|
||||||
|
|
||||||
if (user != null) {
|
|
||||||
user.getInventory().getItemsComponent().addItems(entrySet.getValue());
|
|
||||||
user.getClient().sendResponse(new UnseenItemsComposer(entrySet.getValue()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void refreshGuild(Guild guild) {
|
public void refreshGuild(Guild guild) {
|
||||||
if (guild.getRoomId() == this.roomInfo.getId()) {
|
if (guild.getRoomId() == this.roomInfo.getId()) {
|
||||||
THashSet<GuildMember> members = Emulator.getGameEnvironment().getGuildManager().getGuildMembers(guild.getId());
|
THashSet<GuildMember> members = Emulator.getGameEnvironment().getGuildManager().getGuildMembers(guild.getId());
|
||||||
@ -2770,7 +2419,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
if (guild.getRoomId() == this.roomInfo.getId()) {
|
if (guild.getRoomId() == this.roomInfo.getId()) {
|
||||||
TIntObjectIterator<RoomItem> iterator = this.roomItems.iterator();
|
TIntObjectIterator<RoomItem> iterator = this.roomItems.iterator();
|
||||||
|
|
||||||
for (int i = this.roomItems.size(); i-- > 0; ) {
|
for (int i = this.roomItemManager.getCurrentItems().size(); i-- > 0; ) {
|
||||||
try {
|
try {
|
||||||
iterator.advance();
|
iterator.advance();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -115,6 +115,10 @@ public class RoomItemManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RoomItem getRoomItemById(int itemId) {
|
||||||
|
return this.currentItems.get(itemId);
|
||||||
|
}
|
||||||
|
|
||||||
public void addRoomItem(RoomItem item) {
|
public void addRoomItem(RoomItem item) {
|
||||||
if (this.currentItems.size() > Room.MAXIMUM_FURNI) {
|
if (this.currentItems.size() > Room.MAXIMUM_FURNI) {
|
||||||
log.error("Room ID: {} has exceeded the furniture limit ({} > {}).", this.room.getRoomInfo().getId(), this.currentItems.size(), Room.MAXIMUM_FURNI);
|
log.error("Room ID: {} has exceeded the furniture limit ({} > {}).", this.room.getRoomInfo().getId(), this.currentItems.size(), Room.MAXIMUM_FURNI);
|
||||||
@ -131,7 +135,7 @@ public class RoomItemManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeHabboItem(RoomItem item) {
|
public void removeRoomItem(RoomItem item) {
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
|
|
||||||
RoomItem i;
|
RoomItem i;
|
||||||
@ -222,23 +226,17 @@ public class RoomItemManager {
|
|||||||
public FurnitureMovementError canPlaceFurnitureAt(RoomItem item, Habbo habbo, RoomTile tile, int rotation) {
|
public FurnitureMovementError canPlaceFurnitureAt(RoomItem item, Habbo habbo, RoomTile tile, int rotation) {
|
||||||
if (this.currentItems.size() >= Room.MAXIMUM_FURNI) {
|
if (this.currentItems.size() >= Room.MAXIMUM_FURNI) {
|
||||||
return FurnitureMovementError.MAX_ITEMS;
|
return FurnitureMovementError.MAX_ITEMS;
|
||||||
}
|
} else if (item instanceof InteractionMoodLight && !this.getItemsOfType(InteractionMoodLight.class).isEmpty()) {
|
||||||
|
|
||||||
if (item instanceof InteractionMoodLight && !this.getItemsOfType(InteractionMoodLight.class).isEmpty()) {
|
|
||||||
return FurnitureMovementError.MAX_DIMMERS;
|
return FurnitureMovementError.MAX_DIMMERS;
|
||||||
}
|
} else if (item instanceof InteractionJukeBox && !this.getItemsOfType(InteractionJukeBox.class).isEmpty()) {
|
||||||
if (item instanceof InteractionJukeBox && !this.getItemsOfType(InteractionJukeBox.class).isEmpty()) {
|
|
||||||
return FurnitureMovementError.MAX_SOUNDFURNI;
|
return FurnitureMovementError.MAX_SOUNDFURNI;
|
||||||
}
|
} else if (tile == null || tile.getState() == RoomTileState.INVALID) {
|
||||||
|
|
||||||
if (tile == null || tile.getState() == RoomTileState.INVALID) {
|
|
||||||
return FurnitureMovementError.INVALID_MOVE;
|
return FurnitureMovementError.INVALID_MOVE;
|
||||||
|
} else if (this.room.getRoomRightsManager().hasRights(habbo) || this.room.getGuildRightLevel(habbo).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS) || habbo.hasRight(Permission.ACC_MOVEROTATE)) {
|
||||||
|
return FurnitureMovementError.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
rotation %= 8;
|
rotation %= 8;
|
||||||
if (this.room.getRoomRightsManager().hasRights(habbo) || this.room.getGuildRightLevel(habbo).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS) || habbo.hasRight(Permission.ACC_MOVEROTATE)) {
|
|
||||||
return FurnitureMovementError.NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (habbo.getHabboStats().isRentingSpace()) {
|
if (habbo.getHabboStats().isRentingSpace()) {
|
||||||
RoomItem rentSpace = this.currentItems.get(habbo.getHabboStats().getRentedItemId());
|
RoomItem rentSpace = this.currentItems.get(habbo.getHabboStats().getRentedItemId());
|
||||||
@ -252,6 +250,7 @@ public class RoomItemManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO CHECK THIS SITUATION
|
||||||
for (RoomItem area : this.getItemsOfType(InteractionBuildArea.class)) {
|
for (RoomItem area : this.getItemsOfType(InteractionBuildArea.class)) {
|
||||||
if (((InteractionBuildArea) area).inSquare(tile) && ((InteractionBuildArea) area).isBuilder(habbo.getHabboInfo().getUsername())) {
|
if (((InteractionBuildArea) area).inSquare(tile) && ((InteractionBuildArea) area).isBuilder(habbo.getHabboInfo().getUsername())) {
|
||||||
return FurnitureMovementError.NONE;
|
return FurnitureMovementError.NONE;
|
||||||
@ -261,16 +260,17 @@ public class RoomItemManager {
|
|||||||
return FurnitureMovementError.NO_RIGHTS;
|
return FurnitureMovementError.NO_RIGHTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FurnitureMovementError placeFloorItemAt(RoomItem item, RoomTile tile, int rotation, Habbo owner) {
|
public FurnitureMovementError placeFloorItemAt(RoomItem item, RoomTile tile, int rotation, Habbo actor) {
|
||||||
FurnitureMovementError error = this.canPlaceFurnitureAt(item, owner, tile, rotation);
|
FurnitureMovementError error = this.canPlaceFurnitureAt(item, actor, tile, rotation);
|
||||||
|
|
||||||
if(!error.equals(FurnitureMovementError.NONE)) {
|
if(!error.equals(FurnitureMovementError.NONE)) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean pluginHelper = false;
|
boolean pluginHelper = false;
|
||||||
|
|
||||||
if (Emulator.getPluginManager().isRegistered(FurniturePlacedEvent.class, true)) {
|
if (Emulator.getPluginManager().isRegistered(FurniturePlacedEvent.class, true)) {
|
||||||
FurniturePlacedEvent event = Emulator.getPluginManager().fireEvent(new FurniturePlacedEvent(item, owner, tile));
|
FurniturePlacedEvent event = Emulator.getPluginManager().fireEvent(new FurniturePlacedEvent(item, actor, tile));
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return FurnitureMovementError.CANCEL_PLUGIN_PLACE;
|
return FurnitureMovementError.CANCEL_PLUGIN_PLACE;
|
||||||
@ -297,7 +297,7 @@ public class RoomItemManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Emulator.getPluginManager().isRegistered(FurnitureBuildheightEvent.class, true)) {
|
if (Emulator.getPluginManager().isRegistered(FurnitureBuildheightEvent.class, true)) {
|
||||||
FurnitureBuildheightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureBuildheightEvent(item, owner, 0.00, height));
|
FurnitureBuildheightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureBuildheightEvent(item, actor, 0.00, height));
|
||||||
if (event.hasChangedHeight()) {
|
if (event.hasChangedHeight()) {
|
||||||
height = event.getUpdatedHeight();
|
height = event.getUpdatedHeight();
|
||||||
}
|
}
|
||||||
@ -325,7 +325,7 @@ public class RoomItemManager {
|
|||||||
return FurnitureMovementError.NONE;
|
return FurnitureMovementError.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FurnitureMovementError placeWallFurniAt(RoomItem item, String wallPosition, Habbo owner) {
|
public FurnitureMovementError placeWallItemAt(RoomItem item, String wallPosition, Habbo owner) {
|
||||||
if (!(this.room.getRoomRightsManager().hasRights(owner) || this.room.getGuildRightLevel(owner).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS))) {
|
if (!(this.room.getRoomRightsManager().hasRights(owner) || this.room.getGuildRightLevel(owner).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS))) {
|
||||||
return FurnitureMovementError.NO_RIGHTS;
|
return FurnitureMovementError.NO_RIGHTS;
|
||||||
}
|
}
|
||||||
@ -351,20 +351,22 @@ public class RoomItemManager {
|
|||||||
return FurnitureMovementError.NONE;
|
return FurnitureMovementError.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FurnitureMovementError moveFurniTo(RoomItem item, RoomTile tile, int rotation, Habbo actor) {
|
public FurnitureMovementError moveItemTo(RoomItem item, RoomTile targetTile, int rotation, Habbo actor) {
|
||||||
return moveFurniTo(item, tile, rotation, actor, true, true);
|
return moveItemTo(item, targetTile, rotation, actor, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FurnitureMovementError moveFurniTo(RoomItem item, RoomTile tile, int rotation, Habbo actor, boolean sendUpdates) {
|
public FurnitureMovementError moveItemTo(RoomItem item, RoomTile targetTile, int rotation, Habbo actor, boolean sendUpdates, boolean checkForUnits) {
|
||||||
return moveFurniTo(item, tile, rotation, actor, sendUpdates, true);
|
FurnitureMovementError error = this.canPlaceFurnitureAt(item, actor, targetTile, rotation);
|
||||||
}
|
|
||||||
|
if(!error.equals(FurnitureMovementError.NONE)) {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
public FurnitureMovementError moveFurniTo(RoomItem item, RoomTile tile, int rotation, Habbo actor, boolean sendUpdates, boolean checkForUnits) {
|
|
||||||
RoomTile oldLocation = this.room.getLayout().getTile(item.getX(), item.getY());
|
RoomTile oldLocation = this.room.getLayout().getTile(item.getX(), item.getY());
|
||||||
|
|
||||||
boolean pluginHelper = false;
|
boolean pluginHelper = false;
|
||||||
if (Emulator.getPluginManager().isRegistered(FurnitureMovedEvent.class, true)) {
|
if (Emulator.getPluginManager().isRegistered(FurnitureMovedEvent.class, true)) {
|
||||||
FurnitureMovedEvent event = Emulator.getPluginManager().fireEvent(new FurnitureMovedEvent(item, actor, oldLocation, tile));
|
FurnitureMovedEvent event = Emulator.getPluginManager().fireEvent(new FurnitureMovedEvent(item, actor, oldLocation, targetTile));
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return FurnitureMovementError.CANCEL_PLUGIN_MOVE;
|
return FurnitureMovementError.CANCEL_PLUGIN_MOVE;
|
||||||
}
|
}
|
||||||
@ -373,16 +375,22 @@ public class RoomItemManager {
|
|||||||
|
|
||||||
boolean magicTile = item instanceof InteractionStackHelper;
|
boolean magicTile = item instanceof InteractionStackHelper;
|
||||||
|
|
||||||
Optional<RoomItem> stackHelper = this.room.getItemsAt(tile).stream().filter(InteractionStackHelper.class::isInstance).findAny();
|
Optional<RoomItem> stackHelper = this.room.getItemsAt(targetTile).stream().filter(InteractionStackHelper.class::isInstance).findAny();
|
||||||
|
|
||||||
//Check if can be placed at new position
|
//Check if can be placed at new position
|
||||||
THashSet<RoomTile> occupiedTiles = this.room.getLayout().getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
THashSet<RoomTile> occupiedTiles = this.room.getLayout().getTilesAt(targetTile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
||||||
THashSet<RoomTile> newOccupiedTiles = this.room.getLayout().getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
THashSet<RoomTile> newOccupiedTiles = this.room.getLayout().getTilesAt(targetTile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
||||||
|
|
||||||
|
FurnitureMovementError fits = this.furnitureFitsAt(targetTile, item, rotation, true);
|
||||||
|
|
||||||
|
if (!fits.equals(FurnitureMovementError.NONE) && !pluginHelper) {
|
||||||
|
return fits;
|
||||||
|
}
|
||||||
|
|
||||||
RoomItem topItem = this.room.getTopItemAt(occupiedTiles, null);
|
RoomItem topItem = this.room.getTopItemAt(occupiedTiles, null);
|
||||||
|
|
||||||
if ((stackHelper.isEmpty() && !pluginHelper) || item.getBaseItem().getInteractionType().getType() == InteractionWater.class) {
|
if ((stackHelper.isEmpty() && !pluginHelper) || item.getBaseItem().getInteractionType().getType() == InteractionWater.class) {
|
||||||
if (oldLocation != tile) {
|
if (oldLocation != targetTile) {
|
||||||
for (RoomTile t : occupiedTiles) {
|
for (RoomTile t : occupiedTiles) {
|
||||||
RoomItem tileTopItem = this.room.getTopItemAt(t.getX(), t.getY());
|
RoomItem tileTopItem = this.room.getTopItemAt(t.getX(), t.getY());
|
||||||
if (!magicTile && (tileTopItem != null && tileTopItem != item ? (t.getState().equals(RoomTileState.INVALID) || !t.getAllowStack() || !tileTopItem.getBaseItem().allowStack() ||
|
if (!magicTile && (tileTopItem != null && tileTopItem != item ? (t.getState().equals(RoomTileState.INVALID) || !t.getAllowStack() || !tileTopItem.getBaseItem().allowStack() ||
|
||||||
@ -404,6 +412,7 @@ public class RoomItemManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Pair<RoomTile, THashSet<RoomItem>>> tileFurniList = new ArrayList<>();
|
List<Pair<RoomTile, THashSet<RoomItem>>> tileFurniList = new ArrayList<>();
|
||||||
|
|
||||||
for (RoomTile t : occupiedTiles) {
|
for (RoomTile t : occupiedTiles) {
|
||||||
tileFurniList.add(Pair.create(t, this.room.getItemsAt(t)));
|
tileFurniList.add(Pair.create(t, this.room.getItemsAt(t)));
|
||||||
}
|
}
|
||||||
@ -419,6 +428,7 @@ public class RoomItemManager {
|
|||||||
|
|
||||||
if (oldRotation != rotation) {
|
if (oldRotation != rotation) {
|
||||||
item.setRotation(rotation);
|
item.setRotation(rotation);
|
||||||
|
|
||||||
if (Emulator.getPluginManager().isRegistered(FurnitureRotatedEvent.class, true)) {
|
if (Emulator.getPluginManager().isRegistered(FurnitureRotatedEvent.class, true)) {
|
||||||
Event furnitureRotatedEvent = new FurnitureRotatedEvent(item, actor, oldRotation);
|
Event furnitureRotatedEvent = new FurnitureRotatedEvent(item, actor, oldRotation);
|
||||||
Emulator.getPluginManager().fireEvent(furnitureRotatedEvent);
|
Emulator.getPluginManager().fireEvent(furnitureRotatedEvent);
|
||||||
@ -445,7 +455,7 @@ public class RoomItemManager {
|
|||||||
} else if (item == topItem) {
|
} else if (item == topItem) {
|
||||||
height = item.getZ();
|
height = item.getZ();
|
||||||
} else {
|
} else {
|
||||||
height = this.room.getStackHeight(tile.getX(), tile.getY(), false, item);
|
height = this.room.getStackHeight(targetTile.getX(), targetTile.getY(), false, item);
|
||||||
for (RoomTile til : occupiedTiles) {
|
for (RoomTile til : occupiedTiles) {
|
||||||
double sHeight = this.room.getStackHeight(til.getX(), til.getY(), false, item);
|
double sHeight = this.room.getStackHeight(til.getX(), til.getY(), false, item);
|
||||||
if (sHeight > height) {
|
if (sHeight > height) {
|
||||||
@ -454,9 +464,13 @@ public class RoomItemManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (height > Room.MAXIMUM_FURNI_HEIGHT) return FurnitureMovementError.CANT_STACK;
|
if (height > Room.MAXIMUM_FURNI_HEIGHT) {
|
||||||
if (height < this.room.getLayout().getHeightAtSquare(tile.getX(), tile.getY()))
|
return FurnitureMovementError.CANT_STACK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (height < this.room.getLayout().getHeightAtSquare(targetTile.getX(), targetTile.getY())) {
|
||||||
return FurnitureMovementError.CANT_STACK; //prevent furni going under the floor
|
return FurnitureMovementError.CANT_STACK; //prevent furni going under the floor
|
||||||
|
}
|
||||||
|
|
||||||
if (Emulator.getPluginManager().isRegistered(FurnitureBuildheightEvent.class, true)) {
|
if (Emulator.getPluginManager().isRegistered(FurnitureBuildheightEvent.class, true)) {
|
||||||
FurnitureBuildheightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureBuildheightEvent(item, actor, 0.00, height));
|
FurnitureBuildheightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureBuildheightEvent(item, actor, 0.00, height));
|
||||||
@ -465,25 +479,31 @@ public class RoomItemManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (height > Room.MAXIMUM_FURNI_HEIGHT) return FurnitureMovementError.CANT_STACK;
|
if (height > Room.MAXIMUM_FURNI_HEIGHT) {
|
||||||
if (height < this.room.getLayout().getHeightAtSquare(tile.getX(), tile.getY()))
|
return FurnitureMovementError.CANT_STACK;
|
||||||
return FurnitureMovementError.CANT_STACK; //prevent furni going under the floor
|
}
|
||||||
|
|
||||||
item.setX(tile.getX());
|
if (height < this.room.getLayout().getHeightAtSquare(targetTile.getX(), targetTile.getY())) {
|
||||||
item.setY(tile.getY());
|
return FurnitureMovementError.CANT_STACK; //prevent furni going under the floor
|
||||||
|
}
|
||||||
|
|
||||||
|
item.setX(targetTile.getX());
|
||||||
|
item.setY(targetTile.getY());
|
||||||
item.setZ(height);
|
item.setZ(height);
|
||||||
|
|
||||||
if (magicTile) {
|
if (magicTile) {
|
||||||
item.setZ(tile.getZ());
|
item.setZ(targetTile.getZ());
|
||||||
item.setExtradata("" + item.getZ() * 100);
|
item.setExtradata("" + item.getZ() * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getZ() > Room.MAXIMUM_FURNI_HEIGHT) {
|
if (item.getZ() > Room.MAXIMUM_FURNI_HEIGHT) {
|
||||||
item.setZ(Room.MAXIMUM_FURNI_HEIGHT);
|
item.setZ(Room.MAXIMUM_FURNI_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Update Furniture
|
//Update Furniture
|
||||||
item.onMove(this.room, oldLocation, tile);
|
item.onMove(this.room, oldLocation, targetTile);
|
||||||
item.needsUpdate(true);
|
item.needsUpdate(true);
|
||||||
|
|
||||||
Emulator.getThreading().run(item);
|
Emulator.getThreading().run(item);
|
||||||
|
|
||||||
if (sendUpdates) {
|
if (sendUpdates) {
|
||||||
@ -493,20 +513,15 @@ public class RoomItemManager {
|
|||||||
//Update old & new tiles
|
//Update old & new tiles
|
||||||
occupiedTiles.removeAll(oldOccupiedTiles);
|
occupiedTiles.removeAll(oldOccupiedTiles);
|
||||||
occupiedTiles.addAll(oldOccupiedTiles);
|
occupiedTiles.addAll(oldOccupiedTiles);
|
||||||
|
|
||||||
this.room.updateTiles(occupiedTiles);
|
this.room.updateTiles(occupiedTiles);
|
||||||
|
|
||||||
//Update Habbos at old position
|
//Update Habbos at old position
|
||||||
for (RoomTile t : occupiedTiles) {
|
for (RoomTile t : occupiedTiles) {
|
||||||
this.room.updateHabbosAt(
|
this.room.updateHabbosAt(t.getX(), t.getY(), new ArrayList<>(this.room.getRoomUnitManager().getHabbosAt(t)));
|
||||||
t.getX(),
|
|
||||||
t.getY(),
|
|
||||||
new ArrayList<>(this.room.getRoomUnitManager().getHabbosAt(t))
|
|
||||||
/*.stream()
|
|
||||||
.filter(h -> !h.getRoomUnit().hasStatus(RoomUnitStatus.MOVE) || h.getRoomUnit().getGoal() == t)
|
|
||||||
.collect(Collectors.toCollection(THashSet::new))*/
|
|
||||||
);
|
|
||||||
this.room.updateBotsAt(t.getX(), t.getY());
|
this.room.updateBotsAt(t.getX(), t.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Emulator.getConfig().getBoolean("wired.place.under", false)) {
|
if (Emulator.getConfig().getBoolean("wired.place.under", false)) {
|
||||||
for (RoomTile t : newOccupiedTiles) {
|
for (RoomTile t : newOccupiedTiles) {
|
||||||
for (Habbo h : this.room.getRoomUnitManager().getHabbosAt(t)) {
|
for (Habbo h : this.room.getRoomUnitManager().getHabbosAt(t)) {
|
||||||
@ -518,6 +533,7 @@ public class RoomItemManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FurnitureMovementError.NONE;
|
return FurnitureMovementError.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -533,7 +549,7 @@ public class RoomItemManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.removeHabboItem(item);
|
this.removeRoomItem(item);
|
||||||
item.onPickUp(this.room);
|
item.onPickUp(this.room);
|
||||||
item.setRoomId(0);
|
item.setRoomId(0);
|
||||||
item.needsUpdate(true);
|
item.needsUpdate(true);
|
||||||
@ -578,32 +594,86 @@ public class RoomItemManager {
|
|||||||
this.pickUpItem(item, null);
|
this.pickUpItem(item, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FurnitureMovementError furnitureFitsAt(RoomTile tile, RoomItem item, int rotation, boolean checkForUnits) {
|
public void ejectUserFurni(int userId) {
|
||||||
if (!this.room.getLayout().fitsOnMap(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation))
|
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
||||||
|
HashSet<RoomItem> userItems = this.currentItems.values().stream().filter(item -> item.getOwnerId() == userId).collect(Collectors.toCollection(HashSet::new));
|
||||||
|
|
||||||
|
if (habbo != null) {
|
||||||
|
habbo.getInventory().getItemsComponent().addItems(userItems);
|
||||||
|
habbo.getClient().sendResponse(new UnseenItemsComposer(userItems));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (RoomItem i : userItems) {
|
||||||
|
this.pickUpItem(i, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ejectAllFurni() {
|
||||||
|
this.ejectAllFurni(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ejectAllFurni(Habbo habbo) {
|
||||||
|
ConcurrentHashMap<Integer, HashSet<RoomItem>> userItemsMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
for (RoomItem item : this.currentItems.values()) {
|
||||||
|
if ((habbo != null && item.getOwnerId() == habbo.getHabboInfo().getId()) || item instanceof InteractionPostIt) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
userItemsMap.computeIfAbsent(item.getOwnerId(), k -> new HashSet<>()).add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Map.Entry<Integer, HashSet<RoomItem>> entrySet : userItemsMap.entrySet()) {
|
||||||
|
for (RoomItem i : entrySet.getValue()) {
|
||||||
|
this.pickUpItem(i, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
Habbo user = Emulator.getGameEnvironment().getHabboManager().getHabbo(entrySet.getKey());
|
||||||
|
|
||||||
|
if (user != null) {
|
||||||
|
user.getInventory().getItemsComponent().addItems(entrySet.getValue());
|
||||||
|
user.getClient().sendResponse(new UnseenItemsComposer(entrySet.getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public FurnitureMovementError furnitureFitsAt(RoomTile targetTile, RoomItem item, int rotation, boolean checkForUnits) {
|
||||||
|
RoomLayout layout = this.room.getLayout();
|
||||||
|
boolean wiredPlaceUnder = Emulator.getConfig().getBoolean("wired.place.under", false);
|
||||||
|
Item baseItem = item.getBaseItem();
|
||||||
|
|
||||||
|
if (!layout.fitsOnMap(targetTile, baseItem.getWidth(), baseItem.getLength(), rotation)) {
|
||||||
return FurnitureMovementError.INVALID_MOVE;
|
return FurnitureMovementError.INVALID_MOVE;
|
||||||
|
}
|
||||||
|
|
||||||
if (item instanceof InteractionStackHelper) return FurnitureMovementError.NONE;
|
if (item instanceof InteractionStackHelper) {
|
||||||
|
return FurnitureMovementError.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
THashSet<RoomTile> occupiedTiles = this.room.getLayout().getTilesAt(targetTile, baseItem.getWidth(), baseItem.getLength(), rotation);
|
||||||
|
|
||||||
THashSet<RoomTile> occupiedTiles = this.room.getLayout().getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
|
||||||
for (RoomTile t : occupiedTiles) {
|
for (RoomTile t : occupiedTiles) {
|
||||||
if (t.getState() == RoomTileState.INVALID) return FurnitureMovementError.INVALID_MOVE;
|
if (t.getState() == RoomTileState.INVALID) {
|
||||||
if (!Emulator.getConfig().getBoolean("wired.place.under", false) || (Emulator.getConfig().getBoolean("wired.place.under", false) && !item.isWalkable() && !item.getBaseItem().allowSit() && !item.getBaseItem().allowLay())) {
|
return FurnitureMovementError.INVALID_MOVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!wiredPlaceUnder || (!item.isWalkable() && !baseItem.allowSit() && !baseItem.allowLay())) {
|
||||||
if (checkForUnits) {
|
if (checkForUnits) {
|
||||||
if (this.room.getRoomUnitManager().hasHabbosAt(t)) return FurnitureMovementError.TILE_HAS_HABBOS;
|
if (this.room.getRoomUnitManager().hasHabbosAt(t)) {
|
||||||
}
|
return FurnitureMovementError.TILE_HAS_HABBOS;
|
||||||
if (checkForUnits) {
|
} else if (this.room.getRoomUnitManager().hasBotsAt(t)) {
|
||||||
if (!this.room.getRoomUnitManager().getBotsAt(t).isEmpty()) return FurnitureMovementError.TILE_HAS_BOTS;
|
return FurnitureMovementError.TILE_HAS_BOTS;
|
||||||
}
|
} else if (this.room.getRoomUnitManager().hasPetsAt(t)) {
|
||||||
if (checkForUnits) {
|
return FurnitureMovementError.TILE_HAS_PETS;
|
||||||
if (this.room.getRoomUnitManager().hasPetsAt(t)) return FurnitureMovementError.TILE_HAS_PETS;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<RoomItem> stackHelper = this.room.getItemsAt(tile).stream().filter(InteractionStackHelper.class::isInstance).findAny();
|
Optional<RoomItem> stackHelper = this.room.getItemsAt(targetTile).stream().filter(InteractionStackHelper.class::isInstance).findAny();
|
||||||
|
|
||||||
List<Pair<RoomTile, THashSet<RoomItem>>> tileFurniList = new ArrayList<>();
|
List<Pair<RoomTile, THashSet<RoomItem>>> tileFurniList = new ArrayList<>();
|
||||||
|
|
||||||
for (RoomTile t : occupiedTiles) {
|
for (RoomTile t : occupiedTiles) {
|
||||||
tileFurniList.add(Pair.create(t, this.room.getItemsAt(t)));
|
tileFurniList.add(Pair.create(t, this.room.getItemsAt(t)));
|
||||||
|
|
||||||
@ -612,7 +682,7 @@ public class RoomItemManager {
|
|||||||
return FurnitureMovementError.CANT_STACK;
|
return FurnitureMovementError.CANT_STACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stackHelper.isPresent() && item.getBaseItem().getInteractionType().getType() == InteractionWater.class) || topItem != null && (topItem.getBaseItem().getInteractionType().getType() == InteractionWater.class && (item.getBaseItem().getInteractionType().getType() == InteractionWater.class || item.getBaseItem().getInteractionType().getType() != InteractionWaterItem.class))) {
|
if ((stackHelper.isPresent() && baseItem.getInteractionType().getType() == InteractionWater.class) || topItem != null && (topItem.getBaseItem().getInteractionType().getType() == InteractionWater.class && (baseItem.getInteractionType().getType() == InteractionWater.class || baseItem.getInteractionType().getType() != InteractionWaterItem.class))) {
|
||||||
return FurnitureMovementError.CANT_STACK;
|
return FurnitureMovementError.CANT_STACK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
package com.eu.habbo.habbohotel.rooms;
|
||||||
|
|
||||||
|
public class RoomLayoutManager {
|
||||||
|
}
|
@ -735,7 +735,7 @@ public class RoomManager {
|
|||||||
|
|
||||||
final THashSet<RoomItem> floorItems = new THashSet<>();
|
final THashSet<RoomItem> floorItems = new THashSet<>();
|
||||||
|
|
||||||
THashSet<RoomItem> allFloorItems = new THashSet<>(room.getFloorItems());
|
THashSet<RoomItem> allFloorItems = new THashSet<>(room.getRoomItemManager().getFloorItems().values());
|
||||||
|
|
||||||
if (Emulator.getPluginManager().isRegistered(RoomFloorItemsLoadEvent.class, true)) {
|
if (Emulator.getPluginManager().isRegistered(RoomFloorItemsLoadEvent.class, true)) {
|
||||||
RoomFloorItemsLoadEvent roomFloorItemsLoadEvent = Emulator.getPluginManager().fireEvent(new RoomFloorItemsLoadEvent(habbo, allFloorItems));
|
RoomFloorItemsLoadEvent roomFloorItemsLoadEvent = Emulator.getPluginManager().fireEvent(new RoomFloorItemsLoadEvent(habbo, allFloorItems));
|
||||||
|
@ -142,7 +142,7 @@ public class RoomRightsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
this.room.ejectUserFurni(habbo.getHabboInfo().getId());
|
this.room.getRoomItemManager().ejectUserFurni(habbo.getHabboInfo().getId());
|
||||||
habbo.getRoomUnit().setRightsLevel(RoomRightLevels.NONE);
|
habbo.getRoomUnit().setRightsLevel(RoomRightLevels.NONE);
|
||||||
habbo.getRoomUnit().removeStatus(RoomUnitStatus.FLAT_CONTROL);
|
habbo.getRoomUnit().removeStatus(RoomUnitStatus.FLAT_CONTROL);
|
||||||
this.refreshRightsForHabbo(habbo);
|
this.refreshRightsForHabbo(habbo);
|
||||||
@ -151,7 +151,7 @@ public class RoomRightsManager {
|
|||||||
|
|
||||||
public void removeAllRights() {
|
public void removeAllRights() {
|
||||||
for (int userId : this.rights) {
|
for (int userId : this.rights) {
|
||||||
this.room.ejectUserFurni(userId);
|
this.room.getRoomItemManager().ejectUserFurni(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.rights.clear();
|
this.rights.clear();
|
||||||
|
@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@ -221,14 +222,14 @@ public class RoomTrade {
|
|||||||
log.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
THashSet<RoomItem> itemsUserOne = new THashSet<>(userOne.getItems());
|
HashSet<RoomItem> itemsUserOne = new HashSet<>(userOne.getItems());
|
||||||
THashSet<RoomItem> itemsUserTwo = new THashSet<>(userTwo.getItems());
|
HashSet<RoomItem> itemsUserTwo = new HashSet<>(userTwo.getItems());
|
||||||
|
|
||||||
userOne.clearItems();
|
userOne.clearItems();
|
||||||
userTwo.clearItems();
|
userTwo.clearItems();
|
||||||
|
|
||||||
int creditsForUserTwo = 0;
|
int creditsForUserTwo = 0;
|
||||||
THashSet<RoomItem> creditFurniUserOne = new THashSet<>();
|
HashSet<RoomItem> creditFurniUserOne = new HashSet<>();
|
||||||
for (RoomItem item : itemsUserOne) {
|
for (RoomItem item : itemsUserOne) {
|
||||||
int worth = RoomTrade.getCreditsByItem(item);
|
int worth = RoomTrade.getCreditsByItem(item);
|
||||||
if (worth > 0) {
|
if (worth > 0) {
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
package com.eu.habbo.habbohotel.rooms;
|
package com.eu.habbo.habbohotel.rooms;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||||
import gnu.trove.set.hash.THashSet;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class RoomTradeUser {
|
public class RoomTradeUser {
|
||||||
@Getter
|
@Getter
|
||||||
private final Habbo habbo;
|
private final Habbo habbo;
|
||||||
private final THashSet<RoomItem> items;
|
@Getter
|
||||||
|
private final HashSet<RoomItem> items;
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
private int userId;
|
private int userId;
|
||||||
@ -28,7 +30,7 @@ public class RoomTradeUser {
|
|||||||
|
|
||||||
this.accepted = false;
|
this.accepted = false;
|
||||||
this.confirmed = false;
|
this.confirmed = false;
|
||||||
this.items = new THashSet<>();
|
this.items = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void confirm() {
|
public void confirm() {
|
||||||
@ -49,10 +51,6 @@ public class RoomTradeUser {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public THashSet<RoomItem> getItems() {
|
|
||||||
return this.items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void putItemsIntoInventory() {
|
public void putItemsIntoInventory() {
|
||||||
this.habbo.getInventory().getItemsComponent().addItems(this.items);
|
this.habbo.getInventory().getItemsComponent().addItems(this.items);
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,6 @@ public abstract class RoomUnit extends RoomEntity {
|
|||||||
//RoomHabbo
|
//RoomHabbo
|
||||||
private int idleTicks;
|
private int idleTicks;
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
|
||||||
private RoomRightLevels rightsLevel = RoomRightLevels.NONE;
|
private RoomRightLevels rightsLevel = RoomRightLevels.NONE;
|
||||||
private final THashSet<Integer> overridableTiles;
|
private final THashSet<Integer> overridableTiles;
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ import com.eu.habbo.plugin.events.users.UserGetIPAddressEvent;
|
|||||||
import com.eu.habbo.plugin.events.users.UserPointsEvent;
|
import com.eu.habbo.plugin.events.users.UserPointsEvent;
|
||||||
import gnu.trove.TIntCollection;
|
import gnu.trove.TIntCollection;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import gnu.trove.set.hash.THashSet;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -333,13 +332,6 @@ public class Habbo extends Unit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addFurniture(THashSet<RoomItem> items) {
|
|
||||||
this.inventory.getItemsComponent().addItems(items);
|
|
||||||
this.client.sendResponse(new UnseenItemsComposer(items));
|
|
||||||
this.client.sendResponse(new FurniListInvalidateComposer());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void removeFurniture(RoomItem item) {
|
public void removeFurniture(RoomItem item) {
|
||||||
this.inventory.getItemsComponent().removeHabboItem(item);
|
this.inventory.getItemsComponent().removeHabboItem(item);
|
||||||
this.client.sendResponse(new FurniListRemoveComposer(item.getId()));
|
this.client.sendResponse(new FurniListRemoveComposer(item.getId()));
|
||||||
|
@ -2,9 +2,9 @@ package com.eu.habbo.habbohotel.users.inventory;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
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.entities.items.RoomItem;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboInventory;
|
import com.eu.habbo.habbohotel.users.HabboInventory;
|
||||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
|
||||||
import com.eu.habbo.plugin.events.inventory.InventoryItemAddedEvent;
|
import com.eu.habbo.plugin.events.inventory.InventoryItemAddedEvent;
|
||||||
import com.eu.habbo.plugin.events.inventory.InventoryItemRemovedEvent;
|
import com.eu.habbo.plugin.events.inventory.InventoryItemRemovedEvent;
|
||||||
import com.eu.habbo.plugin.events.inventory.InventoryItemsAddedEvent;
|
import com.eu.habbo.plugin.events.inventory.InventoryItemsAddedEvent;
|
||||||
@ -21,6 +21,7 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -79,7 +80,7 @@ public class ItemsComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addItems(THashSet<RoomItem> items) {
|
public void addItems(HashSet<RoomItem> items) {
|
||||||
InventoryItemsAddedEvent event = new InventoryItemsAddedEvent(this.inventory, items);
|
InventoryItemsAddedEvent event = new InventoryItemsAddedEvent(this.inventory, items);
|
||||||
if (Emulator.getPluginManager().fireEvent(event).isCancelled()) {
|
if (Emulator.getPluginManager().fireEvent(event).isCancelled()) {
|
||||||
return;
|
return;
|
||||||
|
@ -23,7 +23,8 @@ public class PresentOpenEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (room.getRoomInfo().getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
|
if (room.getRoomInfo().getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
|
||||||
RoomItem item = room.getHabboItem(this.packet.readInt());
|
int id = this.packet.readInt();
|
||||||
|
RoomItem item = room.getRoomItemManager().getRoomItemById(id);
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
return;
|
||||||
@ -50,7 +51,7 @@ public class PresentOpenEvent extends MessageHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
room.sendComposer(new RemoveFloorItemComposer(item).compose());
|
room.sendComposer(new RemoveFloorItemComposer(item).compose());
|
||||||
room.removeHabboItem(item);
|
room.getRoomItemManager().removeRoomItem(item);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ public class CraftEvent extends MessageHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void handle() {
|
public void handle() {
|
||||||
int craftingTable = this.packet.readInt();
|
int craftingTable = this.packet.readInt();
|
||||||
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(craftingTable);
|
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getRoomItemById(craftingTable);
|
||||||
CraftingAltar altar = Emulator.getGameEnvironment().getCraftingManager().getAltar(item.getBaseItem());
|
CraftingAltar altar = Emulator.getGameEnvironment().getCraftingManager().getAltar(item.getBaseItem());
|
||||||
CraftingRecipe recipe = altar.getRecipe(this.packet.readString());
|
CraftingRecipe recipe = altar.getRecipe(this.packet.readString());
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public class CraftSecretEvent extends MessageHandler {
|
|||||||
int altarId = this.packet.readInt();
|
int altarId = this.packet.readInt();
|
||||||
int count = this.packet.readInt();
|
int count = this.packet.readInt();
|
||||||
|
|
||||||
RoomItem craftingAltar = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(altarId);
|
RoomItem craftingAltar = this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getRoomItemById(altarId);
|
||||||
|
|
||||||
if (craftingAltar != null) {
|
if (craftingAltar != null) {
|
||||||
CraftingAltar altar = Emulator.getGameEnvironment().getCraftingManager().getAltar(craftingAltar.getBaseItem());
|
CraftingAltar altar = Emulator.getGameEnvironment().getCraftingManager().getAltar(craftingAltar.getBaseItem());
|
||||||
|
@ -10,7 +10,7 @@ public class GetCraftingRecipeEvent extends MessageHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void handle() {
|
public void handle() {
|
||||||
int itemId = this.packet.readInt();
|
int itemId = this.packet.readInt();
|
||||||
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
|
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
CraftingAltar altar = Emulator.getGameEnvironment().getCraftingManager().getAltar(item.getBaseItem());
|
CraftingAltar altar = Emulator.getGameEnvironment().getCraftingManager().getAltar(item.getBaseItem());
|
||||||
|
@ -16,7 +16,7 @@ public class GetCraftingRecipesAvailableEvent extends MessageHandler {
|
|||||||
public void handle() {
|
public void handle() {
|
||||||
int altarId = this.packet.readInt();
|
int altarId = this.packet.readInt();
|
||||||
|
|
||||||
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(altarId);
|
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getRoomItemById(altarId);
|
||||||
|
|
||||||
CraftingAltar altar = Emulator.getGameEnvironment().getCraftingManager().getAltar(item.getBaseItem());
|
CraftingAltar altar = Emulator.getGameEnvironment().getCraftingManager().getAltar(item.getBaseItem());
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ public class GetGuildFurniContextMenuInfoEvent extends MessageHandler {
|
|||||||
int guildId = this.packet.readInt();
|
int guildId = this.packet.readInt();
|
||||||
|
|
||||||
if (this.client.getHabbo().getRoomUnit().getRoom() != null) {
|
if (this.client.getHabbo().getRoomUnit().getRoom() != null) {
|
||||||
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
|
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getRoomItemById(itemId);
|
||||||
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId);
|
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId);
|
||||||
|
|
||||||
if (item != null && guild != null)
|
if (item != null && guild != null)
|
||||||
|
@ -57,7 +57,7 @@ public class KickMemberEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
if (room.getRoomInfo().getGuild().getId() == guildId) {
|
if (room.getRoomInfo().getGuild().getId() == guildId) {
|
||||||
room.ejectUserFurni(userId);
|
room.getRoomItemManager().ejectUserFurni(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public class CallForHelpFromPhotoEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (room == null) return;
|
if (room == null) return;
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (!(item instanceof InteractionExternalImage)) return;
|
if (!(item instanceof InteractionExternalImage)) return;
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@ public class DeleteRoomEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
room.ejectAllFurni();
|
room.getRoomItemManager().ejectAllFurni();
|
||||||
room.ejectUserFurni(room.getRoomInfo().getOwnerInfo().getId());
|
room.getRoomItemManager().ejectUserFurni(room.getRoomInfo().getOwnerInfo().getId());
|
||||||
|
|
||||||
List<Bot> bots = new ArrayList<>(room.getRoomUnitManager().getCurrentRoomBots().values());
|
List<Bot> bots = new ArrayList<>(room.getRoomUnitManager().getCurrentRoomBots().values());
|
||||||
for (Bot bot : bots) {
|
for (Bot bot : bots) {
|
||||||
|
@ -17,7 +17,7 @@ public class SetRoomBackgroundColorDataEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (room.getRoomRightsManager().hasRights(this.client.getHabbo()) || this.client.getHabbo().hasRight(Permission.ACC_PLACEFURNI)) {
|
if (room.getRoomRightsManager().hasRights(this.client.getHabbo()) || this.client.getHabbo().hasRight(Permission.ACC_PLACEFURNI)) {
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
return;
|
||||||
|
@ -35,7 +35,7 @@ public class AddSpamWallPostItEvent extends MessageHandler {
|
|||||||
String text = this.packet.readString();
|
String text = this.packet.readString();
|
||||||
|
|
||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
||||||
RoomItem sticky = room.getHabboItem(itemId);
|
RoomItem sticky = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (sticky != null && sticky.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) {
|
if (sticky != null && sticky.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) {
|
||||||
sticky.setOwnerId(room.getRoomInfo().getOwnerInfo().getId());
|
sticky.setOwnerId(room.getRoomInfo().getOwnerInfo().getId());
|
||||||
|
@ -23,7 +23,7 @@ public class CreditFurniRedeemEvent extends MessageHandler {
|
|||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
||||||
|
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item != null && this.client.getHabbo().getHabboInfo().getId() == item.getOwnerId()) {
|
if (item != null && this.client.getHabbo().getHabboInfo().getId() == item.getOwnerId()) {
|
||||||
boolean furnitureRedeemEventRegistered = Emulator.getPluginManager().isRegistered(FurnitureRedeemedEvent.class, true);
|
boolean furnitureRedeemEventRegistered = Emulator.getPluginManager().isRegistered(FurnitureRedeemedEvent.class, true);
|
||||||
@ -93,10 +93,10 @@ public class CreditFurniRedeemEvent extends MessageHandler {
|
|||||||
if (furniRedeemEvent.amount < 1)
|
if (furniRedeemEvent.amount < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (room.getHabboItem(item.getId()) == null) // plugins may cause a lag between which time the item can be removed from the room
|
if (room.getRoomItemManager().getRoomItemById(item.getId()) == null) // plugins may cause a lag between which time the item can be removed from the room
|
||||||
return;
|
return;
|
||||||
|
|
||||||
room.removeHabboItem(item);
|
room.getRoomItemManager().removeRoomItem(item);
|
||||||
room.sendComposer(new RemoveFloorItemComposer(item).compose());
|
room.sendComposer(new RemoveFloorItemComposer(item).compose());
|
||||||
RoomTile t = room.getLayout().getTile(item.getX(), item.getY());
|
RoomTile t = room.getLayout().getTile(item.getX(), item.getY());
|
||||||
t.setStackHeight(room.getStackHeight(item.getX(), item.getY(), false));
|
t.setStackHeight(room.getStackHeight(item.getX(), item.getY(), false));
|
||||||
|
@ -27,7 +27,7 @@ public class CustomizeAvatarWithFurniEvent extends MessageHandler {
|
|||||||
int itemId = this.packet.readInt();
|
int itemId = this.packet.readInt();
|
||||||
|
|
||||||
if (this.client.getHabbo().getRoomUnit().getRoom() != null && this.client.getHabbo().getRoomUnit().getRoom().getRoomRightsManager().hasRights(this.client.getHabbo())) {
|
if (this.client.getHabbo().getRoomUnit().getRoom() != null && this.client.getHabbo().getRoomUnit().getRoom().getRoomRightsManager().hasRights(this.client.getHabbo())) {
|
||||||
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
|
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item != null && item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) {
|
if (item != null && item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) {
|
||||||
if (item instanceof InteractionClothing) {
|
if (item instanceof InteractionClothing) {
|
||||||
@ -37,7 +37,7 @@ public class CustomizeAvatarWithFurniEvent extends MessageHandler {
|
|||||||
if (!this.client.getHabbo().getInventory().getWardrobeComponent().getClothing().contains(clothing.getId())) {
|
if (!this.client.getHabbo().getInventory().getWardrobeComponent().getClothing().contains(clothing.getId())) {
|
||||||
item.setRoomId(0);
|
item.setRoomId(0);
|
||||||
RoomTile tile = this.client.getHabbo().getRoomUnit().getRoom().getLayout().getTile(item.getX(), item.getY());
|
RoomTile tile = this.client.getHabbo().getRoomUnit().getRoom().getLayout().getTile(item.getX(), item.getY());
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().removeHabboItem(item);
|
this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().removeRoomItem(item);
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().updateTile(tile);
|
this.client.getHabbo().getRoomUnit().getRoom().updateTile(tile);
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new HeightMapUpdateMessageComposer(tile.getX(), tile.getY(), tile.getZ(), tile.relativeHeight()).compose());
|
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new HeightMapUpdateMessageComposer(tile.getX(), tile.getY(), tile.getZ(), tile.relativeHeight()).compose());
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new RemoveFloorItemComposer(item, true).compose());
|
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new RemoveFloorItemComposer(item, true).compose());
|
||||||
|
@ -18,7 +18,7 @@ public class DiceOffEvent extends MessageHandler {
|
|||||||
if (room == null)
|
if (room == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
if (item instanceof InteractionDice) {
|
if (item instanceof InteractionDice) {
|
||||||
|
@ -11,7 +11,7 @@ public class EnterOneWayDoorEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int itemId = this.packet.readInt();
|
int itemId = this.packet.readInt();
|
||||||
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
|
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
return;
|
||||||
|
@ -14,7 +14,7 @@ public class GetItemDataEvent extends MessageHandler {
|
|||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
||||||
|
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item instanceof InteractionPostIt) {
|
if (item instanceof InteractionPostIt) {
|
||||||
this.client.sendResponse(new ItemDataUpdateMessageComposer((InteractionPostIt) item));
|
this.client.sendResponse(new ItemDataUpdateMessageComposer((InteractionPostIt) item));
|
||||||
|
@ -14,26 +14,26 @@ public class MoveObjectEvent extends MessageHandler {
|
|||||||
public void handle() {
|
public void handle() {
|
||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
||||||
|
|
||||||
if (room == null)
|
if (room == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int furniId = this.packet.readInt();
|
int itemId = this.packet.readInt();
|
||||||
RoomItem item = room.getHabboItem(furniId);
|
|
||||||
if (item == null) return;
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
|
if (item == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int x = this.packet.readInt();
|
int x = this.packet.readInt();
|
||||||
int y = this.packet.readInt();
|
int y = this.packet.readInt();
|
||||||
int rotation = this.packet.readInt();
|
int rotation = this.packet.readInt();
|
||||||
|
|
||||||
RoomTile tile = room.getLayout().getTile((short) x, (short) y);
|
RoomTile tile = room.getLayout().getTile((short) x, (short) y);
|
||||||
|
|
||||||
FurnitureMovementError error = room.getRoomItemManager().canPlaceFurnitureAt(item, this.client.getHabbo(), tile, rotation);
|
FurnitureMovementError error = room.getRoomItemManager().moveItemTo(item, tile, rotation, this.client.getHabbo());
|
||||||
if (!error.equals(FurnitureMovementError.NONE)) {
|
|
||||||
this.client.sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.getKey(), error.getErrorCode()));
|
|
||||||
this.client.sendResponse(new ObjectUpdateMessageComposer(item));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
error = room.getRoomItemManager().moveFurniTo(item, tile, rotation, this.client.getHabbo());
|
|
||||||
if (!error.equals(FurnitureMovementError.NONE)) {
|
if (!error.equals(FurnitureMovementError.NONE)) {
|
||||||
this.client.sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.getKey(), error.getErrorCode()));
|
this.client.sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.getKey(), error.getErrorCode()));
|
||||||
this.client.sendResponse(new ObjectUpdateMessageComposer(item));
|
this.client.sendResponse(new ObjectUpdateMessageComposer(item));
|
||||||
|
@ -30,7 +30,7 @@ public class MoveWallItemEvent extends MessageHandler {
|
|||||||
if (itemId <= 0 || wallPosition.length() <= 13)
|
if (itemId <= 0 || wallPosition.length() <= 13)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
return;
|
||||||
|
@ -18,7 +18,7 @@ public class PickupObjectEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item == null || item instanceof InteractionPostIt) {
|
if (item == null || item instanceof InteractionPostIt) {
|
||||||
return;
|
return;
|
||||||
|
@ -72,7 +72,7 @@ public class PlaceObjectEvent extends MessageHandler {
|
|||||||
RoomItem rentSpace = null;
|
RoomItem rentSpace = null;
|
||||||
|
|
||||||
if (this.client.getHabbo().getHabboStats().isRentingSpace()) {
|
if (this.client.getHabbo().getHabboStats().isRentingSpace()) {
|
||||||
rentSpace = room.getHabboItem(this.client.getHabbo().getHabboStats().getRentedItemId());
|
rentSpace = room.getRoomItemManager().getRoomItemById(this.client.getHabbo().getHabboStats().getRentedItemId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rentSpace != null || buildArea != null) && !room.getRoomRightsManager().hasRights(this.client.getHabbo())) {
|
if ((rentSpace != null || buildArea != null) && !room.getRoomRightsManager().hasRights(this.client.getHabbo())) {
|
||||||
@ -101,7 +101,7 @@ public class PlaceObjectEvent extends MessageHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
FurnitureMovementError error = room.getRoomItemManager().placeWallFurniAt(item, values[1] + " " + values[2] + " " + values[3], this.client.getHabbo());
|
FurnitureMovementError error = room.getRoomItemManager().placeWallItemAt(item, values[1] + " " + values[2] + " " + values[3], this.client.getHabbo());
|
||||||
if (!error.equals(FurnitureMovementError.NONE)) {
|
if (!error.equals(FurnitureMovementError.NONE)) {
|
||||||
this.client.sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.getKey(), error.getErrorCode()));
|
this.client.sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.getKey(), error.getErrorCode()));
|
||||||
return;
|
return;
|
||||||
|
@ -27,7 +27,7 @@ public class PlacePostItEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (item instanceof InteractionPostIt) {
|
if (item instanceof InteractionPostIt) {
|
||||||
if (room.getPostItNotes().size() < Room.MAXIMUM_POSTITNOTES) {
|
if (room.getPostItNotes().size() < Room.MAXIMUM_POSTITNOTES) {
|
||||||
room.addHabboItem(item);
|
room.getRoomItemManager().addRoomItem(item);
|
||||||
item.setExtradata("FFFF33");
|
item.setExtradata("FFFF33");
|
||||||
item.setRoomId(this.client.getHabbo().getRoomUnit().getRoom().getRoomInfo().getId());
|
item.setRoomId(this.client.getHabbo().getRoomUnit().getRoom().getRoomInfo().getId());
|
||||||
item.setWallPosition(location);
|
item.setWallPosition(location);
|
||||||
|
@ -20,12 +20,12 @@ public class RemoveItemEvent extends MessageHandler {
|
|||||||
if (room == null)
|
if (room == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item instanceof InteractionPostIt || item instanceof InteractionExternalImage) {
|
if (item instanceof InteractionPostIt || item instanceof InteractionExternalImage) {
|
||||||
if (item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
|
if (item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
|
||||||
item.setRoomId(0);
|
item.setRoomId(0);
|
||||||
room.removeHabboItem(item);
|
room.getRoomItemManager().removeRoomItem(item);
|
||||||
room.sendComposer(new ItemRemoveMessageComposer(item).compose());
|
room.sendComposer(new ItemRemoveMessageComposer(item).compose());
|
||||||
Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId()));
|
Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId()));
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,8 @@ public class SetClothingChangeDataEvent extends MessageHandler {
|
|||||||
if (room == null || this.client.getHabbo().getHabboInfo().getId() != room.getRoomInfo().getOwnerInfo().getId())
|
if (room == null || this.client.getHabbo().getHabboInfo().getId() != room.getRoomInfo().getOwnerInfo().getId())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(this.packet.readInt());
|
int id = this.packet.readInt();
|
||||||
|
RoomItem item = room.getRoomItemManager().getRoomItemById(id);
|
||||||
if (!(item instanceof InteractionFootballGate))
|
if (!(item instanceof InteractionFootballGate))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public class SetCustomStackingHeightEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (this.client.getHabbo().getHabboInfo().getId() == this.client.getHabbo().getRoomUnit().getRoom().getRoomInfo().getOwnerInfo().getId() || this.client.getHabbo().getRoomUnit().getRoom().getRoomRightsManager().hasRights(this.client.getHabbo())) {
|
if (this.client.getHabbo().getHabboInfo().getId() == this.client.getHabbo().getRoomUnit().getRoom().getRoomInfo().getOwnerInfo().getId() || this.client.getHabbo().getRoomUnit().getRoom().getRoomRightsManager().hasRights(this.client.getHabbo())) {
|
||||||
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
|
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item instanceof InteractionStackHelper) {
|
if (item instanceof InteractionStackHelper) {
|
||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
||||||
|
@ -34,7 +34,7 @@ public class SetItemDataEvent extends MessageHandler {
|
|||||||
if (room == null)
|
if (room == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (!(item instanceof InteractionPostIt))
|
if (!(item instanceof InteractionPostIt))
|
||||||
return;
|
return;
|
||||||
|
@ -15,7 +15,8 @@ public class SetMannequinFigureEvent extends MessageHandler {
|
|||||||
if (room == null || !room.getRoomInfo().isRoomOwner(habbo))
|
if (room == null || !room.getRoomInfo().isRoomOwner(habbo))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(this.packet.readInt());
|
int id = this.packet.readInt();
|
||||||
|
RoomItem item = room.getRoomItemManager().getRoomItemById(id);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -12,7 +12,8 @@ public class SetMannequinNameEvent extends MessageHandler {
|
|||||||
if (room == null || !room.getRoomInfo().isRoomOwner(this.client.getHabbo()))
|
if (room == null || !room.getRoomInfo().isRoomOwner(this.client.getHabbo()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(this.packet.readInt());
|
int id = this.packet.readInt();
|
||||||
|
RoomItem item = room.getRoomItemManager().getRoomItemById(id);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -19,7 +19,8 @@ public class SetObjectDataEvent extends MessageHandler {
|
|||||||
if (!room.getRoomRightsManager().hasRights(this.client.getHabbo()))
|
if (!room.getRoomRightsManager().hasRights(this.client.getHabbo()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(this.packet.readInt());
|
int id = this.packet.readInt();
|
||||||
|
RoomItem item = room.getRoomItemManager().getRoomItemById(id);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public class SetRandomStateEvent extends MessageHandler {
|
|||||||
|
|
||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (!(item instanceof InteractionRandomState randomStateItem))
|
if (!(item instanceof InteractionRandomState randomStateItem))
|
||||||
return;
|
return;
|
||||||
|
@ -15,7 +15,7 @@ public class SpinWheelOfFortuneEvent extends MessageHandler {
|
|||||||
if (room == null)
|
if (room == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item instanceof InteractionColorWheel) {
|
if (item instanceof InteractionColorWheel) {
|
||||||
item.onClick(this.client, room, null);
|
item.onClick(this.client, room, null);
|
||||||
|
@ -18,7 +18,7 @@ public class ThrowDiceEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
if (item instanceof InteractionDice || item instanceof InteractionSpinningBottle) {
|
if (item instanceof InteractionDice || item instanceof InteractionSpinningBottle) {
|
||||||
|
@ -34,7 +34,7 @@ public class UseFurnitureEvent extends MessageHandler {
|
|||||||
int itemId = this.packet.readInt();
|
int itemId = this.packet.readInt();
|
||||||
int state = this.packet.readInt();
|
int state = this.packet.readInt();
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item == null || item instanceof InteractionDice || item instanceof InteractionSpinningBottle)
|
if (item == null || item instanceof InteractionDice || item instanceof InteractionSpinningBottle)
|
||||||
return;
|
return;
|
||||||
@ -71,7 +71,7 @@ public class UseFurnitureEvent extends MessageHandler {
|
|||||||
|
|
||||||
MonsterplantPet pet = Emulator.getGameEnvironment().getPetManager().createMonsterplant(room, this.client.getHabbo(), isRare, room.getLayout().getTile(item.getX(), item.getY()), rarity);
|
MonsterplantPet pet = Emulator.getGameEnvironment().getPetManager().createMonsterplant(room, this.client.getHabbo(), isRare, room.getLayout().getTile(item.getX(), item.getY()), rarity);
|
||||||
room.sendComposer(new RemoveFloorItemComposer(item, true).compose());
|
room.sendComposer(new RemoveFloorItemComposer(item, true).compose());
|
||||||
room.removeHabboItem(item);
|
room.getRoomItemManager().removeRoomItem(item);
|
||||||
room.updateTile(room.getLayout().getTile(item.getX(), item.getY()));
|
room.updateTile(room.getLayout().getTile(item.getX(), item.getY()));
|
||||||
room.getRoomUnitManager().placePet(pet, room, item.getX(), item.getY(), item.getZ());
|
room.getRoomUnitManager().placePet(pet, room, item.getX(), item.getY(), item.getZ());
|
||||||
pet.cycle();
|
pet.cycle();
|
||||||
|
@ -18,7 +18,7 @@ public class UseWallItemEvent extends MessageHandler {
|
|||||||
int itemId = this.packet.readInt();
|
int itemId = this.packet.readInt();
|
||||||
int state = this.packet.readInt();
|
int state = this.packet.readInt();
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
return;
|
||||||
|
@ -16,7 +16,7 @@ public class FriendFurniConfirmLockEvent extends MessageHandler {
|
|||||||
if (this.client.getHabbo().getRoomUnit().getRoom() == null)
|
if (this.client.getHabbo().getRoomUnit().getRoom() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
|
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
return;
|
||||||
|
@ -16,7 +16,7 @@ public class RentableSpaceCancelRentEvent extends MessageHandler {
|
|||||||
if (room == null)
|
if (room == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (room.getRoomInfo().getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() ||
|
if (room.getRoomInfo().getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() ||
|
||||||
this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
|
this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
|
||||||
|
@ -15,7 +15,7 @@ public class RentableSpaceRentEvent extends MessageHandler {
|
|||||||
if (room == null)
|
if (room == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (!(item instanceof InteractionRentableSpace))
|
if (!(item instanceof InteractionRentableSpace))
|
||||||
return;
|
return;
|
||||||
|
@ -46,7 +46,7 @@ public class ControlYoutubeDisplayPlaybackEvent extends YoutubeEvent {
|
|||||||
if(!validate(habbo)) return;
|
if(!validate(habbo)) return;
|
||||||
|
|
||||||
Room room = habbo.getRoomUnit().getRoom();
|
Room room = habbo.getRoomUnit().getRoom();
|
||||||
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
|
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (!(item instanceof InteractionYoutubeTV tv)) return;
|
if (!(item instanceof InteractionYoutubeTV tv)) return;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class GetYoutubeDisplayStatusEvent extends MessageHandler {
|
|||||||
int itemId = this.packet.readInt();
|
int itemId = this.packet.readInt();
|
||||||
|
|
||||||
if (this.client.getHabbo().getRoomUnit().getRoom() != null) {
|
if (this.client.getHabbo().getRoomUnit().getRoom() != null) {
|
||||||
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
|
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item instanceof InteractionYoutubeTV tv) {
|
if (item instanceof InteractionYoutubeTV tv) {
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ public class SetYoutubeDisplayPlaylistEvent extends YoutubeEvent {
|
|||||||
Room room = habbo.getRoomUnit().getRoom();
|
Room room = habbo.getRoomUnit().getRoom();
|
||||||
|
|
||||||
|
|
||||||
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
|
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (!(item instanceof InteractionYoutubeTV)) return;
|
if (!(item instanceof InteractionYoutubeTV)) return;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ public class CancelPetBreedingEvent extends MessageHandler {
|
|||||||
public void handle() {
|
public void handle() {
|
||||||
int itemId = this.packet.readInt();
|
int itemId = this.packet.readInt();
|
||||||
|
|
||||||
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
|
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item instanceof InteractionPetBreedingNest) {
|
if (item instanceof InteractionPetBreedingNest) {
|
||||||
((InteractionPetBreedingNest) item).stopBreeding(this.client.getHabbo());
|
((InteractionPetBreedingNest) item).stopBreeding(this.client.getHabbo());
|
||||||
|
@ -37,7 +37,7 @@ public class CompostPlantEvent extends MessageHandler {
|
|||||||
compost.setY(pet.getRoomUnit().getCurrentPosition().getY());
|
compost.setY(pet.getRoomUnit().getCurrentPosition().getY());
|
||||||
compost.setZ(pet.getRoomUnit().getCurrentZ());
|
compost.setZ(pet.getRoomUnit().getCurrentZ());
|
||||||
compost.setRotation(pet.getRoomUnit().getBodyRotation().getValue());
|
compost.setRotation(pet.getRoomUnit().getBodyRotation().getValue());
|
||||||
room.addHabboItem(compost);
|
room.getRoomItemManager().addRoomItem(compost);
|
||||||
room.sendComposer(new ObjectAddMessageComposer(compost, this.client.getHabbo().getHabboInfo().getUsername()).compose());
|
room.sendComposer(new ObjectAddMessageComposer(compost, this.client.getHabbo().getHabboInfo().getUsername()).compose());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ public class ConfirmPetBreedingEvent extends MessageHandler {
|
|||||||
int petOneId = this.packet.readInt();
|
int petOneId = this.packet.readInt();
|
||||||
int petTwoId = this.packet.readInt();
|
int petTwoId = this.packet.readInt();
|
||||||
|
|
||||||
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
|
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item instanceof InteractionPetBreedingNest) {
|
if (item instanceof InteractionPetBreedingNest) {
|
||||||
((InteractionPetBreedingNest) item).breed(this.client.getHabbo(), name);
|
((InteractionPetBreedingNest) item).breed(this.client.getHabbo(), name);
|
||||||
|
@ -24,7 +24,7 @@ public class CustomizePetWithFurniEvent extends MessageHandler {
|
|||||||
if (room == null)
|
if (room == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
|
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getRoomItemById(itemId);
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
return;
|
||||||
@ -83,7 +83,7 @@ public class CustomizePetWithFurniEvent extends MessageHandler {
|
|||||||
Emulator.getThreading().run(pet);
|
Emulator.getThreading().run(pet);
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new PetFigureUpdateComposer((HorsePet) pet).compose());
|
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new PetFigureUpdateComposer((HorsePet) pet).compose());
|
||||||
|
|
||||||
room.removeHabboItem(item);
|
room.getRoomItemManager().removeRoomItem(item);
|
||||||
room.sendComposer(new RemoveFloorItemComposer(item, true).compose());
|
room.sendComposer(new RemoveFloorItemComposer(item, true).compose());
|
||||||
item.setRoomId(0);
|
item.setRoomId(0);
|
||||||
Emulator.getGameEnvironment().getItemManager().deleteItem(item);
|
Emulator.getGameEnvironment().getItemManager().deleteItem(item);
|
||||||
@ -96,7 +96,7 @@ public class CustomizePetWithFurniEvent extends MessageHandler {
|
|||||||
pet.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, "rev");
|
pet.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, "rev");
|
||||||
pet.setPacketUpdate(true);
|
pet.setPacketUpdate(true);
|
||||||
|
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().removeHabboItem(item);
|
this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().removeRoomItem(item);
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new RemoveFloorItemComposer(item).compose());
|
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new RemoveFloorItemComposer(item).compose());
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new UserUpdateComposer(pet.getRoomUnit()).compose());
|
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new UserUpdateComposer(pet.getRoomUnit()).compose());
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new PetStatusUpdateComposer(pet).compose());
|
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new PetStatusUpdateComposer(pet).compose());
|
||||||
@ -112,7 +112,7 @@ public class CustomizePetWithFurniEvent extends MessageHandler {
|
|||||||
pet.cycle();
|
pet.cycle();
|
||||||
pet.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, "spd");
|
pet.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, "spd");
|
||||||
pet.getRoomUnit().setStatus(RoomUnitStatus.fromString("grw" + ((MonsterplantPet) pet).getGrowthStage()), "");
|
pet.getRoomUnit().setStatus(RoomUnitStatus.fromString("grw" + ((MonsterplantPet) pet).getGrowthStage()), "");
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().removeHabboItem(item);
|
this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().removeRoomItem(item);
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new RemoveFloorItemComposer(item).compose());
|
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new RemoveFloorItemComposer(item).compose());
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new UserUpdateComposer(pet.getRoomUnit()).compose());
|
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new UserUpdateComposer(pet.getRoomUnit()).compose());
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new PetStatusUpdateComposer(pet).compose());
|
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new PetStatusUpdateComposer(pet).compose());
|
||||||
@ -134,7 +134,7 @@ public class CustomizePetWithFurniEvent extends MessageHandler {
|
|||||||
pet.getRoomUnit().clearStatuses();
|
pet.getRoomUnit().clearStatuses();
|
||||||
pet.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, "reb");
|
pet.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, "reb");
|
||||||
|
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().removeHabboItem(item);
|
this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().removeRoomItem(item);
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new RemoveFloorItemComposer(item).compose());
|
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new RemoveFloorItemComposer(item).compose());
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new UserUpdateComposer(pet.getRoomUnit()).compose());
|
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new UserUpdateComposer(pet.getRoomUnit()).compose());
|
||||||
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new PetStatusUpdateComposer(pet).compose());
|
this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new PetStatusUpdateComposer(pet).compose());
|
||||||
|
@ -21,7 +21,7 @@ public class OpenPetPackageEvent extends MessageHandler {
|
|||||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
||||||
|
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
RoomItem item = room.getHabboItem(itemId);
|
RoomItem item = room.getRoomItemManager().getRoomItemById(itemId);
|
||||||
if (item != null && item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) {
|
if (item != null && item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) {
|
||||||
if (!name.matches("^[a-zA-Z0-9]*$")) {
|
if (!name.matches("^[a-zA-Z0-9]*$")) {
|
||||||
this.client.sendResponse(new PerkAllowancesComposer(itemId, PerkAllowancesComposer.CONTAINS_INVALID_CHARS, name.replaceAll("^[a-zA-Z0-9]*$", "")));
|
this.client.sendResponse(new PerkAllowancesComposer(itemId, PerkAllowancesComposer.CONTAINS_INVALID_CHARS, name.replaceAll("^[a-zA-Z0-9]*$", "")));
|
||||||
@ -61,7 +61,7 @@ public class OpenPetPackageEvent extends MessageHandler {
|
|||||||
pet.getRoomUnit().setLocation(room.getLayout().getTile(item.getX(), item.getY()));
|
pet.getRoomUnit().setLocation(room.getLayout().getTile(item.getX(), item.getY()));
|
||||||
pet.getRoomUnit().setCurrentZ(item.getZ());
|
pet.getRoomUnit().setCurrentZ(item.getZ());
|
||||||
Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId()));
|
Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId()));
|
||||||
room.removeHabboItem(item);
|
room.getRoomItemManager().removeRoomItem(item);
|
||||||
room.sendComposer(new RemoveFloorItemComposer(item).compose());
|
room.sendComposer(new RemoveFloorItemComposer(item).compose());
|
||||||
RoomTile tile = room.getLayout().getTile(item.getX(), item.getY());
|
RoomTile tile = room.getLayout().getTile(item.getX(), item.getY());
|
||||||
room.updateTile(room.getLayout().getTile(item.getX(), item.getY()));
|
room.updateTile(room.getLayout().getTile(item.getX(), item.getY()));
|
||||||
|
@ -26,7 +26,7 @@ public class SignEvent extends MessageHandler {
|
|||||||
if(signId <= 10) {
|
if(signId <= 10) {
|
||||||
|
|
||||||
int userId = this.client.getHabbo().getHabboInfo().getId();
|
int userId = this.client.getHabbo().getHabboInfo().getId();
|
||||||
for (RoomItem item : room.getFloorItems()) {
|
for (RoomItem item : room.getRoomItemManager().getFloorItems().values()) {
|
||||||
if (item instanceof InteractionVoteCounter) {
|
if (item instanceof InteractionVoteCounter) {
|
||||||
((InteractionVoteCounter)item).vote(room, userId, signId);
|
((InteractionVoteCounter)item).vote(room, userId, signId);
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class ApplySnapshotEvent extends MessageHandler {
|
|||||||
|
|
||||||
// Try to apply the set settings to each item
|
// Try to apply the set settings to each item
|
||||||
wired.getMatchSettings().forEach(setting -> {
|
wired.getMatchSettings().forEach(setting -> {
|
||||||
RoomItem matchItem = room.getHabboItem(setting.getItem_id());
|
RoomItem matchItem = room.getRoomItemManager().getRoomItemById(setting.getItem_id());
|
||||||
|
|
||||||
// Match state
|
// Match state
|
||||||
if (wired.shouldMatchState() && matchItem.allowWiredResetState() && !setting.getState().equals(" ") && !matchItem.getExtradata().equals(setting.getState())) {
|
if (wired.shouldMatchState() && matchItem.allowWiredResetState() && !setting.getState().equals(" ") && !matchItem.getExtradata().equals(setting.getState())) {
|
||||||
@ -76,7 +76,7 @@ public class ApplySnapshotEvent extends MessageHandler {
|
|||||||
// Match Position & Rotation
|
// Match Position & Rotation
|
||||||
if (wired.shouldMatchRotation() && !wired.shouldMatchPosition()) {
|
if (wired.shouldMatchRotation() && !wired.shouldMatchPosition()) {
|
||||||
if (matchItem.getRotation() != setting.getRotation() && room.getRoomItemManager().furnitureFitsAt(oldLocation, matchItem, setting.getRotation(), false) == FurnitureMovementError.NONE) {
|
if (matchItem.getRotation() != setting.getRotation() && room.getRoomItemManager().furnitureFitsAt(oldLocation, matchItem, setting.getRotation(), false) == FurnitureMovementError.NONE) {
|
||||||
room.getRoomItemManager().moveFurniTo(matchItem, oldLocation, setting.getRotation(), null, true, true);
|
room.getRoomItemManager().moveItemTo(matchItem, oldLocation, setting.getRotation(), null, true, true);
|
||||||
}
|
}
|
||||||
} else if (wired.shouldMatchPosition()) {
|
} else if (wired.shouldMatchPosition()) {
|
||||||
boolean slideAnimation = !wired.shouldMatchRotation() || matchItem.getRotation() == setting.getRotation();
|
boolean slideAnimation = !wired.shouldMatchRotation() || matchItem.getRotation() == setting.getRotation();
|
||||||
@ -85,7 +85,7 @@ public class ApplySnapshotEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (newLocation != null && newLocation.getState() != RoomTileState.INVALID && (newLocation != oldLocation || newRotation != matchItem.getRotation()) && room.getRoomItemManager().furnitureFitsAt(newLocation, matchItem, newRotation, true) == FurnitureMovementError.NONE) {
|
if (newLocation != null && newLocation.getState() != RoomTileState.INVALID && (newLocation != oldLocation || newRotation != matchItem.getRotation()) && room.getRoomItemManager().furnitureFitsAt(newLocation, matchItem, newRotation, true) == FurnitureMovementError.NONE) {
|
||||||
boolean sendUpdates = !slideAnimation;
|
boolean sendUpdates = !slideAnimation;
|
||||||
if (room.getRoomItemManager().moveFurniTo(matchItem, newLocation, newRotation, null, sendUpdates, true) == FurnitureMovementError.NONE && slideAnimation) {
|
if (room.getRoomItemManager().moveItemTo(matchItem, newLocation, newRotation, null, sendUpdates, true) == FurnitureMovementError.NONE && slideAnimation) {
|
||||||
room.sendComposer(new FloorItemOnRollerComposer(matchItem, null, oldLocation, oldZ, newLocation, matchItem.getZ(), 0, room).compose());
|
room.sendComposer(new FloorItemOnRollerComposer(matchItem, null, oldLocation, oldZ, newLocation, matchItem.getZ(), 0, room).compose());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,19 +4,19 @@ import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
|||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.outgoing.MessageComposer;
|
import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.Outgoing;
|
import com.eu.habbo.messages.outgoing.Outgoing;
|
||||||
import gnu.trove.set.hash.THashSet;
|
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class UnseenItemsComposer extends MessageComposer {
|
public class UnseenItemsComposer extends MessageComposer {
|
||||||
private THashSet<RoomItem> itemsList;
|
private HashSet<RoomItem> itemsList;
|
||||||
private RoomItem item;
|
private RoomItem item;
|
||||||
private int[] ids;
|
private int[] ids;
|
||||||
private AddHabboItemCategory category;
|
private AddHabboItemCategory category;
|
||||||
private Map<AddHabboItemCategory, List<Integer>> entries;
|
private Map<AddHabboItemCategory, List<Integer>> entries;
|
||||||
|
|
||||||
public UnseenItemsComposer(THashSet<RoomItem> itemsList) {
|
public UnseenItemsComposer(HashSet<RoomItem> itemsList) {
|
||||||
this.itemsList = itemsList;
|
this.itemsList = itemsList;
|
||||||
this.category = AddHabboItemCategory.OWNED_FURNI;
|
this.category = AddHabboItemCategory.OWNED_FURNI;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import gnu.trove.map.TIntObjectMap;
|
|||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
@ -18,7 +18,6 @@ import java.util.NoSuchElementException;
|
|||||||
public class ItemsComposer extends MessageComposer {
|
public class ItemsComposer extends MessageComposer {
|
||||||
private final Room room;
|
private final Room room;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ServerMessage composeInternal() {
|
protected ServerMessage composeInternal() {
|
||||||
this.response.init(Outgoing.itemsComposer);
|
this.response.init(Outgoing.itemsComposer);
|
||||||
@ -42,7 +41,7 @@ public class ItemsComposer extends MessageComposer {
|
|||||||
this.response.appendString(set.getValue());
|
this.response.appendString(set.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<RoomItem> items = this.room.getWallItems();
|
Collection<RoomItem> items = this.room.getRoomItemManager().getWallItems().values();
|
||||||
|
|
||||||
this.response.appendInt(items.size());
|
this.response.appendInt(items.size());
|
||||||
for (RoomItem item : items) {
|
for (RoomItem item : items) {
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
package com.eu.habbo.plugin.events.inventory;
|
package com.eu.habbo.plugin.events.inventory;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.users.HabboInventory;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||||
import gnu.trove.set.hash.THashSet;
|
import com.eu.habbo.habbohotel.users.HabboInventory;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class InventoryItemsAddedEvent extends InventoryEvent {
|
public class InventoryItemsAddedEvent extends InventoryEvent {
|
||||||
public final THashSet<RoomItem> items;
|
public final HashSet<RoomItem> items;
|
||||||
|
|
||||||
public InventoryItemsAddedEvent(HabboInventory inventory, THashSet<RoomItem> items) {
|
public InventoryItemsAddedEvent(HabboInventory inventory, HashSet<RoomItem> items) {
|
||||||
super(inventory);
|
super(inventory);
|
||||||
this.items = items;
|
this.items = items;
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
package com.eu.habbo.plugin.events.users.catalog;
|
package com.eu.habbo.plugin.events.users.catalog;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.catalog.CatalogItem;
|
import com.eu.habbo.habbohotel.catalog.CatalogItem;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||||
import gnu.trove.set.hash.THashSet;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class UserCatalogFurnitureBoughtEvent extends UserCatalogEvent {
|
public class UserCatalogFurnitureBoughtEvent extends UserCatalogEvent {
|
||||||
|
|
||||||
public final THashSet<RoomItem> furniture;
|
public final HashSet<RoomItem> furniture;
|
||||||
|
|
||||||
|
|
||||||
public UserCatalogFurnitureBoughtEvent(Habbo habbo, CatalogItem catalogItem, THashSet<RoomItem> furniture) {
|
public UserCatalogFurnitureBoughtEvent(Habbo habbo, CatalogItem catalogItem, HashSet<RoomItem> furniture) {
|
||||||
super(habbo, catalogItem);
|
super(habbo, catalogItem);
|
||||||
|
|
||||||
this.furniture = furniture;
|
this.furniture = furniture;
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
package com.eu.habbo.plugin.events.users.catalog;
|
package com.eu.habbo.plugin.events.users.catalog;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.catalog.CatalogItem;
|
import com.eu.habbo.habbohotel.catalog.CatalogItem;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||||
import gnu.trove.set.hash.THashSet;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class UserCatalogItemPurchasedEvent extends UserCatalogEvent {
|
public class UserCatalogItemPurchasedEvent extends UserCatalogEvent {
|
||||||
|
|
||||||
public final THashSet<RoomItem> itemsList;
|
public final HashSet<RoomItem> itemsList;
|
||||||
private final int totalCredits;
|
private final int totalCredits;
|
||||||
private final int totalPoints;
|
private final int totalPoints;
|
||||||
private final List<String> badges;
|
private final List<String> badges;
|
||||||
|
|
||||||
|
|
||||||
public UserCatalogItemPurchasedEvent(Habbo habbo, CatalogItem catalogItem, THashSet<RoomItem> itemsList, int totalCredits, int totalPoints, List<String> badges) {
|
public UserCatalogItemPurchasedEvent(Habbo habbo, CatalogItem catalogItem, HashSet<RoomItem> itemsList, int totalCredits, int totalPoints, List<String> badges) {
|
||||||
super(habbo, catalogItem);
|
super(habbo, catalogItem);
|
||||||
|
|
||||||
this.itemsList = itemsList;
|
this.itemsList = itemsList;
|
||||||
|
@ -7,9 +7,10 @@ import com.eu.habbo.habbohotel.rooms.RoomTile;
|
|||||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
|
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
|
||||||
import gnu.trove.set.hash.THashSet;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ClearRentedSpace implements Runnable {
|
public class ClearRentedSpace implements Runnable {
|
||||||
private final InteractionRentableSpace item;
|
private final InteractionRentableSpace item;
|
||||||
@ -17,7 +18,7 @@ public class ClearRentedSpace implements Runnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
THashSet<RoomItem> items = new THashSet<>();
|
HashSet<RoomItem> items = new HashSet<>();
|
||||||
|
|
||||||
for (RoomTile t : 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())) {
|
for (RoomTile t : 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())) {
|
||||||
for (RoomItem i : this.room.getItemsAt(t)) {
|
for (RoomItem i : this.room.getItemsAt(t)) {
|
||||||
|
@ -29,7 +29,7 @@ public class CrackableExplode implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.habboItem.resetable()) {
|
if (!this.habboItem.resetable()) {
|
||||||
this.room.removeHabboItem(this.habboItem);
|
this.room.getRoomItemManager().removeRoomItem(this.habboItem);
|
||||||
this.room.sendComposer(new RemoveFloorItemComposer(this.habboItem, true).compose());
|
this.room.sendComposer(new RemoveFloorItemComposer(this.habboItem, true).compose());
|
||||||
this.habboItem.setRoomId(0);
|
this.habboItem.setRoomId(0);
|
||||||
Emulator.getGameEnvironment().getItemManager().deleteItem(this.habboItem);
|
Emulator.getGameEnvironment().getItemManager().deleteItem(this.habboItem);
|
||||||
@ -54,7 +54,7 @@ public class CrackableExplode implements Runnable {
|
|||||||
newItem.setZ(this.room.getStackHeight(this.x, this.y, false));
|
newItem.setZ(this.room.getStackHeight(this.x, this.y, false));
|
||||||
newItem.setRoomId(this.room.getRoomInfo().getId());
|
newItem.setRoomId(this.room.getRoomInfo().getId());
|
||||||
newItem.needsUpdate(true);
|
newItem.needsUpdate(true);
|
||||||
this.room.addHabboItem(newItem);
|
this.room.getRoomItemManager().addRoomItem(newItem);
|
||||||
this.room.updateItem(newItem);
|
this.room.updateItem(newItem);
|
||||||
this.room.sendComposer(new ObjectAddMessageComposer(newItem, this.room.getFurniOwnerNames().get(newItem.getOwnerId())).compose());
|
this.room.sendComposer(new ObjectAddMessageComposer(newItem, this.room.getFurniOwnerNames().get(newItem.getOwnerId())).compose());
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,10 @@ import com.eu.habbo.messages.outgoing.inventory.FurniListAddOrUpdateComposer;
|
|||||||
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
|
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.items.PresentOpenedMessageComposer;
|
import com.eu.habbo.messages.outgoing.rooms.items.PresentOpenedMessageComposer;
|
||||||
import gnu.trove.set.hash.THashSet;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@ -32,7 +28,7 @@ public class OpenGift implements Runnable {
|
|||||||
try {
|
try {
|
||||||
RoomItem inside = null;
|
RoomItem inside = null;
|
||||||
|
|
||||||
THashSet<RoomItem> items = ((InteractionGift) this.item).loadItems();
|
HashSet<RoomItem> items = ((InteractionGift) this.item).loadItems();
|
||||||
for (RoomItem i : items) {
|
for (RoomItem i : items) {
|
||||||
if (inside == null)
|
if (inside == null)
|
||||||
inside = i;
|
inside = i;
|
||||||
|
@ -43,7 +43,7 @@ public class PetEatAction implements Runnable {
|
|||||||
if (this.food != null && Integer.parseInt(this.food.getExtradata()) == this.food.getBaseItem().getStateCount()) {
|
if (this.food != null && Integer.parseInt(this.food.getExtradata()) == this.food.getBaseItem().getStateCount()) {
|
||||||
Emulator.getThreading().run(new QueryDeleteHabboItem(this.food.getId()), 500);
|
Emulator.getThreading().run(new QueryDeleteHabboItem(this.food.getId()), 500);
|
||||||
if (this.pet.getRoom() != null) {
|
if (this.pet.getRoom() != null) {
|
||||||
this.pet.getRoom().removeHabboItem(this.food);
|
this.pet.getRoom().getRoomItemManager().removeRoomItem(this.food);
|
||||||
this.pet.getRoom().sendComposer(new RemoveFloorItemComposer(this.food, true).compose());
|
this.pet.getRoom().sendComposer(new RemoveFloorItemComposer(this.food, true).compose());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ class RemoveFloorItemTask implements Runnable {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
RoomTile tile = this.room.getLayout().getTile(this.item.getX(), this.item.getY());
|
RoomTile tile = this.room.getLayout().getTile(this.item.getX(), this.item.getY());
|
||||||
this.room.removeHabboItem(this.item);
|
this.room.getRoomItemManager().removeRoomItem(this.item);
|
||||||
this.room.updateTile(tile);
|
this.room.updateTile(tile);
|
||||||
this.room.sendComposer(new RemoveFloorItemComposer(this.item, true).compose());
|
this.room.sendComposer(new RemoveFloorItemComposer(this.item, true).compose());
|
||||||
this.room.sendComposer(new HeightMapUpdateMessageComposer(this.item.getX(), this.item.getY(), tile.getZ(), tile.relativeHeight()).compose());
|
this.room.sendComposer(new HeightMapUpdateMessageComposer(this.item.getX(), this.item.getY(), tile.getZ(), tile.relativeHeight()).compose());
|
||||||
|
@ -51,14 +51,14 @@ class TeleportInteraction extends Thread {
|
|||||||
if (data.length == 2 && data[0] != 0) {
|
if (data.length == 2 && data[0] != 0) {
|
||||||
if (this.room.getRoomInfo().getId() == data[0]) {
|
if (this.room.getRoomInfo().getId() == data[0]) {
|
||||||
this.targetRoom = this.room;
|
this.targetRoom = this.room;
|
||||||
this.teleportTwo = this.room.getHabboItem(data[1]);
|
this.teleportTwo = this.room.getRoomItemManager().getRoomItemById(data[1]);
|
||||||
|
|
||||||
if (this.teleportTwo == null) {
|
if (this.teleportTwo == null) {
|
||||||
this.teleportTwo = this.teleportOne;
|
this.teleportTwo = this.teleportOne;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.targetRoom = Emulator.getGameEnvironment().getRoomManager().getRoom(data[0]);
|
this.targetRoom = Emulator.getGameEnvironment().getRoomManager().getRoom(data[0]);
|
||||||
this.teleportTwo = this.targetRoom.getHabboItem(data[1]);
|
this.teleportTwo = this.targetRoom.getRoomItemManager().getRoomItemById(data[1]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.targetRoom = this.room;
|
this.targetRoom = this.room;
|
||||||
|
@ -32,7 +32,7 @@ class HopperActionThree implements Runnable {
|
|||||||
Emulator.getGameEnvironment().getRoomManager().enterRoom(this.client.getHabbo(), targetRoom.getRoomInfo().getId(), "", false);
|
Emulator.getGameEnvironment().getRoomManager().enterRoom(this.client.getHabbo(), targetRoom.getRoomInfo().getId(), "", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
targetTeleport = targetRoom.getHabboItem(this.targetItemId);
|
targetTeleport = targetRoom.getRoomItemManager().getRoomItemById(this.targetItemId);
|
||||||
|
|
||||||
if (targetTeleport == null) {
|
if (targetTeleport == null) {
|
||||||
this.client.getHabbo().getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
|
this.client.getHabbo().getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
|
||||||
|
@ -38,7 +38,8 @@ class TeleportActionThree implements Runnable {
|
|||||||
targetRoom.loadData();
|
targetRoom.loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
targetTeleport = targetRoom.getHabboItem(((InteractionTeleport) this.currentTeleport).getTargetId());
|
int id = ((InteractionTeleport) this.currentTeleport).getTargetId();
|
||||||
|
targetTeleport = targetRoom.getRoomItemManager().getRoomItemById(id);
|
||||||
|
|
||||||
if (targetTeleport == null) {
|
if (targetTeleport == null) {
|
||||||
Emulator.getThreading().run(new TeleportActionFive(this.currentTeleport, this.room, this.client), 0);
|
Emulator.getThreading().run(new TeleportActionFive(this.currentTeleport, this.room, this.client), 0);
|
||||||
|
@ -41,7 +41,8 @@ class TeleportActionTwo implements Runnable {
|
|||||||
this.room.sendComposer(new UserUpdateComposer(this.client.getHabbo().getRoomUnit()).compose());
|
this.room.sendComposer(new UserUpdateComposer(this.client.getHabbo().getRoomUnit()).compose());
|
||||||
|
|
||||||
if (((InteractionTeleport) this.currentTeleport).getTargetRoomId() > 0 && ((InteractionTeleport) this.currentTeleport).getTargetId() > 0) {
|
if (((InteractionTeleport) this.currentTeleport).getTargetRoomId() > 0 && ((InteractionTeleport) this.currentTeleport).getTargetId() > 0) {
|
||||||
RoomItem item = this.room.getHabboItem(((InteractionTeleport) this.currentTeleport).getTargetId());
|
int id = ((InteractionTeleport) this.currentTeleport).getTargetId();
|
||||||
|
RoomItem item = this.room.getRoomItemManager().getRoomItemById(id);
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
((InteractionTeleport) this.currentTeleport).setTargetRoomId(0);
|
((InteractionTeleport) this.currentTeleport).setTargetRoomId(0);
|
||||||
((InteractionTeleport) this.currentTeleport).setTargetId(0);
|
((InteractionTeleport) this.currentTeleport).setTargetId(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user