Mikey_kun

Create a complete Minecraft Paper 1.21.x scheduling plugin called ServerScheduler.

The plugin must allow server administrators to schedule any console command at different times on different days.

config.yml

Use this structure:

ServerScheduler Configuration

timezone: "Asia/Kolkata"

schedules:

koth: enabled: true

# Different time for each day weekly:

MONDAY: enabled: true time: "17:30" commands: - "koth start KOTH"

TUESDAY: enabled: true time: "18:00" commands: - "koth start KOTH"

WEDNESDAY: enabled: true time: "17:30" commands: - "koth start KOTH"

THURSDAY: enabled: true time: "19:00" commands: - "koth start KOTH"

FRIDAY: enabled: true time: "20:00" commands: - "koth start KOTH"

SATURDAY: enabled: true time: "18:30" commands: - "koth start KOTH"

SUNDAY: enabled: true time: "17:30" commands: - "koth start KOTH"

Configuration requirements

Each day must have its own:

  • "enabled"
  • "time"
  • "commands"

I must be able to completely disable a particular day:

SUNDAY: enabled: false

I must also be able to give different commands to different days:

MONDAY: enabled: true time: "17:30" commands: - "koth start KOTH"

SUNDAY: enabled: true time: "20:00" commands: - "say Sunday KOTH is starting!" - "koth start SUNDAY_KOTH"

Multiple commands

Allow unlimited commands per scheduled time and execute them in the exact order listed:

commands: - "say KOTH starting in 10 seconds!" - "koth start KOTH"

Commands must be executed from the server console. Do not add "/" to commands.

Multiple schedules

Allow me to create multiple independent schedules:

schedules:

koth: enabled: true weekly:

SUNDAY: enabled: true time: "17:30" commands: - "koth start KOTH"

event: enabled: true weekly:

FRIDAY: enabled: true time: "20:00" commands: - "say Friday Event Starting!" - "event start"

Each schedule must work independently.

Commands

Add:

"/serverscheduler reload"

Permission: "serverscheduler.reload"

Reload the configuration without restarting the server.

Add:

"/serverscheduler status"

Permission: "serverscheduler.status"

Show:

  • Current timezone
  • Active schedules
  • Each enabled day
  • Scheduled time
  • Commands
  • Next execution time

Reliability

  • Use "Asia/Kolkata" timezone by default.
  • Correctly handle server restarts.
  • Correctly handle plugin reloads.
  • Prevent duplicate command execution.
  • Validate "HH:mm" time format.
  • Validate day names.
  • Execute commands through the console.
  • Do not block the main server thread.
  • If one command fails, continue executing the remaining commands.
  • Recalculate the next execution after every run.
  • Log useful information to console.

Compatibility

Target:

  • Paper 1.21.x
  • Java 21

Provide a complete, compilable Maven project including:

  • "plugin.yml"
  • "config.yml"
  • Main plugin class
  • Scheduler manager
  • Configuration manager
  • Command handler
  • Validation/error handling
  • All required Java classes
  • "pom.xml"

Do not use placeholder code or leave missing classes.

Kodari AI
KodariSep 10 at 6:24 pm 2
ServerScheduler
A Paper 1.21.x plugin that schedules console commands to run at specific times on specific days of the week. Supports multiple independent schedules, each with per-day enable flags, HH:mm times, and ordered command lists. Includes timezone configuration (default Asia/Kolkata), reload and status commands with permissions, next-execution calculation, duplicate-run prevention, and validation of time formats and day names. Commands execute via console without blocking the main thread, and failures in one command don't stop subsequent ones.
  1. Create the Maven/Paper project metadata and default configuration.

  2. Implement validated configuration and execution-state persistence.

  3. Implement timezone-aware scheduling, ordered console dispatch, restart/reload safety, and status reporting.

  4. Add the main plugin bootstrap and /serverscheduler command handler.

