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:
Thijs Wiefferink 2017-06-12 21:58:42 +02:00
parent 4002956aeb
commit 07e6782714

View File

@ -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);
}