mc-TimesAPI

šŸ• TimesAPI - Revolutionary Task Scheduling for Spigot Plugins and for Java projects!

Say goodbye to complex Bukkit schedulers and hello to human-readable task scheduling!

ā“ What is TimesAPI?

TimesAPI is a modern, lightweight Java scheduling library that transforms how you handle scheduled tasks in your Spigot plugins. Instead of wrestling with tick calculations and complex scheduler syntax, you can now schedule tasks using natural language like:

• "EVERYDAY @ 18:00" - Daily server restart warning • "EVERY MON,WED,FRI @ 12:00" - Periodic world saves • "EVERY 30 MINUTES" - Regular cleanup tasks • "WEEKDAYS @ 09:00" - Weekday-only announcements

⚔ Why TimesAPI for Spigot Development?

Traditional Bukkit Scheduler:

// Confusing tick calculations and verbose syntax
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () -> {
// Daily restart warning
}, 20L * 60 * 60 * 24, 20L * 60 * 60 * 24); // 24 hours in ticks - confusing!

With TimesAPI:

TimesAPI scheduler = new TimesAPI();
scheduler.schedule("EVERYDAY @ 18:00", () -> { 
    Bukkit.broadcastMessage("§6Server restart in 1 hour!");
});

⭐ Advanced Features for Plugin Developers

Annotation-Based Scheduling:

public class ServerTasks {
    @Schedule("EVERYDAY @ 06:00")
    public void dailyBackup() {
    backupPlayerData();
    backupWorldData();
    }
    
    @Schedule(value = "EVERY 5 MINUTES", async = true) 
    public void cleanupEntities() { 
    // Heavy cleanup task runs asynchronously 
    cleanupLaggyEntities(); 
    }
    
    @Schedule("WEEKDAYS @ 16:00") 
    public void schoolHoursEnd() { 
    Bukkit.broadcastMessage("§a[SCHOOL] School hours ended! Welcome back students!"); 
    }
}
// Register in your plugin
TimesAPI scheduler = new TimesAPI();
scheduler.registerScheduledClass(new ServerTasks());


// Task Management:
// Cancel tasks dynamically
String taskId = scheduler.schedule("EVERY HOUR", () -> { 
    if (serverMaintenanceMode) { 
    return; // Skip during maintenance 
} 
performHourlyTasks();
}).get().getId();


// Cancel when needed
scheduler.cancelTask(taskId);

ā˜€ Why Choose TimesAPI?

āœ… No more tick calculations - use real-world time āœ… Human-readable scheduling syntax āœ… Thread-safe and performance optimized āœ… Zero configuration required āœ… Perfect for both simple and complex scheduling needs āœ… Lightweight with 0 dependency! āœ… Async support for heavy operations āœ… Built-in error handling and recovery

Last updated