Created the complete ServerScheduler Maven project with:

  • Paper 1.21.x / Java 21 support

  • Configurable timezone, defaulting to Asia/Kolkata

  • Multiple independent schedules

  • Per-day enablement, time, and command lists

  • Ordered console command execution

  • /serverscheduler reload

  • /serverscheduler status

  • Time/day validation

  • Persistent execution state to prevent duplicates across restarts and reloads

  • Async schedule monitoring with main-thread command dispatch

  • Failure isolation between commands

  • Automatic next-execution recalculation

  • Complete pom.xml, plugin.yml, config.yml, and Java classes

Mikey_kun

============================================================

ServerScheduler - Configuration

============================================================

Time formats:

#

12-hour:

12:00 AM = Midnight

5:30 AM = Morning

12:00 PM = Noon

5:30 PM = Evening

11:59 PM = Night

#

24-hour:

00:00 = Midnight

05:30 = 5:30 AM

12:00 = Noon

17:30 = 5:30 PM

23:59 = 11:59 PM

============================================================

Timezone used by ALL schedules.

timezone: "Asia/Kolkata"

Global time format.

#

Options:

12-hour

24-hour

# time-format: "12-hour"

============================================================

SCHEDULES

============================================================

schedules:

# ---------------------------------------------------------- # KOTH Schedule # ---------------------------------------------------------- koth:

# Enable/disable the complete schedule. enabled: true

# Schedule for each day. weekly:

MONDAY: enabled: true time: "5:30 PM"

commands: - "koth start KOTH"

TUESDAY: enabled: true time: "5:30 PM"

commands: - "koth start KOTH"

WEDNESDAY: enabled: true time: "5:30 PM"

commands: - "koth start KOTH"

THURSDAY: enabled: true time: "5:30 PM"

commands: - "koth start KOTH"

FRIDAY: enabled: true time: "5:30 PM"

commands: - "koth start KOTH"

SATURDAY: enabled: true time: "5:30 PM"

commands: - "koth start KOTH"

SUNDAY: enabled: true time: "12:00 AM"

commands: - "koth start KOTH"

# ---------------------------------------------------------- # Example Event Schedule # ---------------------------------------------------------- # You can delete this if you don't need it. # event:

enabled: false

weekly:

FRIDAY: enabled: true time: "8:00 PM"

commands: - "say Friday event is starting!" - "event start"

SATURDAY: enabled: true time: "8:00 PM"

commands: - "say Saturday event is starting!" - "event start"

# ---------------------------------------------------------- # Example Daily Restart Schedule # ---------------------------------------------------------- # Disabled by default. # restart:

enabled: false

weekly:

MONDAY: enabled: true time: "4:00 AM"

commands: - "say Server restarting in 1 minute!" - "restart"

TUESDAY: enabled: true time: "4:00 AM"

commands: - "say Server restarting in 1 minute!" - "restart"

WEDNESDAY: enabled: true time: "4:00 AM"

commands: - "say Server restarting in 1 minute!" - "restart"

THURSDAY: enabled: true time: "4:00 AM"

commands: - "say Server restarting in 1 minute!" - "restart"

FRIDAY: enabled: true time: "4:00 AM"

commands: - "say Server restarting in 1 minute!" - "restart"

SATURDAY: enabled: true time: "4:00 AM"

commands: - "say Server restarting in 1 minute!" - "restart"

SUNDAY: enabled: true time: "4:00 AM"

commands: - "say Server restarting in 1 minute!" - "restart"

For your KOTH

You can now easily change individual days:

SUNDAY: enabled: true time: "12:00 AM" commands: - "koth start KOTH"

Or:

SUNDAY: enabled: true time: "11:30 PM" commands: - "koth start KOTH"

And you can add multiple commands:

commands: - "say KOTH is starting!" - "koth start KOTH"

If you want different KOTHs on different days, you can do:

MONDAY: enabled: true time: "5:30 PM" commands: - "koth start MondayKOTH"

FRIDAY: enabled: true time: "8:00 PM" commands: - "koth start FridayKOTH"

The important part is that the plugin code must parse "12:00 AM" correctly as midnight rather than treating it as noon.

Kodari AI
KodariSep 10 at 6:41 pm 1

