Fix renting spaces

This commit is contained in:
Alejandro 2019-08-05 20:14:33 +03:00
parent 0ee867a2fa
commit 732910e3fc
2 changed files with 9 additions and 7 deletions

View File

@ -4,10 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.rooms.RoomUnitType;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender; import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
@ -181,7 +178,14 @@ public class InteractionDefault extends HabboItem {
} }
public boolean canToggle(Habbo habbo, Room room) { public boolean canToggle(Habbo habbo, Room room) {
return room.hasRights(habbo); if (room.hasRights(habbo)) return true;
if (!habbo.getHabboStats().isRentingSpace()) return false;
HabboItem rentSpace = room.getHabboItem(habbo.getHabboStats().rentedItemId);
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()));
} }
@Override @Override

View File

@ -75,8 +75,6 @@ public class RoomPlaceItemEvent extends MessageHandler {
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, FurnitureMovementError.NO_RIGHTS.errorCode)); this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, FurnitureMovementError.NO_RIGHTS.errorCode));
return; return;
} }
return;
} }
RoomTile tile = room.getLayout().getTile(x, y); RoomTile tile = room.getLayout().getTile(x, y);