Awro PRO
๐Ÿ“Ž 1 file 2,919 chars
๐Ÿ“„
pasted-code-1789982080893.txt
txt 43 lines
โ–ถ
Create a complete, production-ready Paper/Bukkit plugin for Minecraft 1.21.1 named "NotStableTeams".

Target Platform: Paper 1.21.1 (Java 21)
Main Package: pl.notstablesmp.teams
Main Class: NotStableTeams

Plugin Purpose:
A team management and camera-POV plugin built for recording Minecraft parody series. It assigns players to specific character teams with custom nametag/tab colors, while allowing content creators to toggle off colored nametags locally using an isolated scoreboard so their POV recordings stay clean.

Key Features & Specifications:

1. Preset Character Teams:
   - "wemmbu" -> Dark Purple color (&5 / ChatColor.DARK_PURPLE)
   - "parrot" -> Yellow color (&e / ChatColor.YELLOW)
   - "flame"  -> Red color (&c / ChatColor.RED)
   - "spoke"  -> Black / Dark Gray color (&0 / ChatColor.BLACK)
   - Teams must be registered on the main server Scoreboard (Bukkit.getScoreboardManager().getMainScoreboard()) on enable.
   - When a player joins a team, their entry should be added so their nametag above head and tablist reflect the team's native Minecraft glow/color.
   - Players can only be in ONE team at a time (joining another automatically removes them from the previous one).

2. Commands:
   a) /team join 
      - Permission: none (open to all players)
      - Adds sender to the chosen team and sends a confirmation message with the team's color.
   b) /team leave
      - Removes the sender from their current team and restores their standard white/default nametag.
   c) /teamnick 
      - Aliases: /teamnicks, /povnick
      - Designed for YouTubers/Recorders recording their POV:
        * When "/teamnick off" is executed: assign the player an isolated, newly generated Scoreboard (Bukkit.getScoreboardManager().getNewScoreboard()). This removes all team color prefixes/nametags exclusively from their screen, making all players appear with standard white names in their recording.
        * When "/teamnick on" is executed: restore the player's scoreboard back to the main server Scoreboard so they see everyone's colored team nametags again.
        * Remember this state per session, and handle PlayerJoinEvent appropriately (assign clean scoreboard if toggled off, or main scoreboard if default).

3. Tab Completion:
   - Provide clean TabCompleter for "/team" (suggesting "join", "leave") and "/team join" (suggesting the 4 teams).
   - Provide TabCompleter for "/teamnick" (suggesting "on", "off").

4. User Experience & Polish:
   - Clean color formatting in chat messages (using ChatColor or Adventure Component).
   - Provide clear error messages when an invalid team name or syntax is entered.
   - Full plugin.yml definition including name, main, version, api-version: '1.21', and registered commands with aliases.

Please write clean, well-structured, bug-free Java code ready to compile into a jar.
Kodari AI
KodariSep 21 at 9:16 am 1
NotStableTeams
Team management and camera-POV plugin for Minecraft parody recordings. Assigns players to preset character teams (wemmbu, parrot, flame, spoke) with custom nametag and tab colors via main scoreboard registration. Features /team join, /team leave, and /teamnick commands. The /teamnick toggle lets content creators isolate their view onto a fresh scoreboard, hiding colored nametags locally for clean POV footage while preserving team assignments. Handles player join events to restore per-session scoreboard preferences, includes tab completion for all commands, and provides polished chat feedback with team-colored confirmation messages.
  1. Create the Gradle build and Paper plugin metadata.

  2. Implement main-scoreboard team registration and membership management.

  3. Implement /team and /teamnick commands with tab completion.

  4. Add session-scoped POV scoreboard handling for joins and toggles.

Created the complete NotStableTeams Paper 1.21.1 plugin.

  • Added Gradle Java 21 build configuration and plugin.yml.

  • Added preset teams: wemmbu, parrot, flame, and spoke.

  • Implemented /team join, /team leave, and tab completion.

  • Implemented /teamnick on|off with aliases /teamnicks and /povnick.

  • Added isolated per-player scoreboards for clean POV nametags.

  • Added session-aware scoreboard restoration on player joins.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
9 389
src/main/java/pl/notstablesmp/teams/NotStableTeams.java
package pl.notstablesmp.teams;

import pl.notstablesmp.teams.commands.TeamCommand;
import pl.notstablesmp.teams.commands.TeamNickCommand;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;

public final class NotStableTeams extends JavaPlugin implements Listener {
    private TeamNickManager teamNickManager;

    @Override
    public void onEnable() {
        TeamManager teamManager = new TeamManager();
        teamManager.registerTeams();
        teamNickManager = new TeamNickManager();

        TeamCommand teamCommand = new TeamCommand(teamManager);
        TeamNickCommand teamNickCommand = new TeamNickCommand(teamNickManager);

        PluginCommand teamPluginCommand = getCommand("team");
        PluginCommand teamNickPluginCommand = getCommand("teamnick");
        if (teamPluginCommand == null || teamNickPluginCommand == null) {
            getLogger().severe("Required commands are missing from plugin.yml.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        teamPluginCommand.setExecutor(teamCommand);
        teamPluginCommand.setTabCompleter(teamCommand);
        teamNickPluginCommand.setExecutor(teamNickCommand);
        teamNickPluginCommand.setTabCompleter(teamNickCommand);

        Bukkit.getPluginManager().registerEvents(this, this);
        for (Player player : Bukkit.getOnlinePlayers()) {
            teamNickManager.applyForJoin(player);
        }
    }

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        teamNickManager.applyForJoin(event.getPlayer());
    }
}