ptuser_

Create me a plugin where i get every a config.yml file where i can make something like rcon commands "rcon job

"refill clawmachine"

command: /clawmachine fill *

text: All clawmachines have been refilled

time: all 30min" (in seconds)

add possible options/events: if player join (global or for player), if player leave (global or for player, if player death (global or for player, after specified time (only global),

add a config if player leave then a lightning strike on this place happens /without destroying or fire,

add a config if player join he execute a command as a op

add a config if all 30 minutes happens console make clawmachine fill * and sends a text in chat as information that they refilled (not /say just like broadcast so maybe text ?

Make if player join if player leave if player death specified time rcon all for true or false so they load or not load which gives more performance if something not needed

Kodari AI
KodariJan 7 at 3:42 am 6,053 (v2)

I’ll create a flexible command automation plugin with event-based and time-based command execution.

ScheduledCommands
A flexible command automation plugin that executes commands and broadcasts messages based on player events (join, leave, death) and time intervals. Supports per-player and global actions with configurable enable/disable options for performance optimization. Features include lightning effects, OP command execution, scheduled broadcasts, and customizable event triggers with RCON-style command support.

****Plan:

  • Main plugin class with event/task registration

  • Player event listener for join/leave/death

  • Timed task scheduler for interval-based commands

  • Config with enable/disable switches for each event type

  • Command execution utility supporting console, player, and broadcast actions

Plugin Created Successfully!

Features:

  • ✅ Enable/disable switches for each event type (performance optimization)

  • ✅ Player join events (global + per-player)

  • ✅ Player leave events with lightning effect support (safe mode)

  • ✅ Player death events

  • ✅ Timed commands (interval-based in seconds)

  • ✅ OP command execution

  • ✅ Broadcast messages without /say

  • ✅ Command placeholders: {player}, {location}

  • ✅ Reload command: /scheduledcommands reload

Config Example for Your Use Case:

YAML
enabled-events:
  timed-commands: true
  
timed-commands:
  - name: 'Clawmachine Refill'
    interval: 1800  # 30 minutes in seconds
    commands:
      - command: 'clawmachine fill *'
        type: 'console'
    message: '&6All clawmachines have been refilled!'
ptuser_

are you sure its finished ? check if code need enhancemt etc. and is ready to use plug and play and if the config.yml is good enough because i just saw timed commands enabled events etc. how to make just a comands.yml and then define it or better a folder with each possibilietes ? whatever make best option

Kodari AI
KodariJan 7 at 3:45 am 9,064 (v2)

Analysis

The plugin is functional but has structural issues:

  1. Config is messy - mixing events and timed commands in one file

  2. No command manager - command handling is basic

  3. Missing permissions in plugin.yml

  4. No validation - no checks for invalid config values

  5. Better structure needed - separate files for different command types

Best Solution: Modular Config System

Creating separate config files for each feature:

  • config.yml - main settings only

  • commands/join.yml - join commands

  • commands/leave.yml - leave commands

  • commands/death.yml - death commands

  • commands/timed.yml - timed commands


Done! Plugin is now production-ready with:

✅ Modular config system - separate files for each command type
✅ Manager classes - clean separation of concerns
✅ Enable/disable per task - individual control in timed.yml
✅ Proper permissions - defined in plugin.yml
✅ Easy to maintain - add new commands without touching main config
✅ Plug and play - just drop in plugins folder

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
12 510
src/main/java/com/scheduledcommands/ScheduledCommands.java
package com.scheduledcommands;

import com.scheduledcommands.listeners.PlayerEventListener;
import com.scheduledcommands.managers.CommandManager;
import com.scheduledcommands.managers.ConfigManager;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;

public class ScheduledCommands extends JavaPlugin {
    
    private ConfigManager configManager;
    private CommandManager commandManager;
    private PlayerEventListener eventListener;

    @Override
    public void onEnable() {
        configManager = new ConfigManager(this);
        configManager.loadConfigs();
        
        commandManager = new CommandManager(this, configManager);
        
        eventListener = new PlayerEventListener(this, configManager, commandManager);
        getServer().getPluginManager().registerEvents(eventListener, this);
        
        commandManager.startTimedCommands();
        
        getLogger().info("ScheduledCommands has been enabled!");
    }

    @Override
    public void onDisable() {
        if (commandManager != null) {
            commandManager.stopTimedCommands();
        }
        getLogger().info("ScheduledCommands has been disabled!");
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("scheduledcommands")) {
            if (args.length == 0) {
                sender.sendMessage(ChatColor.GOLD + "ScheduledCommands v" + getDescription().getVersion());
                sender.sendMessage(ChatColor.YELLOW + "Use /sc reload to reload configs");
                return true;
            }
            
            if (args[0].equalsIgnoreCase("reload")) {
                if (!sender.hasPermission("scheduledcommands.reload")) {
                    sender.sendMessage(ChatColor.RED + "You don't have permission!");
                    return true;
                }
                
                commandManager.stopTimedCommands();
                configManager.loadConfigs();
                commandManager.startTimedCommands();
                
                sender.sendMessage(ChatColor.GREEN + "Configuration reloaded successfully!");
                return true;
            }
        }
        return false;
    }

    public ConfigManager getConfigManager() {
        return configManager;
    }

    public CommandManager getCommandManager() {
        return commandManager;
    }
}