itz_anonymous456

Add these commands to the Minecraft Battle Royale plugin:

/br start <time>

Starts the Battle Royale event.

Randomly teleport all players inside the WorldBorder.

After teleporting, freeze all players so they cannot move.

Start a countdown timer using the <time> value.

Show countdown animations/titles and play sounds during the countdown.

When the timer ends, unfreeze all players so they can move and fight.

During the event:

If a player dies after the event starts:

Set them to Spectator mode.

If a dead player rejoins:

Keep them in Spectator mode.

/br end

Ends the Battle Royale event.

Set all players back to Survival mode.

Unfreeze everyone.

Stop all event systems/timers.

Reset the event cleanly.

Additional requirements:

Only OPs can use all /br commands.

Use clean and optimized Paper/Spigot API code.

Support multiplayer correctly.

Include sounds, titles, and smooth countdown effects.

Make the system expandable for future Battle Royale features.

Kodari AI
KodariMay 28 at 6:16 am 10
BattleRoyalePlugin
A Minecraft Battle Royale event plugin with full game lifecycle management. Features include random player teleportation within the WorldBorder, freeze mechanics during countdown, animated title/sound countdowns, automatic spectator mode on death, persistent spectator state on rejoin, and clean event reset. Supports OP-only commands (/br start, /br end) with expandable architecture for future Battle Royale features.

Here’s the full plugin structure I’ll build:

  • BattleRoyalePlugin.java — main class, wires everything together

  • manager/GameManager.java — core game state, freeze logic, spectator tracking

  • manager/CountdownManager.java — animated countdown with titles/sounds

  • listener/PlayerListener.java — death → spectator, rejoin → spectator

  • command/BRCommand.java — /br start <time> and /br end

  • plugin.yml + config.yml


Here’s a summary of what was built:

Files created (7):

File
Purpose
BattleRoyalePlugin.java
Main class — wires managers, registers events/commands
model/GameState.java
IDLE
/
COUNTDOWN
/
RUNNING
enum
manager/GameManager.java
Teleport, freeze/unfreeze, death→spectator, rejoin restore, end/reset
manager/CountdownManager.java
Per-second BukkitTask with titles, action bar, progress bar, sounds
listener/PlayerListener.java
Death event, join event, movement cancel for frozen players
command/BRCommand.java
/br start <time>
and
/br end
with tab completion
plugin.yml
Command registration

Key design decisions:

  • Freeze uses Slowness 255 + Jump Boost 250 + Blindness via potions, plus PlayerMoveEvent cancellation for a bulletproof lock

  • Countdown ticks play louder/faster sounds in the final 5 seconds; sounds every 5s for long countdowns to avoid spam

  • Dead players are tracked by UUID so rejoining mid-game correctly restores spectator mode

  • /br end cancels the countdown task, restores all players to Survival, and clears all state cleanly

  • Expandable: add new GameState values, new commands, or new managers without touching existing logic

itz_anonymous456

ommand: /br announce <color>

Requirements:

Only OPs can use the command.

Show an advancement-style toast to all online players.

Title: Battle Royale Event Description: The event is starting soon!

Use a Nether Star icon.

Validate colors: red, gold, green, blue, purple.

Send an error for invalid colors.

Use clean, optimized code with separate classes and include plugin.yml.

Kodari AI
KodariMay 28 at 6:18 am 11

Plan:

  1. Create util/ColorUtil.java — MiniMessage helper

  2. Create util/ToastUtil.java — advancement toast sender

  3. Add announce subcommand to BRCommand.java (new case + handler + tab completion)

  4. Update plugin.yml usage line


Now patch BRCommand.java to add the announce subcommand:

Now create the two utility classes:

Here’s what was added:

New files:

File
Purpose
util/ColorUtil.java
MiniMessage wrapper —
colorize(String)
→
Component
util/ToastUtil.java
Registers a temporary advancement, grants it to show the toast, then revokes + unregisters it 1 tick later leaving zero trace

BRCommand.java changes:

  • Added handleAnnounce() — validates the color, maps purple → <light_purple> (MiniMessage has no <purple>), builds title/description components, fires the toast

  • VALID_COLORS set + COLOR_TAG map for clean validation and mapping

  • Tab completion now suggests all 5 colors for /br announce <TAB>

  • sendUsage() lists the new command

How the toast works: The advancement JSON is built with "trigger":"minecraft:impossible" so it can never be earned naturally. It’s registered via Bukkit.getUnsafe().loadAdvancement(), immediately granted to all players (which fires the toast client-side), then revoked and unregistered one tick later — players never see it in their advancement screen.

