mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 07:20:50 +01:00
Fixed Picked Up floor items
This commit is contained in:
parent
15061113f4
commit
59290bae8d
@ -137,83 +137,89 @@ public class RoomItemManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeRoomItem(RoomItem item) {
|
public void removeRoomItem(RoomItem roomItem) {
|
||||||
if (item != null) {
|
if (roomItem != null) {
|
||||||
|
|
||||||
RoomItem i;
|
RoomItem removedItem;
|
||||||
synchronized (this.currentItems) {
|
synchronized (this.currentItems) {
|
||||||
i = this.currentItems.remove(item.getId());
|
removedItem = this.currentItems.remove(roomItem.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i != null) {
|
if(removedItem.getBaseItem().getType().equals(FurnitureType.FLOOR)) {
|
||||||
if (item instanceof ICycleable) {
|
this.floorItems.remove(removedItem.getId());
|
||||||
this.removeCycleTask((ICycleable) item);
|
} else if (removedItem.getBaseItem().getType().equals(FurnitureType.WALL)) {
|
||||||
|
this.wallItems.remove(removedItem.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item instanceof InteractionWired wired) {
|
if (removedItem != null) {
|
||||||
|
if (roomItem instanceof ICycleable) {
|
||||||
|
this.removeCycleTask((ICycleable) roomItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (roomItem instanceof InteractionWired wired) {
|
||||||
this.wiredManager.removeWired(wired);
|
this.wiredManager.removeWired(wired);
|
||||||
} else if (item instanceof InteractionBattleBanzaiTeleporter) {
|
} else if (roomItem instanceof InteractionBattleBanzaiTeleporter) {
|
||||||
this.removeBanzaiTeleporter((InteractionBattleBanzaiTeleporter) item);
|
this.removeBanzaiTeleporter((InteractionBattleBanzaiTeleporter) roomItem);
|
||||||
} else if (item instanceof InteractionRoller) {
|
} else if (roomItem instanceof InteractionRoller) {
|
||||||
this.removeRoller((InteractionRoller) item);
|
this.removeRoller((InteractionRoller) roomItem);
|
||||||
} else if (item instanceof InteractionGameScoreboard) {
|
} else if (roomItem instanceof InteractionGameScoreboard) {
|
||||||
this.removeScoreboard((InteractionGameScoreboard) item);
|
this.removeScoreboard((InteractionGameScoreboard) roomItem);
|
||||||
} else if (item instanceof InteractionGameGate) {
|
} else if (roomItem instanceof InteractionGameGate) {
|
||||||
this.removeGameGate((InteractionGameGate) item);
|
this.removeGameGate((InteractionGameGate) roomItem);
|
||||||
} else if (item instanceof InteractionGameTimer) {
|
} else if (roomItem instanceof InteractionGameTimer) {
|
||||||
this.removeGameTimer((InteractionGameTimer) item);
|
this.removeGameTimer((InteractionGameTimer) roomItem);
|
||||||
} else if (item instanceof InteractionFreezeExitTile) {
|
} else if (roomItem instanceof InteractionFreezeExitTile) {
|
||||||
this.removeFreezeExitTile((InteractionFreezeExitTile) item);
|
this.removeFreezeExitTile((InteractionFreezeExitTile) roomItem);
|
||||||
} else if (item instanceof InteractionNest) {
|
} else if (roomItem instanceof InteractionNest) {
|
||||||
this.removeNest((InteractionNest) item);
|
this.removeNest((InteractionNest) roomItem);
|
||||||
} else if (item instanceof InteractionPetDrink) {
|
} else if (roomItem instanceof InteractionPetDrink) {
|
||||||
this.removePetDrink((InteractionPetDrink) item);
|
this.removePetDrink((InteractionPetDrink) roomItem);
|
||||||
} else if (item instanceof InteractionPetFood) {
|
} else if (roomItem instanceof InteractionPetFood) {
|
||||||
this.removePetFood((InteractionPetFood) item);
|
this.removePetFood((InteractionPetFood) roomItem);
|
||||||
} else if (item instanceof InteractionPetToy) {
|
} else if (roomItem instanceof InteractionPetToy) {
|
||||||
this.removePetToy((InteractionPetToy) item);
|
this.removePetToy((InteractionPetToy) roomItem);
|
||||||
} else if (item instanceof InteractionPetTree) {
|
} else if (roomItem instanceof InteractionPetTree) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionPetTrampoline) {
|
} else if (roomItem instanceof InteractionPetTrampoline) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionMoodLight) {
|
} else if (roomItem instanceof InteractionMoodLight) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionPyramid) {
|
} else if (roomItem instanceof InteractionPyramid) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionMusicDisc) {
|
} else if (roomItem instanceof InteractionMusicDisc) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionBattleBanzaiSphere) {
|
} else if (roomItem instanceof InteractionBattleBanzaiSphere) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionTalkingFurniture) {
|
} else if (roomItem instanceof InteractionTalkingFurniture) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionWaterItem) {
|
} else if (roomItem instanceof InteractionWaterItem) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionWater) {
|
} else if (roomItem instanceof InteractionWater) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionMuteArea) {
|
} else if (roomItem instanceof InteractionMuteArea) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionTagPole) {
|
} else if (roomItem instanceof InteractionTagPole) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionTagField) {
|
} else if (roomItem instanceof InteractionTagField) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionJukeBox) {
|
} else if (roomItem instanceof InteractionJukeBox) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionPetBreedingNest) {
|
} else if (roomItem instanceof InteractionPetBreedingNest) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionBlackHole) {
|
} else if (roomItem instanceof InteractionBlackHole) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionWiredHighscore) {
|
} else if (roomItem instanceof InteractionWiredHighscore) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionStickyPole) {
|
} else if (roomItem instanceof InteractionStickyPole) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof WiredBlob) {
|
} else if (roomItem instanceof WiredBlob) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionTent) {
|
} else if (roomItem instanceof InteractionTent) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionSnowboardSlope) {
|
} else if (roomItem instanceof InteractionSnowboardSlope) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
} else if (item instanceof InteractionBuildArea) {
|
} else if (roomItem instanceof InteractionBuildArea) {
|
||||||
this.removeUndefined(item);
|
this.removeUndefined(roomItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -533,30 +539,31 @@ public class RoomItemManager {
|
|||||||
return FurnitureMovementError.NONE;
|
return FurnitureMovementError.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pickUpItem(RoomItem item, Habbo picker) {
|
public void pickUpItem(RoomItem roomItem, Habbo picker) {
|
||||||
if (item == null)
|
if (roomItem == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Emulator.getPluginManager().isRegistered(FurniturePickedUpEvent.class, true)) {
|
if (Emulator.getPluginManager().isRegistered(FurniturePickedUpEvent.class, true)) {
|
||||||
Event furniturePickedUpEvent = new FurniturePickedUpEvent(item, picker);
|
Event furniturePickedUpEvent = new FurniturePickedUpEvent(roomItem, picker);
|
||||||
Emulator.getPluginManager().fireEvent(furniturePickedUpEvent);
|
Emulator.getPluginManager().fireEvent(furniturePickedUpEvent);
|
||||||
|
|
||||||
if (furniturePickedUpEvent.isCancelled())
|
if (furniturePickedUpEvent.isCancelled())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.removeRoomItem(item);
|
this.removeRoomItem(roomItem);
|
||||||
item.onPickUp(this.room);
|
roomItem.onPickUp(this.room);
|
||||||
//Deprecated
|
//Deprecated
|
||||||
item.setRoomId(0);
|
roomItem.setRoomId(0);
|
||||||
item.setRoom(null);
|
roomItem.setRoom(null);
|
||||||
item.needsUpdate(true);
|
roomItem.needsUpdate(true);
|
||||||
|
|
||||||
if (item.getBaseItem().getType() == FurnitureType.FLOOR) {
|
if (roomItem.getBaseItem().getType() == FurnitureType.FLOOR) {
|
||||||
this.room.sendComposer(new RemoveFloorItemComposer(item).compose());
|
this.room.sendComposer(new RemoveFloorItemComposer(roomItem).compose());
|
||||||
|
|
||||||
THashSet<RoomTile> updatedTiles = new THashSet<>();
|
THashSet<RoomTile> updatedTiles = new THashSet<>();
|
||||||
Rectangle rectangle = RoomLayout.getRectangle(item.getCurrentPosition().getX(), item.getCurrentPosition().getY(), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation());
|
Rectangle rectangle = RoomLayout.getRectangle(roomItem.getCurrentPosition().getX(), roomItem.getCurrentPosition().getY(), roomItem.getBaseItem().getWidth(), roomItem.getBaseItem().getLength(), roomItem.getRotation());
|
||||||
|
|
||||||
for (short x = (short) rectangle.x; x < rectangle.x + rectangle.getWidth(); x++) {
|
for (short x = (short) rectangle.x; x < rectangle.x + rectangle.getWidth(); x++) {
|
||||||
for (short y = (short) rectangle.y; y < rectangle.y + rectangle.getHeight(); y++) {
|
for (short y = (short) rectangle.y; y < rectangle.y + rectangle.getHeight(); y++) {
|
||||||
@ -569,24 +576,26 @@ public class RoomItemManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.room.sendComposer(new HeightMapUpdateMessageComposer(this.room, updatedTiles).compose());
|
this.room.sendComposer(new HeightMapUpdateMessageComposer(this.room, updatedTiles).compose());
|
||||||
this.room.updateTiles(updatedTiles);
|
this.room.updateTiles(updatedTiles);
|
||||||
|
|
||||||
updatedTiles.forEach(tile -> {
|
updatedTiles.forEach(tile -> {
|
||||||
this.room.getRoomUnitManager().updateHabbosAt(tile);
|
this.room.getRoomUnitManager().updateHabbosAt(tile);
|
||||||
this.room.getRoomUnitManager().updateBotsAt(tile);
|
this.room.getRoomUnitManager().updateBotsAt(tile);
|
||||||
});
|
});
|
||||||
} else if (item.getBaseItem().getType() == FurnitureType.WALL) {
|
} else if (roomItem.getBaseItem().getType() == FurnitureType.WALL) {
|
||||||
this.room.sendComposer(new ItemRemoveMessageComposer(item).compose());
|
this.room.sendComposer(new ItemRemoveMessageComposer(roomItem).compose());
|
||||||
}
|
}
|
||||||
|
|
||||||
Habbo habbo;
|
Habbo habbo;
|
||||||
habbo = picker != null && picker.getHabboInfo().getId() == item.getId() ? (picker) : (Emulator.getGameServer().getGameClientManager().getHabbo(item.getOwnerInfo().getId()));
|
habbo = picker != null && picker.getHabboInfo().getId() == roomItem.getId() ? (picker) : (Emulator.getGameServer().getGameClientManager().getHabbo(roomItem.getOwnerInfo().getId()));
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
habbo.getInventory().getItemsComponent().addItem(item);
|
habbo.getInventory().getItemsComponent().addItem(roomItem);
|
||||||
habbo.getClient().sendResponse(new UnseenItemsComposer(item));
|
habbo.getClient().sendResponse(new UnseenItemsComposer(roomItem));
|
||||||
habbo.getClient().sendResponse(new FurniListInvalidateComposer());
|
habbo.getClient().sendResponse(new FurniListInvalidateComposer());
|
||||||
}
|
}
|
||||||
Emulator.getThreading().run(item);
|
Emulator.getThreading().run(roomItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ejectUserItem(RoomItem item) {
|
public void ejectUserItem(RoomItem item) {
|
||||||
@ -1098,6 +1107,9 @@ public class RoomItemManager {
|
|||||||
this.currentItems.remove(roomItem.getId());
|
this.currentItems.remove(roomItem.getId());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.floorItems.clear();
|
||||||
|
this.wallItems.clear();
|
||||||
|
|
||||||
this.currentItems.clear();
|
this.currentItems.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -594,6 +594,7 @@ public class RoomManager {
|
|||||||
|
|
||||||
habbo.getClient().sendResponse(new OpenConnectionMessageComposer());
|
habbo.getClient().sendResponse(new OpenConnectionMessageComposer());
|
||||||
|
|
||||||
|
//@Deprecated
|
||||||
roomHabbo.setInRoom(true);
|
roomHabbo.setInRoom(true);
|
||||||
|
|
||||||
if (!habbo.getHabboStats().isBlockFollowing() && roomHabbo.getRoom() == null) {
|
if (!habbo.getHabboStats().isBlockFollowing() && roomHabbo.getRoom() == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user