From f5869158e4853288ac0b7235fca190a4a32658af Mon Sep 17 00:00:00 2001 From: Beny Date: Mon, 27 May 2019 01:02:30 +0100 Subject: [PATCH] Pets can swim! --- .../items/interactions/InteractionWater.java | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java index 0c10f69f..a7df3c6d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java @@ -144,14 +144,31 @@ public class InteractionWater extends InteractionDefault { } @Override - public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { + public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { + super.onWalkOn(roomUnit, room, objects); + Pet pet = room.getPet(roomUnit); - if (pet != null) { - pet.getRoomUnit().setStatus(RoomUnitStatus.DIP, "0"); + if(pet == null) + return; + + if (!pet.getRoomUnit().hasStatus(RoomUnitStatus.SWIM)) { + pet.getRoomUnit().setStatus(RoomUnitStatus.SWIM, ""); } } + @Override + public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { + super.onWalkOff(roomUnit, room, objects); + + Pet pet = room.getPet(roomUnit); + + if(pet == null) + return; + + pet.getRoomUnit().removeStatus(RoomUnitStatus.SWIM); + } + private void recalculate(Room room) { THashMap tiles = new THashMap<>();