Forego permission check on login, fixes #1908

This commit is contained in:
PikaMug 2022-03-26 00:46:12 -04:00
parent 609eb183bd
commit d1875ae377

View File

@ -856,47 +856,46 @@ public class PlayerListener implements Listener {
@EventHandler
public void onPlayerLogin(final PlayerLoginEvent evt) {
final Player player = evt.getPlayer();
if (plugin.canUseQuests(player.getUniqueId())) {
final IQuester noobCheck = new Quester(plugin, player.getUniqueId());
if (plugin.getSettings().canGenFilesOnJoin() && !noobCheck.hasData()) {
noobCheck.saveData();
}
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
final CompletableFuture<IQuester> cf = plugin.getStorage().loadQuester(player.getUniqueId());
try {
final IQuester quester = cf.get();
if (quester == null) {
return;
}
for (final IQuest q : quester.getCompletedQuestsTemp()) {
if (q != null) {
if (!quester.getCompletedTimes().containsKey(q) && q.getPlanner().getCooldown() > -1) {
quester.getCompletedTimes().put(q, System.currentTimeMillis());
}
}
}
for (final IQuest quest : quester.getCurrentQuestsTemp().keySet()) {
quester.checkQuest(quest);
}
for (final IQuest quest : quester.getCurrentQuestsTemp().keySet()) {
if (quester.getCurrentStage(quest).getDelay() > -1) {
quester.startStageTimer(quest);
}
}
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> {
if (quester.hasJournal()) {
quester.updateJournal();
}
if (quester.canUseCompass()) {
quester.findCompassTarget();
}
}, 40L);
} catch (final Exception e) {
e.printStackTrace();
}
});
// Cannot check Quests#canUseQuests until PlayerJoinEvent
final IQuester noobCheck = new Quester(plugin, player.getUniqueId());
if (plugin.getSettings().canGenFilesOnJoin() && !noobCheck.hasData()) {
noobCheck.saveData();
}
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
final CompletableFuture<IQuester> cf = plugin.getStorage().loadQuester(player.getUniqueId());
try {
final IQuester quester = cf.get();
if (quester == null) {
return;
}
for (final IQuest q : quester.getCompletedQuestsTemp()) {
if (q != null) {
if (!quester.getCompletedTimes().containsKey(q) && q.getPlanner().getCooldown() > -1) {
quester.getCompletedTimes().put(q, System.currentTimeMillis());
}
}
}
for (final IQuest quest : quester.getCurrentQuestsTemp().keySet()) {
quester.checkQuest(quest);
}
for (final IQuest quest : quester.getCurrentQuestsTemp().keySet()) {
if (quester.getCurrentStage(quest).getDelay() > -1) {
quester.startStageTimer(quest);
}
}
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> {
if (quester.hasJournal()) {
quester.updateJournal();
}
if (quester.canUseCompass()) {
quester.findCompassTarget();
}
}, 40L);
} catch (final Exception e) {
e.printStackTrace();
}
});
}
@EventHandler