mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 10:36:09 +01:00
Check if player is too early for quest asynchronously, fixes #1290
This commit is contained in:
parent
0265e09303
commit
3aae3bfcf3
@ -480,9 +480,12 @@ public class Quester {
|
|||||||
if (repeat != -1 && start != -1 && end != -1) {
|
if (repeat != -1 && start != -1 && end != -1) {
|
||||||
// Ensure that we're past the initial duration
|
// Ensure that we're past the initial duration
|
||||||
if (System.currentTimeMillis() > end) {
|
if (System.currentTimeMillis() > end) {
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
final int maxSize = 2;
|
final int maxSize = 2;
|
||||||
final LinkedHashMap<Long, Long> cache = new LinkedHashMap<Long, Long>() {
|
final LinkedHashMap<Long, Long> cache = new LinkedHashMap<Long, Long>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 3046838061019897713L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean removeEldestEntry(final Map.Entry<Long, Long> eldest) {
|
protected boolean removeEldestEntry(final Map.Entry<Long, Long> eldest) {
|
||||||
@ -510,14 +513,18 @@ public class Quester {
|
|||||||
|
|
||||||
// If quest is not active, inform user of wait time
|
// If quest is not active, inform user of wait time
|
||||||
if (!active) {
|
if (!active) {
|
||||||
String early = Lang.get("plnTooEarly");
|
final String early = Lang.get("plnTooEarly")
|
||||||
early = early.replace("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
|
.replace("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW)
|
||||||
early = early.replace("<time>", ChatColor.DARK_PURPLE
|
.replace("<time>", ChatColor.DARK_PURPLE
|
||||||
+ MiscUtil.getTime(nextStart - System.currentTimeMillis()) + ChatColor.YELLOW);
|
+ MiscUtil.getTime(nextStart - System.currentTimeMillis()) + ChatColor.YELLOW);
|
||||||
|
if (p.isOnline()) {
|
||||||
p.sendMessage(ChatColor.YELLOW + early);
|
p.sendMessage(ChatColor.YELLOW + early);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (q.testRequirements(player) == true || ignoreReqs) {
|
if (q.testRequirements(player) == true || ignoreReqs) {
|
||||||
|
Loading…
Reference in New Issue
Block a user