K

คำสั่งอัตโนมัติ ตั้งค่า คำสั่ง,เวลา ผ่าน config สามารตั้งได้หลายคำสั่ง

Kodari AI
KodariJun 6 at 11:12 am 1

I’ll create an automated command scheduling plugin.

AutoCommands
A configurable Minecraft plugin that automatically executes predefined commands at set intervals. Supports multiple independent command blocks with individual timers, random command selection, and placeholder support. Features include configurable delay before first execution, permission-based command visibility, broadcast messages per block, and a reload command. All settings managed through config.yml without needing server restarts.</project_descriptionThis plugin lets you configure automated commands via config — timed intervals, player join triggers, and first-join events. Fully configurable from `config.yml`.
AutoCommands
An automated command scheduling plugin that runs configured commands on timers or player events. Supports interval-based execution, player join triggers, and first-join-only commands. Each command is fully configurable via config.yml with executor type (console/player), permission requirements, and customizable timing. Includes reload, list, info, and manual run commands.

All 10 files created. Here’s a summary:

AutoCommands Plugin — schedule automated commands from config.yml

Commands: /ac reload | /ac list | /ac info <id> | /ac run <id>

Triggers:

  • INTERVAL — runs every X seconds (with %player% support — runs per online player)

  • JOIN — runs when a player joins

  • FIRST_JOIN — runs once per player lifetime (persisted in first-joins.yml)

Placeholders: %player%, %online%, %maxplayers%

Executors: CONSOLE (runs as server) or PLAYER (runs as the player)

Config has 5 example commands out-of-the-box — auto-broadcast, auto-save, welcome message, first-join gift, and a voter broadcast (disabled by default). Just edit config.yml and /ac reload.

K

เพิ่ม ข้อความอัตโนมัติ

Kodari AI
KodariJun 6 at 11:25 am 2

I’ll add an auto-messages section so messages broadcast directly from config — no need to wrap them in /broadcast commands.

Now I’ll add the auto-message system. I’ll create the model, broadcaster, update config, and wire it in.

Now I need to update ConfigManager.java to load messages, CommandScheduler.java to broadcast, and AutoCommands.java to wire the broadcaster. Let me load the messages.

Now patch the Java files

The dashes don’t match — I’ll rewrite the config fully with <update>.

Now let me create the model and broadcaster, and update the scheduler:

The <create> tag didn’t work earlier — let me create them properly now.

Now wire the broadcaster into the main plugin and update the CommandScheduler

Now update the scheduler to also tick messages:

Now add the message broadcasting logic into the scheduler

Let me delete the unused MessageBroadcaster.java file and verify the main plugin file

The earlier update didn’t take effect. Let me update the main plugin and remove orphaned files:

Now the auto-messages section is loaded by ConfigManager and broadcast by CommandScheduler — no separate files needed. Everything’s integrated into the existing scheduler loop.


สรุปฟีเจอร์ข้อความอัตโนมัติ (auto-messages):

config.yml → auto-messages section ตั้งค่าหลายรายการได้ แต่ละรายการมี:

Field
ความหมาย
id
ชื่อรายการ
enabled
เปิด/ปิด
interval-seconds
เวลาหมุนเวียน (วินาที)
prefix
ข้อความนำหน้า (รองรับ
&
สี)
permission
สิทธิ์ (เว้นว่าง = ทุกคนเห็น)
messages
รายการข้อความ → สุ่ม 1 ข้อความทุกครั้ง

วิธีใช้: แก้ config.yml → /ac reload

ข้อความตัวอย่างมีมาให้แล้ว 3 ชุด: tips ทุก 2 นาที, news ทุก 5 นาที, VIP (ปิดไว้)

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
12 768
src/main/java/com/autocommands/AutoCommands.java
package com.autocommands;

import com.autocommands.commands.AutoCommandsCommand;
import com.autocommands.listeners.PlayerListener;
import com.autocommands.managers.CommandScheduler;
import com.autocommands.managers.ConfigManager;
import com.autocommands.managers.FirstJoinManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public final class AutoCommands extends JavaPlugin {

    private ConfigManager configManager;
    private CommandScheduler commandScheduler;
    private FirstJoinManager firstJoinManager;

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

        this.configManager = new ConfigManager(this);
        this.commandScheduler = new CommandScheduler(this);
        this.firstJoinManager = new FirstJoinManager(this);

        getServer().getPluginManager().registerEvents(new PlayerListener(this), this);

        AutoCommandsCommand mainCommand = new AutoCommandsCommand(this);
        getCommand("autocommands").setExecutor(mainCommand);
        getCommand("autocommands").setTabCompleter(mainCommand);

        commandScheduler.start();

        getLogger().info("AutoCommands v" + getDescription().getVersion() + " enabled!");
    }

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

    public void reload() {
        commandScheduler.stop();
        reloadConfig();
        configManager.reload();
        commandScheduler.start();
    }
}