mirror of
https://github.com/NLthijs48/AreaShop.git
synced 2024-11-16 07:15:23 +01:00
Fix /as setowner
for regions that are not rented yet
Add a rental period to the time when setting owner of a rental region that is not rented yet, otherwise it would get expired immediately
This commit is contained in:
parent
4002956aeb
commit
07e6782714
@ -89,13 +89,14 @@ public class SetownerCommand extends CommandAreaShop {
|
||||
RentRegion rent = (RentRegion)region;
|
||||
if(rent.isRenter(uuid)) {
|
||||
// extend
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(rent.getRentedUntil() + rent.getDuration());
|
||||
rent.setRentedUntil(calendar.getTimeInMillis());
|
||||
rent.setRentedUntil(rent.getRentedUntil() + rent.getDuration());
|
||||
rent.setRenter(uuid);
|
||||
plugin.message(sender, "setowner-succesRentExtend", region);
|
||||
} else {
|
||||
// change
|
||||
if(!rent.isRented()) {
|
||||
rent.setRentedUntil(Calendar.getInstance().getTimeInMillis() + rent.getDuration());
|
||||
}
|
||||
rent.setRenter(uuid);
|
||||
plugin.message(sender, "setowner-succesRent", region);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user