Fix moveItem

This commit is contained in:
brenoepic 2022-04-28 20:19:03 -03:00
parent 1c39e29c8e
commit 1a932f6955
2 changed files with 17 additions and 12 deletions

View File

@ -75,6 +75,7 @@ public class InteractionWater extends InteractionDefault {
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
super.onWalkOn(roomUnit, room, objects);
if(roomUnit == null) return;
roomUnit.isSwimming = true;
Pet pet = room.getPet(roomUnit);

View File

@ -33,13 +33,13 @@ import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.MessageComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.HabboBroadcastMessageComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.GenericErrorComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.HabboBroadcastMessageComposer;
import com.eu.habbo.messages.outgoing.guilds.HabboGroupDetailsMessageComposer;
import com.eu.habbo.messages.outgoing.hotelview.CloseConnectionMessageComposer;
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
import com.eu.habbo.messages.outgoing.inventory.PetAddedToInventoryComposer;
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
import com.eu.habbo.messages.outgoing.inventory.PetAddedToInventoryComposer;
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.QuestionComposer;
import com.eu.habbo.messages.outgoing.rooms.*;
@ -4718,8 +4718,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
if (oldLocation != tile) {
for (RoomTile t : occupiedTiles) {
HabboItem tileTopItem = this.getTopItemAt(t.x, t.y);
if ((!magicTile && ((tileTopItem != null && tileTopItem != item ? (t.state.equals(RoomTileState.INVALID) || !t.getAllowStack() || !tileTopItem.getBaseItem().allowStack() || (tileTopItem.getBaseItem().getInteractionType().getType() == InteractionWater.class && item.getBaseItem().getInteractionType().getType() == InteractionWater.class || item.getBaseItem().getInteractionType().getType() != InteractionWaterItem.class)) : this.calculateTileState(t, item).equals(RoomTileState.INVALID))) || stackHelper.isPresent() && item.getBaseItem().getInteractionType().getType() == InteractionWater.class))
if (!magicTile && (tileTopItem != null && tileTopItem != item ? (t.state.equals(RoomTileState.INVALID) || !t.getAllowStack() || !tileTopItem.getBaseItem().allowStack() ||
(tileTopItem.getBaseItem().getInteractionType().getType() == InteractionWater.class && (item.getBaseItem().getInteractionType().getType() != InteractionWaterItem.class || item.getBaseItem().getInteractionType().getType() == InteractionWater.class))) : this.calculateTileState(t, item).equals(RoomTileState.INVALID)) || stackHelper.isPresent() && item.getBaseItem().getInteractionType().getType() == InteractionWater.class) {
return FurnitureMovementError.CANT_STACK;
}
if (!Emulator.getConfig().getBoolean("wired.place.under", false) || (Emulator.getConfig().getBoolean("wired.place.under", false) && !item.isWalkable() && !item.getBaseItem().allowSit())) {
if (checkForUnits) {
@ -4783,7 +4785,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
}
if (height > MAXIMUM_FURNI_HEIGHT) return FurnitureMovementError.CANT_STACK;
if(height < this.getLayout().getHeightAtSquare(tile.x, tile.y)) return FurnitureMovementError.CANT_STACK; //prevent furni going under the floor
if (height < this.getLayout().getHeightAtSquare(tile.x, tile.y))
return FurnitureMovementError.CANT_STACK; //prevent furni going under the floor
if (Emulator.getPluginManager().isRegistered(FurnitureBuildheightEvent.class, true)) {
FurnitureBuildheightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureBuildheightEvent(item, actor, 0.00, height));
@ -4793,7 +4796,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
}
if (height > MAXIMUM_FURNI_HEIGHT) return FurnitureMovementError.CANT_STACK;
if(height < this.getLayout().getHeightAtSquare(tile.x, tile.y)) return FurnitureMovementError.CANT_STACK; //prevent furni going under the floor
if (height < this.getLayout().getHeightAtSquare(tile.x, tile.y))
return FurnitureMovementError.CANT_STACK; //prevent furni going under the floor
item.setX(tile.x);
item.setY(tile.y);