Addition of MaximumAddedTime configuration.
This commit is contained in:
@@ -6,6 +6,10 @@
|
||||
# Default: 3600000 (1 hour)
|
||||
InitialTime = 3600000
|
||||
|
||||
# Maximum added time.
|
||||
# Default: 18000000 (5 hours)
|
||||
MaximumAddedTime = 18000000
|
||||
|
||||
# Reset delay.
|
||||
# Default: 36000000 (10 hours)
|
||||
ResetDelay = 36000000
|
||||
|
||||
@@ -56,15 +56,22 @@ public class AddHuntingTime extends AbstractEffect
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
long endTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, 0);
|
||||
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_TIME))
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, false);
|
||||
player.sendMessage("You cannot exceed the time zone limit.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isInTimedHuntingZone(_zoneId))
|
||||
{
|
||||
final long increasedTime = _time + player.getTimedHuntingZoneRemainingTime();
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, currentTime + increasedTime);
|
||||
player.startTimedHuntingZone(_zoneId, increasedTime);
|
||||
endTime = _time + player.getTimedHuntingZoneRemainingTime();
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, currentTime + endTime);
|
||||
player.startTimedHuntingZone(_zoneId, endTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
long endTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, 0);
|
||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
||||
{
|
||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
||||
|
||||
Reference in New Issue
Block a user