📄
pasted-code-1790706787249.txt
txt
36 lines
▶
Build a Paper (Minecraft 1.21.x) plugin in Java called UnstableTeams, packaged as a Maven project.
Core idea: players queue at a configured point, and — either automatically once enough players are queued, or via an admin command — the plugin rolls two distinct team identities from a pool, splits the queue into two even random groups, and sends each group to its own corner with a matching visual kit.
Queue system:
- /army join — teleports the sender to the configured queue point and adds them to the queue. If the queue point hasn't been set yet, fail with a clear, actionable message (e.g. "Queue point not set — an admin needs to configure it in /uteam admin") and don't teleport.
- /army leave — removes the sender from the queue (and, if a round is in progress for them, sends them to the configured spectator exit rather than leaving them stuck).
- The queue only ever tracks online players. If a queued player disconnects, remove them from the queue automatically (PlayerQuitEvent).
- /army queue — reports current queue size.
- /army reset — clears the queue and any in-progress team state (admin permission).
Team roll:
- Triggered either automatically once the queue reaches a configurable player-count threshold, or manually via /uteam roll (admin permission).
- Randomly pick two different identities from the configured pool. If the pool has fewer than two identities, refuse the roll with an actionable message, play no animation, and teleport nobody.
- Play a smooth, continuous center-screen Title animation that cycles between the pool's colors (no flicker/slot-machine feel), slowing down and settling — first for Team A, then for Team B — landing on two different identities.
- Split the queued players into two even random groups, one per rolled identity.
- Give each player a team kit matching their identity's color — dyed leather armor is the default kit, but make the kit itself configurable/customizable per identity (not hardcoded to just armor color).
- Teleport each group to its identity's configured corner (Corner A / Corner B).
- No identity name or label is ever shown to players — only the visual kit and which corner they land in.
Spectator handling:
- A configurable spectator exit location. When a round ends (hook point — leave this simple/stubbed since actual round logic isn't part of this build) or when a player runs /army leave mid-round, send them to this location. Include the config field and a utility method for it, wired up to /army leave.
Configuration and persistence:
- Persist all of the following in config.yml: the queue point, Corner A, Corner B, the spectator exit location, the identity pool (each identity = name + color), the team kit template per identity, and the auto-roll player-count threshold.
- All of this must reload correctly after a server restart.
- If config.yml is missing fields or has corrupted/invalid entries (e.g. an identity missing a color, a location pointing at a world that no longer exists), fail gracefully: log a clear warning naming the bad field, skip/ignore just that entry rather than crashing, and fall back to sensible defaults where possible.
Admin GUI (/uteam admin, permission-gated, chest-inventory menu):
- A main menu with clickable items for: "Set Queue Point", "Set Corner A", "Set Corner B", "Set Spectator Exit" — each click sets that location to wherever the admin is currently standing, with a confirmation message and updated item lore showing the saved coordinates.
- An "Identity Pool" item that opens a sub-menu listing every identity in the pool as its own item (colored wool or dyed item matching that identity's color). Clicking an existing identity opens options to recolor it or remove it from the pool. An "Add Identity" item lets the admin add a new one (e.g. cycles through a color picker, or opens sign/anvil input for the name — pick whichever is cleaner to implement).
- A "Set Auto-Roll Threshold" item that lets the admin increase/decrease the queue-size threshold with left/right click, showing the current value in the item's lore.
- All changes made through the GUI save to config.yml immediately, not just on menu close.
- Command handler and GUI listener are cleanly separated: AdminGUI implements InventoryHolder and has its own InventoryClickEvent listener that checks the clicked inventory's holder before acting, so it never intercepts clicks in unrelated inventories.
Structure it cleanly: separate classes for game state (GameManager), the roll animation (TeamRandomizer), the admin GUI (AdminGUI), config load/validation, and the command handler for both /army and /uteam, wired together in the main plugin class. Include plugin.yml with commands/permissions, and a pom.xml targeting the Paper API.
Set up the Maven/Paper project and validated persistent configuration.
Implement queue, team assignment, animated identity rolls, kits, and spectator handling.
Add
/armyand/uteamcommands plus the per-inventory admin GUI.
Created the UnstableTeams Maven plugin for Java 21 and Paper 1.21.4.
It includes the online-only queue, automatic and admin-triggered team rolls, animated color-only titles, randomized even team splits, configurable identity kits, corner teleports, and spectator-exit handling. /uteam admin provides location, identity, color, and threshold controls; GUI changes save immediately to config.yml.
Build with mvn package. I haven’t run a build or server test.
add theese teams called Null, Law, Cindercrest, Pirates, Mafia, Clowns Army and the theeme of them is Null is black. Law is yellow. Cindercrest is Red/orange and pirates is blue and mafia is grey and clowns army is red and the gear for team null is full netherite and flow armor trim with neth on them and make all the teams a gui customize their full kit for all teams
Add the six requested team identities with their colors and Null’s Netherite/Flow-trim kit as defaults.
Expand the admin GUI so every team’s full kit can be customized.
Added Null (black), Law (yellow), Cindercrest (red-orange), Pirates (blue), Mafia (gray), and Clowns Army (red). Null defaults to full Netherite armor with Flow trims using Netherite trim material. Existing installs migrate from the old stock teams to these defaults.
Added a kit editor for every team: customize four armor pieces and nine additional kit slots, cycle materials, adjust item amounts, set armor trims, or clear a slot. Each change saves immediately to
config.yml.
add so you can customize to add more roles for each team with how many can get it and what chance to get it and what kit that guy gets like just add a plus there and do it for all teams
Add persistent per-team roles with capacity, chance, and independent kits.
Add a + Add Role action and role settings/kit editor for every team.
Assign roles during rolls while honoring per-team capacities and configured chances.
Added team-specific roles to every team in /uteam admin → select a team → Manage Roles → + Add Role. Each role has a configurable player limit, chance (0–100%), and its own editable kit; it starts with a copy of that team’s kit, and changes save to config.yml.
During a roll, roles are assigned within their team’s player limit. If multiple roles pass their chance roll, one is chosen randomly; if none pass, the player gets the team’s default kit.
make so it shows when you queue it shows above your hotbar how many are in a queue and make sound effects for all like when it rolls teams etc
Show the current queue count above the hotbar while queued.
Add sound effects to team rolls and related queue/game events.
Queued players now see “In queue: [count]” above the hotbar, refreshed every second.
Added sounds for joining/leaving the queue, starting and animating a team roll, and receiving a team or role.
make so you can edit the kits with what you have in your inventroy and so you can customize the whole kit not just hotbar but inventory and ofhand
Plan:
Add an inventory-import action to team and role kit editors, capturing storage, armor, and offhand.
Persist complete item stacks so names, enchants, trims, and other metadata are retained.
Equip the saved slots exactly when a player receives the kit.
Added Use Your Inventory as Kit to both team and role kit editors. It copies all 36 storage slots, armor, and offhand, preserving item metadata such as names and enchantments. When the kit is assigned, it replaces the player’s inventory with those saved contents.
Prepare your inventory, open the kit editor, then click the new button to save it.
also add so it is one defualt role that is deafult but you can still get the others
Plan:
Add one designated default role per team, preserving it through config edits and removals.
Make non-default roles chance-rollable, then fall back to the default role.
Mark the default role in the admin GUI and make it selectable/replacable.
Each team now starts with one Default role using the team’s kit. Other roles still roll by their configured chances; if none are selected, players get the default role. In Manage Roles, the role menu marks the current default and lets you assign a different role as default. The default role’s chance isn’t rolled, and each role’s player limit still applies.
make so when it rolls it says your team so you see your like say the full animation is diffrent for each player as the peple on that team it says yours and for others it says the other team and under the team rolling and add the names i told you and make the roll slowerd and make so people on the same team cant kill each other but people on other teams can
Update the roll animation to show each player their own team as “Yours,” show other teams underneath, and slow the roll.
Prevent damage between teammates while allowing combat across teams.
Slowed the roll animation and now shows the rolling team’s configured name. Each player sees YOURS beneath their assigned team and Other team beneath the opposing team.
Teammates can no longer damage each other directly or with projectiles; combat between different teams remains enabled.
also make so when you leave you go in spectator
Plan:
Set players to spectator in the existing exit handler.
Keep the configured spectator-exit teleport for round exits and active players leaving.
Players who leave an active team assignment or exit a round are now put in Spectator mode and teleported to the configured spectator exit.
make the animation look better
Add a per-player progress bar and clearer “YOURS”/opponent styling during each roll.
Give the reveal frames a distinct title treatment and sound cue.
The team roll now has a colored progress bar, more polished team titles, clear YOURS / Other team labels, and a distinct chime on each reveal.
and also make so if you die it says YOU DIED in the middle of your screen for 1s and ake the same if you do /army leave and make so in the config its cmd you cant do while in a match
Plan:
Show a one-second “YOU DIED” title on death and
/army leave.Add configurable commands that players cannot use during a match.
Deaths and successful
/army leavenow show YOU DIED centered on screen for one second.Added
blocked-commands-in-matchtoconfig.yml. Add command names to the list (for example,- spawnand- home) to block them for players in a match.
make so that if one team dies they get tpd back
Track deaths for each assigned team and mark a team eliminated when all its members have died.
Send eliminated players to the configured spectator exit when they respawn; non-eliminated players can respawn normally.
When every player on a team has died, that team is eliminated. Its players are sent to the configured spectator exit and switched to Spectator mode when they respawn; players on teams that haven’t been eliminated respawn normally.
dont remove the teams
Keep each player’s team assignment after a team wipe.
Send wiped players to the configured exit on respawn without switching them to spectator.
Players on a wiped team are still teleported to the configured exit when they respawn, but they stay in their team and remain in their current game mode instead of becoming spectators.
i mean like keep all teams in the pool and make so its 2 separete rolls for them so one says above your team and for the other player it says other team and make so it is only 2 teams that get picked but you can get all of the teams
Plan:
Roll exactly two distinct teams from the full configured team pool.
Show each player a personalized roll: “Your team” above their assigned team and “Other team” above the opposing team.
Each match already randomly selects exactly two distinct teams from the full configured team pool. Updated the roll so each player sees YOUR TEAM above their assigned team first, then OTHER TEAM above the opposing team; players on the same team see the same personalized order.
give a selection in the roll of like all the teams and then the first roll just says your team but not at the actual team you get just like info on what th eroll lands on is about and also add team Null and make so when you import a kit form your inv it takes the enchants and trims and all info and the whole inventory not just hotbar and armor all of it
Update the roll to cycle through all available teams, then reveal only “Your team” with a brief explanation before the actual assignment.
Add Null to the available team pool.
Fix kit import to copy the full inventory and preserve item metadata, including enchantments and trims.
The roll now cycles through every configured team in both phases, with YOUR TEAM above the first roll and OTHER TEAM above the opposing roll. It reveals the assigned team when each roll lands.
Null is available in the team pool. Existing configs are upgraded to add it without restoring other teams players may have removed.
Kit import already saves all 36 storage slots, armor, offhand, and the complete item stacks, preserving metadata such as enchantments and trims.
add the team called Null to identety pool and to the roll and make it so that when each team is displayed after both are revealed it say (team VS (team) team just means like what that team gets
Add Null to the identity pool and the team-roll selections.
After both reveals, show a match summary in the form “(what Team A gets) VS (what Team B gets).”
Added Null to the default identity pool and updated config migration so existing configs missing it pick it up. Since the roll uses the identity pool, Null can now be selected.
After both reveals, players see a matchup title: [Your team] VS [Other team].
Add team null it does not mean nothing its just like a other team but it does not show up make it show up
Plan:
Use a non-reserved identity key for the Null team and quote it in YAML.
Bump the defaults migration so existing configs receive it in the roll pool.
Fixed the Null team’s identity key to null-team, avoiding YAML’s reserved null value. Existing configs are migrated to add it to the identity pool, where it can appear in the roll.
make diffrent sound effects
The two roll phases now have distinct sounds: the “Your team” roll uses a ticking sound and chime reveal; the “Other team” roll uses a different tick and level-up reveal.
The null stil does not work just call it The Null
Plan:
Rename the configured display name to The Null.
Migrate existing configs so the team appears with that name in rolls too.
Renamed the team to The Null and updated config migration so existing servers use that name in the roll. The identity remains in the team pool under its existing null-team key.
also add when one team wins it shows like big text at the middle of their screen what team won and then tp them to a area you choose with /uteam admin
Add a prominent winner title when a team wins.
Add an admin-configurable post-win teleport area through
/uteam admin.
When a team wins, all match participants see a large centered “[Team] WINS!” title and are sent to the post-win location. Dead participants are sent there when they respawn.
Set the destination by standing in the desired spot and clicking Set Post-Win Location in /uteam admin.
add a 3s cooldown after the text and make so they cant do /army join when it has started if they are a part of a team but if somone that is not apart of a team does it they auto spectate it at the same area you tp to when spectating while dead
Add a 3-second pause after the winner title before post-win teleport.
Block
/army joinfor existing team members once a match starts; send non-team players into spectator mode at the dead-player spectator location.
Winner title now stays on screen for 3 seconds before the post-win teleport, including for players who respawn after the round ends.
During an active match,
/army joinis denied to players already on a team. Other players are sent to spectator mode at the configured dead-player spectator location.
make all the msgs you get in chat more fancy
Plan:
Add one styled prefix helper for player-facing chat.
Route every chat message through it; leave titles and action bars unchanged.
Added a styled ✦ UNSTABLE TEAMS ✦ prefix to player-facing chat messages from commands, gameplay, and the admin menu. Titles and action bars are unchanged.
No make the prefix Unstable Revived
Changed the chat prefix to UNSTABLE REVIVED.
make so after the roll it gives each team 5 seconds to do their inventory or make it custom in the uteam
Plan:
Add a configurable inventory-prep duration, defaulting to 5 seconds, with a 0–60 second control in
/uteam admin.Show the countdown after the roll and prevent damage until it ends.
Added a 5-second inventory-prep countdown after the team roll. Players see the timer in their action bar and can’t take or deal damage until it ends.
In /uteam admin, left/right-click Inventory Prep Time to adjust it from 0 to 60 seconds; set it to 0 to disable.
and also add so it actully works to give a entire inventory as a kit for the teams and make so you dont need to do from inventory and make so it actully copies the enchants over so it copies names and enchants of the kits
Trace how team kits are configured, saved, and applied.
Make team kits configurable without relying on an inventory snapshot, while preserving item names and enchantments when kits are copied and given.
Expanded the /uteam admin kit editor to show all 36 storage slots, armor, and offhand. You can build kits directly in the editor without copying your whole inventory; optionally place an item on your cursor to copy it with its custom name, lore, and enchantments. Full-inventory copying remains available as an optional shortcut.
make so it actullly works from the kit editor and make it so it works when that gets rolled
Fix kit editor changes so they save correctly.
Ensure the saved team kit is applied when that team is rolled.
Kit editor now saves items dragged into its slots and preserves item metadata when changing amounts or armor trims.
Checking the roll-to-kit application path next.
The kit editor now saves items dragged into slots and preserves names, lore, enchantments, and other metadata when changing amounts or armor trims.
Team-kit edits now update existing role kits too, so players receive the edited kit when that team and any of its roles are rolled. You can still customize individual roles afterward.
make so i can change how many people can get a certian role for a team and make so if i make a new team it auto shows up in the roll so when i make a new one it goes on the roll animation
Trace role limits and add an admin control for how many players can roll into each role.
Make newly created teams automatically appear in the roll selection and animation.
Per-role player limits are already configurable in
/uteam admin→ Identity Pool → team → Manage Roles → role → Maximum Players (up to 64).Updated the roll animation to include an extra candidate frame, so every configured team—including newly created ones—appears in each roll cycle before the result reveal.
package com.kodari.unstableteams;
import com.kodari.unstableteams.command.CommandHandler;
import com.kodari.unstableteams.config.ConfigManager;
import com.kodari.unstableteams.game.GameListener;
import com.kodari.unstableteams.game.GameManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.Objects;
public final class UnstableTeamsPlugin extends JavaPlugin {
private ConfigManager configManager;
private GameManager gameManager;
@Override
public void onEnable() {
saveDefaultConfig();
configManager = new ConfigManager(this);
gameManager = new GameManager(this, configManager);
Bukkit.getPluginManager().registerEvents(new GameListener(gameManager), this);
CommandHandler commandHandler = new CommandHandler(this, gameManager);
Objects.requireNonNull(getCommand("army")).setExecutor(commandHandler);
Objects.requireNonNull(getCommand("army")).setTabCompleter(commandHandler);
Objects.requireNonNull(getCommand("uteam")).setExecutor(commandHandler);
Objects.requireNonNull(getCommand("uteam")).setTabCompleter(commandHandler);
}
@Override
public void onDisable() {
if (gameManager != null) {
gameManager.shutdown();
}
}
public ConfigManager configManager() {
return configManager;
}
public GameManager gameManager() {
return gameManager;
}
}