Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- The Scheduler API is now in Universal class with it's own interface…
… handler ( Universal.getScheduler ) - Moved getPlayerNameFromUUID and getPlayerUUIDFromName to MethodInterface - Moved cancelTask to new Scheduler API - UUIDFetchManager has been refactored to use the new Scheduler API, making it redundant to use UUIDSpigot / UUIDSponge / UUIDVelocity / UUIDBungee - Sorter and UUIDFetcher have been moved to util package
- Loading branch information
1 parent
0c1e51b
commit 0f76d29
Showing
33 changed files
with
477 additions
and
300 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nterfaces/BungeeScheduledTaskWrapper.java → ...scheduler/BungeeScheduledTaskWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/main/java/com/github/fernthedev/fernapi/server/bungee/scheduler/BungeeScheduler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.github.fernthedev.fernapi.server.bungee.scheduler; | ||
|
||
import com.github.fernthedev.fernapi.server.bungee.FernBungeeAPI; | ||
import com.github.fernthedev.fernapi.universal.handlers.IScheduler; | ||
import lombok.NonNull; | ||
import lombok.RequiredArgsConstructor; | ||
import net.md_5.bungee.api.ProxyServer; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
@RequiredArgsConstructor | ||
public class BungeeScheduler implements IScheduler<BungeeScheduledTaskWrapper, Integer> { | ||
|
||
@NonNull | ||
private FernBungeeAPI fernBungeeAPI; | ||
|
||
@Override | ||
public void cancelTask(Integer id) { | ||
fernBungeeAPI.getProxy().getScheduler().cancel(id); | ||
} | ||
|
||
@Override | ||
public void cancelAllTasks() { | ||
fernBungeeAPI.getProxy().getScheduler().cancel(fernBungeeAPI); | ||
} | ||
|
||
/** | ||
* Schedules a task to be executed asynchronously after the specified delay | ||
* is up. | ||
* @param task the task to run | ||
* @param delay the delay before this task will be executed | ||
* @param unit the unit in which the delay will be measured | ||
* @return | ||
*/ | ||
@Override | ||
public BungeeScheduledTaskWrapper runSchedule(Runnable task, long delay, TimeUnit unit) { | ||
return new BungeeScheduledTaskWrapper(ProxyServer.getInstance().getScheduler().schedule(fernBungeeAPI, task, delay, unit)); | ||
} | ||
|
||
/** | ||
* Schedules a task to be executed asynchronously after the specified delay | ||
* is up. The scheduled task will continue running at the specified | ||
* interval. The interval will not begin to count down until the last task | ||
* invocation is complete. | ||
* @param task the task to run | ||
* @param delay the delay before this task will be executed | ||
* @param period the interval before subsequent executions of this task | ||
* @param unit the unit in which the delay and period will be measured | ||
* @return | ||
*/ | ||
@Override | ||
public BungeeScheduledTaskWrapper runSchedule(Runnable task, long delay, long period, TimeUnit unit) { | ||
return new BungeeScheduledTaskWrapper(ProxyServer.getInstance().getScheduler().schedule(fernBungeeAPI, task, delay, period, unit)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.