9l_w2

Make me an chatgames plugin that will randomly ask a configurable question in the chat with a configurable answer. Whoever is the first person to answer it correctly receives a configurable reward. (Uses commands to give the reward). It should also play a configurable sound when it pops up in the chat and have configurable lines for each question. Users must also be able to configure what the correct answer is. And it should be configurable whenever a random chatgame starts, and how long it takes for a chatgame to end.

And when someone answers correctly, it should play a sound for everyone and the answer they sent should get a rainbow gradient, bold.

Whenever a chatgame ends, it should be sent in chat with a configurable message that the chatgame has ended and what the correct answer was This plugin must be optimised, the plugin name is Abchatgames and the author should be ActualBuca.

Kodari AI
KodariJun 25 at 1:13 pm 1

I’ll build a chat games plugin with all the requested features.

Abchatgames
An automated chat trivia plugin that randomly asks configurable questions in chat. Features include configurable questions with multiple acceptable answers, randomized intervals between games, configurable game duration, sound effects on question start and correct answers, command-based rewards, rainbow bold formatting for correct answers, and customizable end-of-game messages.

Let me create all the files:

9l_w2

Add hex code support for the config

Kodari AI
KodariJun 25 at 3:54 pm 1

Now I’ll create everything in one batch.

9l_w2

When someone gets a question right, it should say it in chat who won and what the answer was and how fast they got it in seconds

Kodari AI
KodariJun 25 at 4:16 pm 1

Now let me read the files to make precise patches

Now update GameManager to track timing and show speed:

Now update the config to include hex examples and the win message

Let me verify the final state of the key files:

Let me check the current config state:

The config has a correct-answer key already. Let me make GameManager use the configurable win message instead of hardcoding it

Now add the getter in ConfigManager:

Everything is in place. Here’s what was built:

Abchatgames by ActualBuca — complete plugin:

Files created/patched

File
Purpose
pom.xml
Maven project with Spigot API + XSeries
plugin.yml
Plugin metadata
config.yml
Full configuration with hex color examples
Abchatgames.java
Main plugin class (onEnable/onDisable)
ConfigManager.java
Loads questions, sounds, messages, rewards from config
ChatColorUtil.java
Translates
&#RRGGBB
hex codes + rainbow bold formatter
GameManager.java
Random scheduler, game loop, timing, rewards, broadcasts
ChatListener.java
Captures chat input during active game

Features

  • Random intervals — configurable min-interval / max-interval (seconds)

  • Configurable duration — duration in seconds per game

  • Multiple questions — each with its own chat lines + answers

  • Multiple answers per question (case-insensitive)

  • Hex color support — use &#RRGGBB anywhere in config messages/questions

  • Sound on question start — configurable via sounds.question-start

  • Sound on correct answer — configurable via sounds.correct-answer

  • Rainbow bold — the correct answer text in the win message becomes rainbow + bold

  • Winner announcement — shows PlayerName answered correctly with <rainbow answer> (1.2s)!

  • Configurable win message — uses %player%, %answer% (rainbow), %time%

  • Game-end message — broadcasts correct answer when time runs out

  • Command rewards — runs any console commands with %player% placeholder

  • Cancels winner’s chat — the winning message doesn’t appear normally in chat

9l_w2

add it in the current config

Kodari AI
KodariJun 25 at 4:17 pm 1

<kodariReadFile>src/main/resources/config.yml

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
8 517
src/main/java/com/actualbuca/abchatgames/Abchatgames.java
package com.actualbuca.abchatgames;

import com.actualbuca.abchatgames.config.ConfigManager;
import com.actualbuca.abchatgames.game.GameManager;
import com.actualbuca.abchatgames.game.ChatListener;
import org.bukkit.plugin.java.JavaPlugin;

public class Abchatgames extends JavaPlugin {

    private ConfigManager configManager;
    private GameManager gameManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        this.configManager = new ConfigManager(this);
        this.gameManager = new GameManager(this, configManager);
        getServer().getPluginManager().registerEvents(new ChatListener(gameManager), this);
        gameManager.startScheduler();
        getLogger().info("Abchatgames has been enabled!");
    }

    @Override
    public void onDisable() {
        if (gameManager != null) {
            gameManager.shutdown();
        }
        getLogger().info("Abchatgames has been disabled!");
    }

    public ConfigManager getConfigManager() {
        return configManager;
    }

    public GameManager getGameManager() {
        return gameManager;
    }
}