mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2026-01-04 15:41:35 +00:00
fix async event
This commit is contained in:
@@ -79,7 +79,7 @@ public class CompetitionCommand {
|
||||
} else {
|
||||
FishingCompetition competition = CustomFishingPlugin.get().getCompetitionManager().getOnGoingCompetition();
|
||||
if (competition != null) {
|
||||
competition.end();
|
||||
CustomFishingPlugin.get().getScheduler().runTaskAsync(competition::end);
|
||||
AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_End_Competition);
|
||||
} else {
|
||||
AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_No_Competition_Ongoing);
|
||||
@@ -99,7 +99,7 @@ public class CompetitionCommand {
|
||||
} else {
|
||||
FishingCompetition competition = CustomFishingPlugin.get().getCompetitionManager().getOnGoingCompetition();
|
||||
if (competition != null) {
|
||||
competition.stop();
|
||||
CustomFishingPlugin.get().getScheduler().runTaskAsync(competition::stop);
|
||||
AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Stop_Competition);
|
||||
} else {
|
||||
AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_No_Competition_Ongoing);
|
||||
|
||||
@@ -58,7 +58,13 @@ public class CompetitionManagerImpl implements CompetitionManager {
|
||||
public void load() {
|
||||
loadConfig();
|
||||
this.timerCheckTask = plugin.getScheduler().runTaskAsyncTimer(
|
||||
this::timerCheck,
|
||||
() -> {
|
||||
try {
|
||||
timerCheck();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
},
|
||||
1,
|
||||
1,
|
||||
TimeUnit.SECONDS
|
||||
@@ -295,8 +301,10 @@ public class CompetitionManagerImpl implements CompetitionManager {
|
||||
}, 1, TimeUnit.SECONDS);
|
||||
} else {
|
||||
// start instantly
|
||||
this.currentCompetition = new Competition(config);
|
||||
this.currentCompetition.start();
|
||||
plugin.getScheduler().runTaskAsync(() -> {
|
||||
this.currentCompetition = new Competition(config);
|
||||
this.currentCompetition.start();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user