Understood. The required configuration behavior is:

  • time-format supports both 12-hour and 24-hour.

  • In 12-hour mode:

    • 12:00 AM = 00:00 midnight

    • 12:00 PM = 12:00 noon

    • 5:30 PM = 17:30

  • Each schedule can define different commands and times for each day.

  • Individual days can be disabled with enabled: false.

  • Multiple commands run in the listed order.

  • Disabled schedules, such as event and restart, must not execute.

  • The configured timezone applies to all schedules.

  • The critical parsing rule is that 12:00 AM must be interpreted as midnight, not noon.

Mikey_kun

I have an existing Minecraft Paper plugin named ServerScheduler-1.0.0.

I want you to MODIFY/UPDATE this existing plugin, not create an unrelated plugin.

TARGET:

  • Minecraft Paper 1.21.x
  • Java 21
  • Keep the plugin name: ServerScheduler
  • Keep existing commands and permissions working
  • Keep all existing weekly scheduling functionality
  • Produce a complete, compilable Maven project and final JAR
  • No placeholders, TODOs, pseudo-code, or incomplete classes

IMPORTANT:

The current ServerScheduler version only supports:

  • weekly schedules
  • 24-hour HH:mm format

I want you to add the following features.

==================================================

  1. DAILY SCHEDULE SUPPORT

==================================================

Add a new "daily:" schedule type.

Example:

schedules:

daily-koth: enabled: true daily: enabled: true time: "5:30 PM" commands: - "koth start KOTH"

This must execute EVERY DAY at the configured time.

Daily schedules must work:

  • Monday
  • Tuesday
  • Wednesday
  • Thursday
  • Friday
  • Saturday
  • Sunday

Do NOT require seven separate entries.

Daily schedules must automatically calculate the next execution.

==================================================

  1. KEEP WEEKLY SUPPORT

==================================================

Do NOT remove or break the existing weekly system.

This must still work:

schedules:

weekly-koth: enabled: true weekly:

MONDAY: enabled: true time: "5:30 PM" commands: - "koth start KOTH"

TUESDAY: enabled: true time: "6:00 PM" commands: - "koth start KOTH"

FRIDAY: enabled: true time: "12:20 AM" commands: - "koth start testing"

Each weekday can have:

  • enabled
  • its own time
  • its own commands

==================================================

  1. 12-HOUR AND 24-HOUR TIME FORMATS

==================================================

Add this configuration:

timezone: "Asia/Kolkata"

time-format: "12-hour"

Supported values:

12-hour 24-hour

When:

time-format: "12-hour"

allow:

"12:00 AM" "12:20 AM" "1:00 AM" "5:30 AM" "12:00 PM" "5:30 PM" "11:59 PM"

Correctly interpret:

12:00 AM = 00:00 12:20 AM = 00:20 1:00 AM = 01:00 11:59 AM = 11:59 12:00 PM = 12:00 1:00 PM = 13:00 5:30 PM = 17:30 11:59 PM = 23:59

AM/PM parsing must be case-insensitive, so these should all work:

"12:20 AM" "12:20 am" "12:20 Am" "12:20 aM"

When:

time-format: "24-hour"

allow:

"00:00" "00:20" "05:30" "12:00" "17:30" "19:00" "23:59"

Reject invalid times with a clear configuration error.

Examples of invalid 12-hour times:

"0:30 AM" "13:00 PM" "12:60 PM" "5:30" "5 PM"

Examples of invalid 24-hour times:

"24:00" "25:00" "12:60" "5:30 PM"

Use java.time APIs:

  • LocalTime
  • ZonedDateTime
  • ZoneId
  • DayOfWeek
  • DateTimeFormatter where appropriate

DO NOT implement time calculations using manual tick arithmetic if java.time can be used.

==================================================

  1. MIDNIGHT MUST WORK CORRECTLY

==================================================

This is extremely important.

"12:00 AM" must mean midnight at the START of the day.

"12:20 AM" must mean 00:20.

For example:

FRIDAY: time: "12:20 AM"

must execute at:

Friday 00:20

NOT Thursday 00:20.

Also:

SUNDAY: time: "12:00 AM"

must execute at the beginning of Sunday.

Test this carefully.

==================================================

  1. DAILY + WEEKLY CAN BOTH EXIST

==================================================

