kirat017
📎 1 file 2,886 chars
📄
pasted-code-1788105047895.txt
txt 98 lines
▶
Act as an expert Java Minecraft Paper plugin developer. Create a complete and fully working plugin for **Paper 1.21.11** with **Java 21**.

## Plugin Features

### 1. Nickname / Name Tag System

Command:

`/nickname set  `

Example:

`/nickname set Kirat Steve`

Requirements:

* Change the target player's **in-game name tag above their head**.
* The new name should also appear in the **TAB player list**.
* The name should appear in **chat messages**.
* Support Minecraft color codes and formatting using `&` codes.
* Support online players.
* The nickname should remain saved after server restart.
* Use a configurable prefix/suffix if needed.
* Handle spaces in names where possible using quotes or command parsing.

### 2. Skin Changer

#### Change skin using a Minecraft IGN

Command:

`/cloth set  `

Example:

`/cloth set Dream Steve`

Requirements:

* Fetch the skin of the specified Minecraft player/IGN.
* Apply that skin to the target player.
* The new skin must be visible to **all players**, not only the target player.
* Automatically refresh the target player's skin for other clients.
* The skin should persist after server restart.
* Use an appropriate Mojang/Minecraft profile API to retrieve the skin texture and signature.

### 3. Skin Command Using URL

Command:

`/cloth url  `

Requirements:

* Apply a skin to the target player using the provided skin image URL.
* Support valid Minecraft skin texture images.
* Make the skin visible to all online players.
* Refresh the player model immediately after changing the skin.
* Save the custom skin URL so it persists after restart.
* Validate the URL and display an error for invalid skin links.

## Permissions

* `nickname.set`
* `cloth.set`
* `cloth.url`

Only players or console with the correct permission should be able to use the commands.

## Technical Requirements

* **Server:** Paper 1.21.11
* **Language:** Java
* **Java Version:** 21
* Do not use Citizens.
* Do not require any external plugin dependency unless absolutely necessary.
* Implement the system using supported Paper APIs and proper packet/profile handling where required.
* All player changes must synchronize correctly for every player.
* Include proper error handling and messages.
* Do not use placeholder or pseudo code.
* Generate **complete, compilable source code**.

## Required Project Files

Generate the complete project structure, including:

* `src/main/java/.../Main.java`
* `NicknameManager.java`
* `SkinManager.java`
* `NicknameCommand.java`
* `ClothCommand.java`
* Player data storage classes
* `plugin.yml`
* `config.yml`
* `pom.xml` or `build.gradle`

Make sure all imports are correct for **Paper 1.21.11**, and verify that the code does not use deprecated APIs or APIs from older Minecraft versions that would cause compilation errors.
Kodari AI
KodariAug 30 at 3:59 pm 3
NickSkinManager
A comprehensive Paper plugin providing nickname and skin management systems. Features include a nickname command that changes player name tags, TAB list entries, and chat messages with color code support and persistent storage. Includes a skin changer with two modes: fetching skins from Minecraft IGNs via Mojang API and applying custom skin URLs, both visible to all players with automatic refresh and persistence. Commands include /nickname set and /cloth set/url with proper permission checks. Uses modern Paper APIs for profile handling and packet-based skin updates, with configurable messages and complete error handling.
  1. Create the Maven Paper 1.21.11 project and plugin metadata.

  2. Add persistent player data storage plus nickname rendering and chat integration.

  3. Add Mojang-profile and URL skin handling with client refresh and restart persistence.

  4. Register commands, permissions, join/quit lifecycle handling, and configuration messages.

One compile issue is in the URL-skin exception clause: IllegalArgumentException is already a RuntimeException, so the multi-catch is invalid.Created the complete Paper 1.21.11 / Java 21 plugin project with:

  • Persistent nickname storage in players.yml

  • Colored nicknames for nametags, TAB, and chat

  • Custom above-head TextDisplay nametag rendering

  • Mojang IGN skin lookup

  • URL skin validation for 64×64 and 64×32 images

  • Skin persistence and viewer refresh

  • /nickname set <nametag> <target-player>

  • /cloth set <skin-ign> <target-player>

  • /cloth url <skin-url> <target-player>

  • Configurable prefix, suffix, height, and messages

  • Permissions:

    • nickname.set

    • cloth.set

    • cloth.url

  • Maven configuration for Paper 1.21.11 and Java 21

  • Command tab completion and online-player validation

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
11 922
src/main/java/com/kodari/nicknamecloth/Main.java
package com.kodari.nicknamecloth;

import com.kodari.nicknamecloth.command.ClothCommand;
import com.kodari.nicknamecloth.command.NicknameCommand;
import com.kodari.nicknamecloth.data.PlayerDataStorage;
import com.kodari.nicknamecloth.listener.PlayerListener;
import com.kodari.nicknamecloth.nickname.NicknameManager;
import com.kodari.nicknamecloth.skin.SkinManager;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class Main extends JavaPlugin {
    private PlayerDataStorage playerDataStorage;
    private NicknameManager nicknameManager;
    private SkinManager skinManager;

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

        this.playerDataStorage = new PlayerDataStorage(this);
        this.nicknameManager = new NicknameManager(this, playerDataStorage);
        this.skinManager = new SkinManager(this, playerDataStorage);

        NicknameCommand nicknameCommand = new NicknameCommand(this);
        PluginCommand nickname = getCommand("nickname");
        if (nickname != null) {
            nickname.setExecutor(nicknameCommand);
            nickname.setTabCompleter(nicknameCommand);
        }

        ClothCommand clothCommand = new ClothCommand(this);
        PluginCommand cloth = getCommand("cloth");
        if (cloth != null) {
            cloth.setExecutor(clothCommand);
            cloth.setTabCompleter(clothCommand);
        }

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

        for (org.bukkit.entity.Player player : Bukkit.getOnlinePlayers()) {
            nicknameManager.applyStoredNickname(player);
            skinManager.applyStoredSkin(player);
        }
    }

    @Override
    public void onDisable() {
        if (nicknameManager != null) {
            nicknameManager.shutdown();
        }
        if (playerDataStorage != null) {
            playerDataStorage.saveAll();
        }
    }

    public PlayerDataStorage getPlayerDataStorage() {
        return playerDataStorage;
    }

    public NicknameManager getNicknameManager() {
        return nicknameManager;
    }

    public SkinManager getSkinManager() {
        return skinManager;
    }
}