mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-28 21:48:43 +01:00
Fix time requirement check, resolves #386
This commit is contained in:
parent
60f2a497dd
commit
866fa307bf
@ -600,13 +600,17 @@ public class DGamePlayer extends DInstancePlayer {
|
|||||||
|
|
||||||
GameRuleProvider rules = game.getRules();
|
GameRuleProvider rules = game.getRules();
|
||||||
|
|
||||||
if (!checkTimeAfterStart(game)) {
|
if (!checkTimeAfterStart(game) && !checkTimeAfterFinish(game)) {
|
||||||
|
int longestTime = rules.getTimeToNextPlayAfterStart() >= rules.getTimeToNextPlayAfterFinish() ? rules.getTimeToNextPlayAfterStart() : rules.getTimeToNextPlayAfterFinish();
|
||||||
|
MessageUtil.sendMessage(player, DMessage.ERROR_COOLDOWN.getMessage(String.valueOf(longestTime)));
|
||||||
|
return false;
|
||||||
|
|
||||||
|
} else if (!checkTimeAfterStart(game)) {
|
||||||
MessageUtil.sendMessage(player, DMessage.ERROR_COOLDOWN.getMessage(String.valueOf(rules.getTimeToNextPlayAfterStart())));
|
MessageUtil.sendMessage(player, DMessage.ERROR_COOLDOWN.getMessage(String.valueOf(rules.getTimeToNextPlayAfterStart())));
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (!checkTimeAfterFinish(game)) {
|
} else if (!checkTimeAfterFinish(game)) {
|
||||||
MessageUtil.sendMessage(player, DMessage.ERROR_COOLDOWN.getMessage(String.valueOf(rules.getTimeToNextPlayAfterStart())));
|
MessageUtil.sendMessage(player, DMessage.ERROR_COOLDOWN.getMessage(String.valueOf(rules.getTimeToNextPlayAfterFinish())));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -689,12 +693,7 @@ public class DGamePlayer extends DInstancePlayer {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requirement != -1) {
|
return requirement != 0 && dataTime != -1 && dataTime + requirement * 1000 * 60 * 60 <= System.currentTimeMillis();
|
||||||
if (requirement + dataTime * 1000 * 60 * 60 > System.currentTimeMillis()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ready() {
|
public void ready() {
|
||||||
|
Loading…
Reference in New Issue
Block a user