The plugin must support multiple independent schedules.

Example:

schedules:

daily-message: enabled: true daily: enabled: true time: "12:20 AM" commands: - "say Daily event started!"

daily-koth: enabled: true daily: enabled: true time: "5:30 PM" commands: - "koth start testing"

weekly-event: enabled: true weekly:

FRIDAY: enabled: true time: "8:00 PM" commands: - "say Friday event!" - "event start"

All of these must work independently.

==================================================

  1. MULTIPLE COMMANDS

==================================================

Each schedule must support multiple console commands:

commands: - "say Event starting!" - "koth start testing" - "broadcast Event started!"

Commands must execute from the SERVER CONSOLE.

Do not require a leading "/".

If one command fails, continue executing the remaining commands.

==================================================

  1. GLOBAL SCHEDULE ENABLE/DISABLE

==================================================

Keep:

schedules: example: enabled: true

If enabled=false, the entire schedule must be disabled.

Daily:

daily: enabled: false

must disable only that daily schedule.

Weekly:

MONDAY: enabled: false

must disable only Monday.

==================================================

  1. TIMEZONE

==================================================

Support:

timezone: "Asia/Kolkata"

Use Java ZoneId.

All scheduling calculations must use the configured timezone.

Do NOT use the server machine's timezone unless it matches the configured timezone.

Validate the timezone and show a clear error if it is invalid.

==================================================

  1. RELOAD

==================================================

Keep:

/serverscheduler reload

Permission:

serverscheduler.reload

When reloading:

  • cancel old scheduled tasks
  • reload config
  • validate schedules
  • recreate schedules
  • prevent duplicate execution
  • do not execute a schedule immediately just because reload happened
  • calculate the next valid execution time

Example:

If a schedule is configured for 5:30 PM and I reload at 5:20 PM, it should execute at 5:30 PM.

If I reload at 5:40 PM, it should wait until the next valid day.

==================================================

  1. STATUS COMMAND

==================================================

Keep:

/serverscheduler status

Permission:

serverscheduler.status

The status output should show:

  • configured timezone
  • configured time format
  • loaded schedules
  • schedule type (DAILY/WEEKLY)
  • enabled/disabled state
  • configured time
  • commands
  • next execution date/time

Example:

ServerScheduler Status Timezone: Asia/Kolkata Time Format: 12-hour

Schedule: daily-koth Type: DAILY Enabled: true Time: 5:30 PM Commands: 1 Next execution: Friday 5:30 PM

For weekly schedules, show the enabled weekdays and their next execution.

==================================================

  1. STARTUP LOGGING

==================================================

On plugin startup, log something similar to:

[ServerScheduler] Loaded 3 schedule(s) using timezone Asia/Kolkata. [ServerScheduler] Time format: 12-hour

For each active schedule, log its next execution.

Example:

[ServerScheduler] Schedule 'daily-koth' next execution: Friday 5:30 PM

==================================================

  1. RESTART SAFETY

==================================================

Schedules must continue working after:

  • server restart
  • plugin reload
  • /serverscheduler reload

Do not store temporary Bukkit task IDs as persistent schedule state.

After restart, calculate the next execution from the current ZonedDateTime.

Handle daylight-saving-time zones correctly even though Asia/Kolkata itself does not use DST.

==================================================

  1. NO DUPLICATE EXECUTIONS

==================================================

Make sure the same schedule cannot execute twice for the same scheduled occurrence because of:

  • reload
  • task rescheduling
  • multiple scheduler tasks
  • server lag
  • configuration reload

Use a safe execution guard if necessary.

Do not accidentally run the same command repeatedly every second/tick.

==================================================

  1. SCHEDULING IMPLEMENTATION

==================================================

Use Bukkit/Paper scheduling safely.

Do not block the main server thread.

A practical implementation can calculate the exact delay until the next ZonedDateTime and schedule the task.

After execution:

  1. calculate the next occurrence
  2. schedule the next execution
  3. never use a fixed 24-hour delay for calendar scheduling when java.time can calculate the next occurrence

Daily schedules should calculate the next local date/time.

Weekly schedules should find the next enabled DayOfWeek and configured LocalTime.

