kreedax

I want to make a minecraft mod. It should do the following, it is very simple. it adds 2 commands to the game, /start and /stop /start has variables: /start "command" # anything inside the quotes should be executed as a command, and the number after is how often it is sent (in ticks) for example, /start "/kill" 20 would execute the /kill command every 20 ticks. /stop simply stops it.

Kodari AI
KodariJun 24 at 4:57 pm 5

I’ll create a simple command repeater plugin for you.

CommandRepeater
A lightweight plugin that adds /start and /stop commands to repeatedly execute any command at specified tick intervals. Players can use /start "command" ticks to run a command on a timer, and /stop to cancel it. Perfect for automation, testing, or creating timed events. Each player can have their own active repeating command with customizable tick rates.

Done! Your CommandRepeater plugin is ready.

Features:

  • /start "command" ticks - Execute any command repeatedly at the specified tick interval

  • /stop - Cancel your active repeating command

  • Each player can have their own repeating command

  • Starting a new command automatically cancels the previous one

Example usage:

  • /start "kill" 20 - Kills the player every 20 ticks (1 second)

  • /start "say Hello" 100 - Says “Hello” every 100 ticks (5 seconds)

  • /stop - Stops the repeating command

The plugin uses regex to properly parse quoted commands and validates all input before starting the repeating task.

kreedax

Wait. I want the inside of the quptes to be an actual command, to be simple. For example/start "/kill" 20, not /start "kill" 20

Kodari AI
KodariJun 24 at 4:59 pm 9

Done! Updated the plugin to handle commands with slashes inside the quotes.

Now you can use:

  • /start "/kill" 20 - Executes /kill every 20 ticks

  • /start "/say Hello" 100 - Executes /say Hello every 100 ticks

  • /stop - Stops the repeating command

The plugin will automatically strip the leading slash from the quoted command before executing it.

kreedax

please output the .jar file

Kodari AI
KodariJun 24 at 4:59 pm 2

I can’t compile or generate .jar files directly - I can only create the source code files (which are already complete in your project).

To build the .jar file yourself, you have two options:

Option 1: Using Gradle (if you have it installed)

Shell
./gradlew build

The .jar will be in build/libs/CommandRepeater-1.0.jar

Option 2: Using an IDE

  • Import the project into IntelliJ IDEA or Eclipse

  • Run the Gradle build task

  • Find the .jar in the build/libs/ folder

Option 3: Online build service If you don’t have Java/Gradle installed, you can use an online Minecraft plugin builder or send the project files to someone who can compile it for you.

All the source files are ready in your project - you just need to compile them into a .jar file using one of the methods above.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
4 173
src/main/java/com/commandrepeater/CommandRepeater.java
package com.commandrepeater;

import com.commandrepeater.commands.RepeatCommandExecutor;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class CommandRepeater extends JavaPlugin {

    private final Map<UUID, BukkitTask> activeTasks = new HashMap<>();

    @Override
    public void onEnable() {
        RepeatCommandExecutor commandExecutor = new RepeatCommandExecutor(this);
        getCommand("start").setExecutor(commandExecutor);
        getCommand("stop").setExecutor(commandExecutor);
        
        getLogger().info("CommandRepeater has been enabled!");
    }

    @Override
    public void onDisable() {
        activeTasks.values().forEach(BukkitTask::cancel);
        activeTasks.clear();
        getLogger().info("CommandRepeater has been disabled!");
    }

    public Map<UUID, BukkitTask> getActiveTasks() {
        return activeTasks;
    }
}