swiatelko boss
📎 1 file 1,779 chars
📄
pasted-code-1791816383032.txt
txt 20 lines
▶
Create a complete, production-ready Paper/Spigot Minecraft plugin for an Incognito Mode. ALL in-game messages sent to players and global chat must be in Polish.

Features to include:
1. Command /ukryty (aliases: /incognito, /inc) - toggles Incognito mode for the player who executes it.
2. When a player ENABLES incognito mode:
   - Generate a random nickname using the format "Blaze-XXXX" where XXXX is a random number between 100 and 999 (for example: Blaze-482, Blaze-109).
   - Change the player's display name, chat name, and tablist name to this newly generated random nickname.
   - Change the name tag above the player's head to match this random nickname.
   - Send a fake quit message to the global server chat using the player's real name in Polish: "[RealPlayerName] opuscil gre."
   - Send a private chat message to the player in Polish: "§aTryb Incognito zostal WLACZONY. Twoj tymczasowy nick to: Blaze-XXXX".
3. When a player DISABLES incognito mode:
   - Restore their original real name in chat, tablist, and above their head.
   - Send a fake join message to the global server chat using the player's real name in Polish: "[RealPlayerName] dolaczyl do gry."
   - Send a private chat message to the player in Polish: "§cTryb Incognito zostal WYLACZONY. Twoj prawdziwy nick jest ponownie widoczny."
4. If a player logs out while in Incognito mode, ensure their real name is restored upon their next login to prevent data corruption.
5. Permissions:
   - "incognito.use" to allow players to use the /ukryty command.

Please generate the complete source code, handle config files for custom messages, and compile it automatically into a working .jar file. Do not use placeholders or uncompleted methods. All text strings in the code must be in Polish as specified.
Kodari AI
KodariOct 12 at 2:48 pm 1
IncognitoModePlugin
Kompletny plugin Paper/Spigot do trybu incognito. Komenda /ukryty (aliasy: /incognito, /inc) przełącza tryb incognito dla gracza. Po włączeniu generuje losowy nick w formacie Blaze-XXX, zmienia nazwę gracza w czacie, tabliście i nad głową, wysyła fałszywą wiadomość o opuszczeniu gry. Po wyłączeniu przywraca prawdziwą nazwę i wysyła fałszywą wiadomość o dołączeniu. Przywraca prawdziwą nazwę po ponownym zalogowaniu. Wymaga uprawnienia incognito.use. Wszystkie wiadomości w języku polskim.

Stworzę plugin Incognito z komendą, konfiguracją polskich wiadomości i przywracaniem prawdziwej nazwy przy wyjściu, wejściu oraz wyłączeniu pluginu.

  1. Pliki Gradle i plugin.yml.

  2. Menedżer trybu z losowaniem nicku i przywracaniem nazwy.

  3. Komenda /ukryty, listener zdarzeń i polski config.yml.

Utworzyłem plugin Incognito z komendą /ukryty (aliasy /incognito, /inc), uprawnieniem incognito.use, polskimi wiadomościami konfigurowanymi w config.yml oraz przywracaniem prawdziwej nazwy po wyjściu, ponownym wejściu i wyłączeniu pluginu.

Aby pobrać plik .jar:

  1. Kliknij Compile na górnym pasku (na telefonie: ⋮ → Compile Project).

  2. W otwartym oknie kliknij Compile.

  3. Po udanym kompilowaniu kliknij Download przy buildzie.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
8 230
src/main/java/pl/kodari/incognito/IncognitoPlugin.java
package pl.kodari.incognito;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import pl.kodari.incognito.command.IncognitoCommand;
import pl.kodari.incognito.listener.IncognitoListener;
import pl.kodari.incognito.manager.IncognitoManager;

public final class IncognitoPlugin extends JavaPlugin {
    private IncognitoManager incognitoManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        incognitoManager = new IncognitoManager(this);
        getServer().getPluginManager().registerEvents(new IncognitoListener(incognitoManager), this);

        IncognitoCommand command = new IncognitoCommand(incognitoManager);
        if (getCommand("ukryty") != null) {
            getCommand("ukryty").setExecutor(command);
        }
    }

    @Override
    public void onDisable() {
        if (incognitoManager == null) {
            return;
        }

        for (Player player : Bukkit.getOnlinePlayers()) {
            incognitoManager.restore(player);
        }
    }
}