itz_anonymous456

Fix the plugin

Kodari AI
KodariMay 28 at 8:13 am 185

Let me look at the current state of the files before diagnosing anything.

Found all the issues. Here’s what’s broken:

  1. build.gradle — Uses spigot-api but the code uses Paper-only APIs (sendActionBar, sendTitle with Adventure, MiniMessage, Component). Must switch to paper-api. Also missing adventure-text-serializer-gson dependency (used in ToastUtil).

  2. plugin.yml — api-version: 1.13 is too old; Paper/Adventure APIs require at minimum 1.20.

  3. GameManager.java — PotionEffectType.JUMP_BOOST was renamed to JUMP in newer Paper/Spigot versions. Must use XSeries.

  4. CountdownManager.java — player.sendActionBar(String) is deprecated/removed on Paper; must use player.sendActionBar(Component).

  5. ToastUtil.java — icon JSON format changed in 1.20.5+; {"id":"minecraft:nether_star"} needs "count":1 and the advancement JSON needs "parent" or "requirements" field to be valid on newer Paper. Also Bukkit.getUnsafe().loadAdvancement is deprecated — must use Bukkit.getUnsafe().loadAdvancement(key, json) which still works but the JSON structure must be correct.

  6. GameManager.java — player.sendTitle(String, String, int, int, int) is deprecated on Paper; should use Adventure Component titles.

Now fix GameManager.java — replace deprecated sendTitle(String...) with Adventure Component titles, and fix JUMP_BOOST → XSeries-safe potion handling:

Now fix CountdownManager.java — replace deprecated sendActionBar(String) and sendTitle(String...) with Adventure equivalents:The file has special characters that didn’t survive the round-trip. Let me rewrite CountdownManager.java completely since the content is garbled:

Now fix GameManager.java — remove the unused ChatColor import since we switched to Adventure titles:

Good — GameManager.java imports look correct. Now check the ChatColor usage still in GameManager (the broadcastMessage calls):

ChatColor is still used in GameManager but the import was removed. Need to add it back:

Now fix ToastUtil.java — the icon JSON format changed in 1.20.5+ (needs "components" wrapper) and the advancement JSON needs a "requirements" field to be valid:

All fixes applied. Here’s a summary of every issue that was fixed:

#
File
Problem
Fix
1
build.gradle
Used
spigot-api
— missing Paper-only APIs (
Component
,
Title
,
sendActionBar
, MiniMessage)
Switched to
paper-api:1.20.4
with Paper Maven repo
2
plugin.yml
api-version: 1.13
— too old, Paper rejects Adventure API usage
Updated to
api-version: '1.20'
3
GameManager.java
PotionEffectType.JUMP_BOOST
— renamed to
JUMP
in 1.20.5, causes
NoSuchFieldError
Replaced with
XPotion.matchXPotion("JUMP")
for cross-version safety
4
GameManager.java
player.sendTitle(String, String, int, int, int)
— deprecated/removed on Paper
Replaced with
player.showTitle(Title.title(Component...))
5
CountdownManager.java
player.sendTitle(String...)
+
player.sendActionBar(String)
— both removed on Paper
Full rewrite to Adventure
Title.title(Component...)
+
sendActionBar(Component)
6
CountdownManager.java
buildProgressBar
returned
String
with
ChatColor
codes — incompatible with Adventure subtitle
Component
Returns
Component
built with
NamedTextColor
7
ToastUtil.java
Advancement JSON missing
"requirements"
field + icon missing
"count"
— invalid on 1.20.4+ Paper
Added
"requirements":[[\"trigger\"]]
and
"count":1
to icon object
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
11 793
src/main/java/com/kodari/battleroyale/BattleRoyalePlugin.java
package com.kodari.battleroyale;

import com.kodari.battleroyale.command.BRCommand;
import com.kodari.battleroyale.listener.PlayerListener;
import com.kodari.battleroyale.manager.CountdownManager;
import com.kodari.battleroyale.manager.GameManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

public class BattleRoyalePlugin extends JavaPlugin {

    @Getter
    private GameManager gameManager;
    @Getter
    private CountdownManager countdownManager;

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

        this.gameManager = new GameManager(this);
        this.countdownManager = new CountdownManager(this);

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

        BRCommand brCommand = new BRCommand(this);
        getCommand("br").setExecutor(brCommand);
        getCommand("br").setTabCompleter(brCommand);

        getLogger().info("BattleRoyale has been enabled.");
    }

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