Tiz
📎 1 file 1,549 chars
📄
pasted-code-1792107167862.txt
txt 23 lines
▶
Act as an expert Minecraft plugin developer using Java and the Spigot API for version 1.26.2. 

I need you to write the complete, well-structured code for a Spigot plugin (including the main class, command executors, and the plugin.yml file) that satisfies the following exact requirements:

1. **Timer Command (/timer ):**
   - Starts a countdown visible to all players on the server.
   - Should display dynamically (preferably via Action Bar, Title, or BossBar) second-by-second.
   - When it reaches 0, it should play a sound and broadcast a notification to the chat.

2. **Winner Command (/winner ):**
   - Displays a prominent Title and Subtitle on the screens of all online players.
   - The main title should clearly say "Winner" (or "¡GANADOR!"), and the subtitle should display the specified player's name (e.g., "Congratulations to [Name]!").

3. **Craftable Food Roulette Command (/foodroulette):**
   - When executed, it simulates a random roulette (using dynamic chat animation, title ticks, or sound effects).
   - Randomly picks a **craftable food item** in Minecraft (e.g., Bread, Cake, Mushroom Stew, Golden Apple, Golden Carrot, Pumpkin Pie, etc.).
   - Broadcasts the winning result in the chat with eye-catching formatting and color codes (e.g., "La comida seleccionada es: Pastel!").

Please provide:
- The package structure and class names.
- Clean, compilable Java code.
- The complete plugin.yml file with all commands registered.
- Brief step-by-step instructions on how to compile and run the plugin.
Kodari AI
KodariOct 15 at 11:35 pm 1
GameEventBroadcaster
A Spigot plugin for Minecraft 1.26.2 that provides three interactive game-event commands. The /timer command starts a server-wide countdown displayed dynamically via BossBar, updating every second, and upon reaching zero plays a sound and broadcasts a chat notification. The /winner command displays a prominent "Winner" title with a congratulatory subtitle on all online players' screens. The /foodroulette command simulates a random roulette animation in chat, then selects a random craftable food item and broadcasts the result with colorful formatting. Includes a main plugin class, command executors, and a complete plugin.yml configuration.

I’ll create the plugin entry point, countdown manager, three command executors, and plugin.yml; the commands will provide server-wide countdown titles, winner titles, and an animated food roulette.

Created the plugin under com.kodari.eventtools:

  • ServerEventsPlugin — plugin entry point and command registration.

  • countdown/CountdownManager — server-wide countdown, titles, and completion sound.

  • commands/TimerCommand — /timer <seconds>.

  • commands/WinnerCommand — /winner <player_name>.

  • commands/FoodRouletteCommand — animated /foodroulette.

  • src/main/resources/plugin.yml — command and plugin registration.

To build the jar: on desktop click Compile in the top bar; on phone tap ⋮ → Compile Project. Click Compile in the window, then Download when it succeeds. To run it, put the downloaded jar in the Spigot server’s plugins folder and restart the server.

Tiz

en el comando de foodroulete estan todas las comidas crafteables?

Kodari AI
KodariOct 15 at 11:48 pm 1

No. La ruleta tiene 10 opciones: pan, pastel, estofado de hongos, manzana dorada, zanahoria dorada, pastel de calabaza, galleta, sopa de remolacha, estofado de conejo y estofado sospechoso. Incluye las comidas crafteables principales, pero no todas las comidas del juego.

Tiz

pero te pedi que agregaras todas las comidas crafteables

Kodari AI
KodariOct 15 at 11:49 pm 1

Actualizaré la lista con la comida crafteable que faltaba: algas secas; la ruleta ya filtra automáticamente los materiales que no existan en el servidor.

Tienes razón: la lista estaba incompleta. Añadí algas secas, que se pueden obtener al deshacer un bloque de algas secas en la mesa de crafteo. La ruleta ahora incluye las 11 comidas crafteables de la lista: pan, pastel, estofado de hongos, manzana dorada, zanahoria dorada, pastel de calabaza, galleta, sopa de remolacha, estofado de conejo, estofado sospechoso y algas secas.

Las comidas que se obtienen cocinando o fundiendo, como la patata asada, no son recetas de crafteo.

Tiz

podrias tambien incluir la comida que se cocina?

Kodari AI
KodariOct 15 at 11:50 pm 1

Añadí a /foodroulette las comidas que se obtienen cocinando: patata asada, filete, pollo, bacalao, cordero, chuleta de cerdo, conejo y salmón cocinados. Las opciones que no existan en la versión del servidor se omiten automáticamente.

Tiz

y como descargo la version actualizada del plugin

Kodari AI
KodariOct 15 at 11:50 pm 1

En desktop, haz clic en Compile en la barra superior; en el teléfono, toca ⋮ → Compile Project. Luego pulsa Compile en la ventana. Cuando termine, descarga el plugin actualizado con Download en ese build o con el botón Download {nombre}.jar que aparece en el chat.

Kodari can make mistakes. Review important code before using.
Files
src
Code
6 287
src/main/java/com/kodari/eventtools/ServerEventsPlugin.java
package com.kodari.eventtools;

import com.kodari.eventtools.commands.FoodRouletteCommand;
import com.kodari.eventtools.commands.TimerCommand;
import com.kodari.eventtools.commands.WinnerCommand;
import com.kodari.eventtools.countdown.CountdownManager;
import org.bukkit.plugin.java.JavaPlugin;

public final class ServerEventsPlugin extends JavaPlugin {
    private CountdownManager countdownManager;

    @Override
    public void onEnable() {
        countdownManager = new CountdownManager(this);

        getCommand("timer").setExecutor(new TimerCommand(countdownManager));
        getCommand("winner").setExecutor(new WinnerCommand());
        getCommand("foodroulette").setExecutor(new FoodRouletteCommand(this));
    }

    @Override
    public void onDisable() {
        if (countdownManager != null) {
            countdownManager.stopCountdown();
        }
    }
}