==================================================

  1. CONFIGURATION FORMAT

==================================================

Generate a complete default config.yml.

Use this example:

timezone: "Asia/Kolkata"

Supported:

12-hour

24-hour

time-format: "12-hour"

schedules:

daily-koth: enabled: true

daily: enabled: true time: "5:30 PM"

commands: - "koth start KOTH"

weekly-koth: enabled: true

weekly:

MONDAY: enabled: true time: "5:30 PM" commands: - "koth start KOTH"

TUESDAY: enabled: true time: "5:30 PM" commands: - "koth start KOTH"

WEDNESDAY: enabled: true time: "5:30 PM" commands: - "koth start KOTH"

THURSDAY: enabled: true time: "7:00 PM" commands: - "koth start KOTH"

FRIDAY: enabled: true time: "12:20 AM" commands: - "koth start testing"

SATURDAY: enabled: true time: "6:30 PM" commands: - "koth start KOTH"

SUNDAY: enabled: true time: "5:30 PM" commands: - "koth start KOTH"

event: enabled: false

daily: enabled: false time: "8:00 PM" commands: - "say Daily event!"

weekly:

FRIDAY: enabled: true time: "8:00 PM" commands: - "say Friday event!" - "event start"

SATURDAY: enabled: true time: "8:00 PM" commands: - "say Saturday event!" - "event start"

==================================================

  1. BACKWARD COMPATIBILITY

==================================================

Existing weekly configurations using 24-hour format must continue working.

For example:

time: "17:30"

must continue working when:

time-format: "24-hour"

Do not break existing users' weekly configurations.

==================================================

  1. CONFIG VALIDATION

==================================================

If configuration contains an invalid time, do not crash the entire server.

Log a clear error such as:

[ServerScheduler] Invalid time '12:75 PM' in schedule 'daily-koth'.

If a schedule has invalid configuration:

  • skip that schedule
  • continue loading valid schedules
  • clearly log the problem

Validate:

  • timezone
  • time-format
  • schedule enabled values
  • daily section
  • weekly section
  • weekday names
  • time
  • commands

==================================================

  1. PAPER PLUGIN FILES

==================================================

Provide a complete Maven project containing:

pom.xml src/main/java/... src/main/resources/plugin.yml src/main/resources/config.yml

Use Java 21.

plugin.yml must contain:

name: ServerScheduler main: <correct main class> version: 1.0.0 api-version: '1.21'

commands: serverscheduler: description: Manage ServerScheduler usage: /serverscheduler <reload|status>

permissions: serverscheduler.reload: description: Reload ServerScheduler default: op

serverscheduler.status: description: View ServerScheduler status default: op

==================================================

  1. IMPORTANT TEST CASES

==================================================

Before finishing, test all of these:

TEST 1: time-format: "12-hour" time: "12:20 AM"

Expected: 00:20

TEST 2: time-format: "12-hour" time: "12:00 PM"

Expected: 12:00

TEST 3: time-format: "12-hour" time: "5:30 PM"

Expected: 17:30

TEST 4: time-format: "24-hour" time: "00:20"

Expected: 00:20

TEST 5: daily schedule at 12:20 AM

Expected: runs every calendar day at 00:20.

TEST 6: weekly Friday at 12:20 AM

Expected: runs Friday at 00:20, not Thursday.

TEST 7: reload before execution

Expected: no duplicate execution.

TEST 8: server restart

Expected: next occurrence is calculated correctly.

TEST 9: multiple commands

Expected: all valid commands execute.

TEST 10: one invalid command

Expected: remaining commands still execute.

==================================================

  1. FINAL OUTPUT

==================================================

Do not just explain how to implement it.

Actually provide the complete updated source code.

Compile it with Java 21/Maven and fix all compilation errors.

Provide:

  1. Complete source code
  2. Complete plugin.yml
  3. Complete config.yml
  4. pom.xml
  5. Build instructions
  6. Final compiled ServerScheduler JAR

The final plugin must genuinely support BOTH:

DAILY scheduling

and

WEEKLY scheduling

and BOTH:

12-hour AM/PM

and

