You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-20 15:36:17 +00:00
fix(items): charge rentable space purchases
Deduct the computed rent cost when a user rents an InteractionRentableSpace. The previous flow only checked that the user had enough credits, then marked the space as rented without charging them, allowing free weekly rentals. Honor ACC_INFINITE_CREDITS for staff accounts and add a contract test that keeps the charge before the rented state is assigned.
This commit is contained in:
+8
-1
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomLayout;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
@@ -133,12 +134,18 @@ public class InteractionRentableSpace extends HabboItem {
|
||||
if (habbo.getHabboStats().isRentingSpace())
|
||||
return;
|
||||
|
||||
if (habbo.getHabboInfo().getCredits() < this.rentCost())
|
||||
int cost = this.rentCost();
|
||||
boolean hasInfiniteCredits = habbo.hasPermission(Permission.ACC_INFINITE_CREDITS);
|
||||
if (!hasInfiniteCredits && habbo.getHabboInfo().getCredits() < cost)
|
||||
return;
|
||||
|
||||
if (habbo.getHabboStats().getClubExpireTimestamp() < Emulator.getIntUnixTimestamp())
|
||||
return;
|
||||
|
||||
if (!hasInfiniteCredits) {
|
||||
habbo.giveCredits(-cost);
|
||||
}
|
||||
|
||||
this.setRenterId(habbo.getHabboInfo().getId());
|
||||
this.setRenterName(habbo.getHabboInfo().getUsername());
|
||||
this.setEndTimestamp(Emulator.getIntUnixTimestamp() + (7 * 86400));
|
||||
|
||||
Reference in New Issue
Block a user