-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
premature optimization is bad
- Loading branch information
Showing
11 changed files
with
83 additions
and
188 deletions.
There are no files selected for viewing
12 changes: 1 addition & 11 deletions
12
...-async/src/main/java/io/github/projectunified/minelib/scheduler/async/AsyncScheduler.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
14 changes: 1 addition & 13 deletions
14
...ler/src/main/java/io/github/projectunified/minelib/scheduler/canceller/TaskCanceller.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
16 changes: 0 additions & 16 deletions
16
.../src/main/java/io/github/projectunified/minelib/scheduler/common/scheduler/Scheduler.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
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
13 changes: 1 addition & 12 deletions
13
...obal/src/main/java/io/github/projectunified/minelib/scheduler/global/GlobalScheduler.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 |
---|---|---|
@@ -1,31 +1,20 @@ | ||
package io.github.projectunified.minelib.scheduler.global; | ||
|
||
import com.google.common.cache.LoadingCache; | ||
import io.github.projectunified.minelib.scheduler.common.scheduler.Scheduler; | ||
import io.github.projectunified.minelib.scheduler.common.util.Platform; | ||
import org.bukkit.plugin.Plugin; | ||
|
||
import java.util.concurrent.ExecutionException; | ||
|
||
/** | ||
* A {@link Scheduler} that can run tasks globally | ||
*/ | ||
public interface GlobalScheduler extends Scheduler { | ||
LoadingCache<Plugin, GlobalScheduler> PROVIDER = Scheduler.createProvider( | ||
Platform.FOLIA.isPlatform() ? FoliaGlobalScheduler::new : BukkitGlobalScheduler::new | ||
); | ||
|
||
/** | ||
* Get the {@link GlobalScheduler} for the given plugin | ||
* | ||
* @param plugin the plugin | ||
* @return the scheduler | ||
*/ | ||
static GlobalScheduler get(Plugin plugin) { | ||
try { | ||
return PROVIDER.get(plugin); | ||
} catch (ExecutionException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return Platform.FOLIA.isPlatform() ? new FoliaGlobalScheduler(plugin) : new BukkitGlobalScheduler(plugin); | ||
} | ||
} |
Oops, something went wrong.