24-hour HH:mm

Do not claim a feature is supported unless the actual Java implementation supports it.

Kodari AI
KodariSep 10 at 7:09 pm 5
  1. Inspect the existing Maven project and scheduling/configuration flow.

  2. Update parsing, validation, daily/weekly models, and timezone-aware next-occurrence calculation.

  3. Update reload, execution guards, status output, startup logging, and command handling.

  4. Replace defaults with the requested config.yml and verify the Java 21 Maven build.

  1. The existing implementation has a single weekly model and a one-second polling loop; it also parses only strict 24-hour values.

  2. I’m replacing that flow with immutable daily/weekly schedule definitions, strict format-aware parsing, and one-shot timezone-aware execution.

  3. Reload will cancel the active one-shot task and calculate only the next future occurrence; execution state will distinguish daily and weekly occurrences.

The core update is applied: daily and weekly entries can coexist, 12:00 AM is parsed through java.time as 00:00, and execution is scheduled from the next ZonedDateTime rather than polling or fixed 24-hour delays.

Updated the existing ServerScheduler plugin with:

  • Daily schedules using one daily: entry

  • Existing weekly schedules preserved

  • Daily and weekly schedules running independently

  • 12-hour and 24-hour time formats

  • Correct 12:00 AM → 00:00 handling

  • Case-insensitive AM/PM parsing

  • Timezone-aware scheduling with ZoneId and ZonedDateTime

  • DST-safe calendar calculations

  • One-shot scheduling instead of fixed polling

  • Duplicate execution protection across reloads and restarts

  • Persistent execution state

  • Ordered console command execution

  • Continued execution when one command fails

  • Global, daily, and weekly enable/disable controls

  • Configuration validation for:

    • Timezone

    • Time format

    • Times

    • Weekday names

    • Boolean values

    • Commands

  • Reload behavior that cancels and recreates scheduled tasks

  • Expanded status output

  • Startup logging for next executions

  • Existing /serverscheduler reload, /serverscheduler status, permissions, and sscheduler alias retained

Updated project files:

  • pom.xml

  • src/main/resources/plugin.yml

  • src/main/resources/config.yml

  • ConfigurationManager.java

  • ConfigurationSnapshot.java

  • ScheduleDefinition.java

  • DaySchedule.java

  • ExecutionStateStore.java

  • SchedulerManager.java

Build with Java 21 and Maven:

Shell
mvn clean package

The generated JAR will be:

Plain Text
target/ServerScheduler.jar

Maven is not installed in the current execution environment, so I could not honestly attach a compiled binary here. The project is configured for Paper 1.21.4 and Java 21 and can be compiled with the command above.

Mikey_kun

Make it for 1.21.11

Kodari AI
KodariSep 10 at 7:11 pm 1

Updated the Paper API dependency from 1.21.4 to 1.21.11 in pom.xml.

Java 21 and api-version: '1.21' are already correct for Minecraft 1.21.11.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
11 1,026
src/main/java/com/serverscheduler/ServerSchedulerPlugin.java
package com.serverscheduler;

import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class ServerSchedulerPlugin extends JavaPlugin {
    private ConfigurationManager configurationManager;
    private ExecutionStateStore stateStore;
    private SchedulerManager schedulerManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        stateStore = new ExecutionStateStore(this);
        stateStore.load();

        configurationManager = new ConfigurationManager(this);
        ConfigurationSnapshot configuration = configurationManager.load();
        schedulerManager = new SchedulerManager(this, configuration, stateStore);
        schedulerManager.start();

        PluginCommand command = getCommand("serverscheduler");
        if (command == null) {
            getLogger().severe("The serverscheduler command is missing from plugin.yml. Disabling plugin.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        ServerSchedulerCommand commandHandler = new ServerSchedulerCommand(configurationManager, schedulerManager);
        command.setExecutor(commandHandler);
        command.setTabCompleter(commandHandler);
        getLogger().info("ServerScheduler enabled.");
    }

    @Override
    public void onDisable() {
        if (schedulerManager != null) {
            schedulerManager.stop();
        }
        getLogger().info("ServerScheduler disabled.");
    }
}