Home›Java›Mods›GlobalScheduler
ModsJava

GlobalScheduler

Java mod listed for Minecraft 1.7–1.18. Download on the author's site.

⬇ Download on Spigot
GlobalScheduler

GlobalScheduler is a Java scheduling library designed for Bukkit, Spigot, Paper, Folia, and similar Minecraft server platforms. It provides a unified and modern API for scheduling tasks on the main server thread, asynchronous threads, and region-owned threads for Folia/Paper.

This project is a fork of UniversalScheduler with a focus on improving package names, method naming conventions, and overall API clarity and usability.

Supported Platforms and Java Version

Minecraft Server Platforms:


Java Version: Compatible with Java 8 and above, commonly used in Minecraft plugin development.

The scheduler automatically detects and adapts to the running server environment to provide appropriate region-based scheduling functionality where supported, notably in Folia and Paper.

Features


How to Use

Getting a Scheduler Instance

Use GlobalScheduler.getScheduler(plugin) to obtain the appropriate scheduler for your server environment:

Code (Java):
import me.croabeast.scheduler.GlobalScheduler ;
import org.bukkit.plugin.Plugin ;

public final class MyPlugin extends JavaPlugin {
   
    private static GlobalScheduler staticScheduler ;
    private GlobalScheduler scheduler ;

    @Override
    public void onEnable ( ) {
        this. scheduler = GlobalScheduler. getScheduler ( this ) ;
        staticScheduler = this. scheduler ; // Store for static access if needed
    }

    @Override
    public void onDisable ( ) {
        // Cancel any running tasks if necessary
    }
}
This will instantiate a FoliaScheduler if running on Folia or supported Paper, or BukkitScheduler for vanilla Bukkit/Spigot environments.

Scheduling Tasks

Examples of scheduling tasks:

Code (Java):
// Run a task on the next main/global tick
scheduler. runTask ( ( ) -> {
    // Your task logic here
} ) ;

// Run a task later with delay (in ticks)
scheduler. runTaskLater ( ( ) -> {
    // Delayed task logic
}, 20L ) ;

// Run a repeating task at fixed intervals (delay and period in ticks)
scheduler. runTaskTimer ( ( ) -> {
    // Repeating task logic
}, 20L, 40L ) ;

// Run asynchronously
scheduler. runTaskAsynchronously ( ( ) -> {
    // Async task logic here
} ) ;
Region or Entity-based Scheduling (Folia/Paper)

Code (Java):
// Run a task on the region owning a location
scheduler. runTask (location, ( ) -> { /* Task for region */ } ) ;

// Run task related to an entity's region
scheduler. runTask (entity, ( ) -> { /* Task for entity's region */ } ) ;
Implementation Details


Fork Notice

This project is a fork of UniversalScheduler. The fork improves:


Requirements


Integration in Your Project

  1. Add this project as a dependency:

Maven

Code (XML):
<repositories>
  <repository>
    <id>croabeast-repo </id>
    <url>https://croabeast.github.io/repo/ </url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>me.croabeast </groupId>
    <artifactId>GlobalScheduler </artifactId>
    <version>1.0 </version>
  </dependency>
</dependencies>
Gradle

Code (Groovy):
repositories {
    maven {
        url 'https://croabeast.github.io/repo/'
    }
}
dependencies {
    implementation 'me.croabeast:GlobalScheduler:1.0'
}
  1. Obtain a GlobalScheduler instance through GlobalScheduler.getScheduler(plugin).
  2. Use the scheduler API to manage your plugin's task scheduling instead of directly using Bukkit's scheduler methods.
  3. Cancel tasks responsibly when disabling your plugin.

If you have any questions or contributions, feel free to open an issue or submit a pull request.
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

GlobalScheduler is a free Minecraft Java mod. Compatible with Minecraft 1.7, 1.8, 1.9, 1.10 and newer. Downloaded 17 times (via Spigot). Download it and open it directly in the game.

Explore more