notlazy.exe1
📎 1 file 13,090 chars
📄
pasted-code-1788107599994.txt
txt 509 lines
▶
Create a complete, production-ready Minecraft Paper plugin named "NTpa".

PLUGIN INFORMATION
- Plugin name: NTpa
- Version: 1.0.0
- Minecraft version: 1.21.11
- Server software: Paper
- Java: 21
- Build system: Maven
- Package name: use a clean package such as com.ntpa
- The plugin must compile successfully into a working .jar file.
- Do NOT create placeholder classes or unfinished methods.
- The final project must be ready to build and install on a Paper 1.21.11 server.

==================================================
COMMANDS
==================================================

PLAYER COMMANDS:

1. /tpa 
   - Send a teleport request to another online player.
   - If /tpa is used WITHOUT a player name, open a player-selection GUI.
   - The GUI should show online players that can receive a TPA request.
   - Clicking a player sends the TPA request.

2. /tpahere 
   - Send a teleport-here request to another player.
   - If used without a player name, open a player-selection GUI.
   - The target player will be asked to teleport to the requester.

3. /tpaccept
   - If there are pending TPA/TPAHere requests, open an Accept Request GUI.
   - The player can select which request to accept.
   - If appropriate, also support accepting the most recent request.
   - After accepting, start the teleport warmup.

4. /tpdeny
   - Open a pending-request GUI where the player can select a request to deny.
   - Also support denying the most recent request where appropriate.

5. /tpacancel
   - Cancel the player's outgoing pending TPA/TPAHere request.
   - If there are multiple outgoing requests, provide appropriate handling.

6. /back
   - Teleport the player to their last saved teleport/death location.
   - IMPORTANT:
     Movement after teleport MUST NOT update the /back location.
   - Example:
     Player is at Location A.
     Player teleports to Location B.
     Save Location A as /back.
     Player then walks 500 blocks from B.
     /back must still teleport them to Location A.
   - Store world, X, Y, Z, yaw and pitch.
   - Persist /back locations so they survive server restarts.
   - Handle player death appropriately so /back can return to the relevant previous location.
   - Do not continuously track player movement for /back.

7. /tpignore
   - Toggle whether the player accepts incoming TPA requests.
   - When enabled, incoming requests should be rejected/ignored with a configurable message.
   - State should be clearly shown to the player.

8. /tpatoggle
   - Toggle whether the player's TPA system is enabled.
   - When disabled, other players cannot send TPA/TPAHere requests to them.
   - Make the behavior configurable and clearly communicate the state.

==================================================
MAIN COMMAND
==================================================

/ntpa help
- Available to EVERYONE.
- No permission required.
- Display a clean, colorful list of available NTpa commands.

/ntpa info
- Available to EVERYONE.
- Show plugin name, version and basic information.

/ntpa reload
- ADMIN ONLY.
- Reload config.yml, messages.yml and gui.yml.
- Show success/failure messages.

Add:
- /ntpa as the main command.
- Tab completion for all NTpa commands and player names where appropriate.
- Clean command error handling.
- Proper permission checks.

==================================================
PERMISSIONS
==================================================

Normal player commands must work WITHOUT manually giving permissions.

Use these permissions:

ntpa.tpa       -> default: true
ntpa.tpahere   -> default: true
ntpa.accept    -> default: true
ntpa.deny      -> default: true
ntpa.cancel    -> default: true
ntpa.back      -> default: true
ntpa.ignore    -> default: true
ntpa.toggle    -> default: true
ntpa.help      -> default: true
ntpa.info      -> default: true

Admin:
ntpa.admin     -> default: op

/ntpa reload must require ntpa.admin.

Make permissions fully compatible with LuckPerms.

==================================================
TELEPORT SYSTEM
==================================================

Default teleport warmup:
3 seconds.

The warmup MUST be configurable in config.yml.

Example:

teleport:
  delay: 3

During the warmup:
- Display a countdown.
- If movement cancellation is enabled and the player moves, cancel teleport.
- If damage cancellation is enabled and the player takes damage, cancel teleport.
- Make these behaviors configurable.
- Do not cancel simply because the player rotates their camera unless configured otherwise.
- Prevent teleporting if the target becomes invalid/offline.
- Properly handle cross-world teleports.

Teleport request timeout must be configurable.

Example:

requests:
  timeout: 60

Add configurable cooldowns for:
- TPA
- TPAHere

Prevent spam and duplicate requests.

Prevent requesting yourself.

Handle:
- Target offline
- Target ignoring requests
- Target has TPA disabled
- Existing request
- Expired request
- Cancelled request
- Player disconnect
- Player death where appropriate

==================================================
/BACK SYSTEM
==================================================

Implement a proper persistent BackLocation system.

A BackLocation must contain:
- World name
- X
- Y
- Z
- Yaw
- Pitch

Save the previous location when a REAL teleport occurs.

Do NOT update /back continuously while the player walks.

For example:

Location A
   ↓
TP to Location B
   ↓
save A
   ↓
walk anywhere
   ↓
/back
   ↓
TP exactly to A

Also support saving an appropriate location before death so /back can return the player to their previous location.

Do not overwrite the saved location unnecessarily.

Make /back behavior configurable.

==================================================
GUI SYSTEM
==================================================

Create a complete GUI system.

The provided reference image represents the desired general style/layout for the request GUI.

Use attractive Minecraft inventory GUIs with:
- Clean layout
- Good spacing
- Colorful items
- Green for accept
- Red for deny/cancel
- Player heads where useful
- Informative lore
- Unicode symbols/emojis where Minecraft supports them
- Configurable titles
- Configurable size
- Configurable slots
- Configurable materials
- Configurable names
- Configurable lore
- Configurable filler items

GUI types:

1. TPA Player Selection GUI
   - Opened by /tpa without a player argument.
   - Show online players.
   - Clicking a player sends a TPA request.

2. TPAHere Player Selection GUI
   - Opened by /tpahere without a player argument.
   - Show online players.
   - Clicking a player sends a TPAHere request.

3. Accept Request GUI
   - Opened by /tpaccept.
   - Show pending requests.
   - Clicking a request accepts it and starts teleport warmup.

4. Deny Request GUI
   - Opened by /tpdeny.
   - Show pending requests.
   - Clicking a request denies it.

Add:
- Previous/Next page buttons for many players/requests.
- Close button.
- Empty-state display when there are no players/requests.
- Prevent players from taking GUI items.
- Prevent unwanted inventory interactions.
- Properly close/refresh GUI when request state changes.

==================================================
gui.yml
==================================================

ALL GUI customization must be possible through gui.yml.

Allow configuration of:

- GUI titles
- GUI sizes
- Player item material
- Player item name
- Player item lore
- Accept item
- Deny item
- Cancel item
- Close item
- Previous page
- Next page
- Filler/background items
- Slots
- Item amounts
- Item display names
- Item lore
- Sounds
- GUI messages if appropriate

Do not hard-code GUI design when it can reasonably be configurable.

==================================================
messages.yml
==================================================

ALL user-facing messages must be configurable in messages.yml.

Do NOT hard-code messages into Java.

Include configurable messages for:

- Prefix
- TPA sent
- TPA received
- TPAHere sent
- TPAHere received
- Request accepted
- Request denied
- Request cancelled
- Request expired
- Already requested
- Self request
- Player offline
- Player ignoring requests
- TPA disabled
- Teleport countdown
- Teleport started
- Teleport cancelled
- Movement cancellation
- Damage cancellation
- Cooldown
- /back success
- No /back location
- /back unavailable
- Reload success
- Reload failure
- Help
- Info
- No permission
- Invalid player
- GUI empty states
- Toggle states
- Ignore states

Support:
- Minecraft color codes (&a, &b, &c, etc.)
- Hex colors if Paper supports them cleanly
- Placeholder values such as {player}, {sender}, {target}, {seconds}, etc.
- Unicode symbols/emojis where supported

Make the default messages visually attractive.

==================================================
config.yml
==================================================

Put general behavior/settings in config.yml.

Include configurable options for:

- Teleport delay
- Request timeout
- TPA cooldown
- TPAHere cooldown
- Movement cancellation
- Damage cancellation
- Cross-world teleport
- /back enabled
- /back after death
- Request limits
- Duplicate request handling
- Sounds
- Particles if implemented
- Debug mode
- Data storage settings

Keep GUI-specific settings in gui.yml.
Keep messages in messages.yml.

==================================================
DATA STORAGE
==================================================

Use a reliable persistent storage system for:
- Back locations
- Any persistent player settings that need to survive restarts

SQLite is preferred for persistent player data if needed.

Do not lose player data on restart.

Use asynchronous database operations where appropriate without causing Bukkit/Paper API thread-safety problems.

==================================================
CODE QUALITY
==================================================

Use a clean architecture.

Suggested structure:

com.ntpa
├── NTpa.java
├── command
├── listener
├── manager
├── request
├── teleport
├── back
├── gui
├── config
├── storage
├── permission
└── util

Use:
- Proper managers/services
- Bukkit/Paper event listeners
- Clean request objects
- Proper task cancellation
- No memory leaks
- No unnecessary repeating tasks
- Null safety
- Thread-safe handling where needed
- Good error handling
- Clean comments for complex logic

Do not use NMS unless absolutely necessary.

Prefer Paper API.

==================================================
plugin.yml
==================================================

Create a correct plugin.yml with:

name: NTpa
version: 1.0.0
main: 
api-version: '1.21'

Register all commands and permissions correctly.

Commands:
- tpa
- tpahere
- tpaccept
- tpdeny
- tpacancel
- back
- tpignore
- tpatoggle
- ntpa

Make aliases only where useful and avoid command conflicts.

==================================================
DEPENDENCIES
==================================================

NTpa should work as a standalone Paper plugin.

Do NOT require Essentials, CMI, or another teleport plugin.

LuckPerms compatibility should be through Bukkit/Paper permission APIs, so LuckPerms can manage the permissions normally.

==================================================
MESSAGES / UI STYLE
==================================================

The plugin should have a polished modern Minecraft server style.

Use attractive colors and symbols.

Example style:

&8[&bNTpa&8] &a✓ &fTPA request sent to &b{player}&f!

&8[&bNTpa&8] &e⌛ &fTeleporting in &b{seconds}s&f...

&8[&bNTpa&8] &c✕ &fTeleport cancelled.

&8[&bNTpa&8] &a✔ &fTeleport successful!

Do not overuse emojis. Keep the design professional.

==================================================
BUILD REQUIREMENTS
==================================================

Generate the COMPLETE Maven project.

Include:
- pom.xml
- plugin.yml
- config.yml
- messages.yml
- gui.yml
- all Java source files
- README.md

The project MUST compile successfully using Java 21.

Before finishing:
1. Check all imports.
2. Check command registration.
3. Check permission registration.
4. Check plugin.yml.
5. Check all config paths.
6. Check all message paths.
7. Check GUI click handling.
8. Check teleport task cancellation.
9. Check player disconnect handling.
10. Check persistent /back storage.
11. Build the project and fix ALL compilation errors.

FINAL RESULT:
Provide a complete, working NTpa-1.0.0.jar-ready Maven project for Paper 1.21.11.
Do not leave TODOs, placeholders, fake implementations, or incomplete features.
Kodari AI
KodariAug 30 at 4:43 pm 3
NTpa
NTpa is a comprehensive teleport request plugin for Paper 1.21.11 with a polished GUI system. It provides /tpa, /tpahere, /tpaccept, /tpdeny, /tpacancel, /back, /tpignore, and /tpatoggle commands with configurable warmups, cooldowns, and timeouts. The plugin features four interactive GUIs for player selection and request management, persistent SQLite storage for back locations, fully configurable messages and GUI layouts via YAML files, and a main /ntpa command with help, info, and admin reload functionality. All player commands work without manual permission setup, and the system handles edge cases like offline targets, ignored requests, and movement cancellation during teleport warmup.

I’ll create the complete Maven project in one pass with the command, request, teleport, back-location, persistence, GUI, listener, and configuration layers wired together.

Created the complete NTpa Maven project with:

  • TPA/TPAHere request workflow

  • Accept, deny, and cancel commands

  • Configurable warmups, cooldowns, timeouts, movement/damage cancellation

  • Persistent /back locations and player settings

  • /tpignore and /tpatoggle

  • Configurable player/request GUIs with pagination

  • Configurable messages, GUI layouts, sounds, and behavior

  • Permission nodes compatible with LuckPerms

  • Command registration and tab completion

  • Paper 1.21.11 / Java 21 Maven configuration

  • README.md setup instructions

Build with:

Shell
mvn clean package

The resulting plugin jar will be:

Plain Text
target/NTpa-1.0.0.jar
notlazy.exe1
📎 1 file 3,088 chars
📄
pasted-code-1788109221338.txt
txt 139 lines
▶
Add/implement the following to the NTpa plugin:

==================================================
MESSAGES + CHAT DESIGN
==================================================

Make ALL player-facing messages polished, clean and professional.

Use a consistent NTpa style with:
- Beautiful colors
- Aqua/light-blue as the main NTpa theme
- Green for success/accept
- Red for deny/error
- Yellow for warnings/countdowns
- Gray/white for normal text
- Clean Unicode symbols such as ✔ ✖ ⚠ ⌛ ✦ ↩
- Proper spacing and formatting

Do NOT use boring messages like "[NTpa] Request sent."

ALL messages must be fully configurable through messages.yml.

Support:
- & color codes
- Hex colors
- Placeholders such as {player}, {sender}, {target}, {seconds}
- Multi-line messages
- Prefix customization

==================================================
CLICKABLE TPA CHAT
==================================================

When a player receives a TPA or TPAHere request, send a beautiful clickable chat message.

Example:

&8╭─ &b✦ NTpa &8────────────────
&8│ &b{player} &fwants to teleport to you.
&8│ &7Expires in &e{seconds}s&7.
&8│
&8│ &a✔ ACCEPT    &c✖ DENY
&8╰────────────────────────────

ACCEPT button:
- Green
- Fully clickable
- Accepts the correct pending request
- Has configurable hover text
- Must use a safe click action

DENY button:
- Red
- Fully clickable
- Denies the correct pending request
- Has configurable hover text
- Must use a safe click action

Both buttons, their text, colors, hover text and formatting must be configurable through messages.yml.

==================================================
SOUND SYSTEM
==================================================

Add a fully configurable sound system.

Every sound must support:
- Enabled/disabled
- Sound name
- Volume
- Pitch

ALL sounds must be configurable through config.yml.

Use these default sounds:

TPA request sent:
ENTITY_EXPERIENCE_ORB_PICKUP

TPA request received:
BLOCK_NOTE_BLOCK_PLING

TPAHere request sent:
ENTITY_EXPERIENCE_ORB_PICKUP

TPAHere request received:
BLOCK_NOTE_BLOCK_PLING

Request accepted:
ENTITY_PLAYER_LEVELUP

Request denied:
ENTITY_VILLAGER_NO

Request cancelled:
BLOCK_NOTE_BLOCK_BASS

Request expired:
BLOCK_NOTE_BLOCK_BASS

GUI opened:
BLOCK_CHEST_OPEN

GUI button clicked:
UI_BUTTON_CLICK

GUI page changed:
UI_BUTTON_CLICK

Teleport countdown:
BLOCK_NOTE_BLOCK_HAT

Teleport successful:
ENTITY_ENDERMAN_TELEPORT

/back successful:
ENTITY_ENDERMAN_TELEPORT

/back unavailable:
ENTITY_VILLAGER_NO

Teleport cancelled:
ENTITY_VILLAGER_NO

TPA enabled:
ENTITY_PLAYER_LEVELUP

TPA disabled:
BLOCK_NOTE_BLOCK_BASS

TPA ignore enabled:
ENTITY_PLAYER_LEVELUP

TPA ignore disabled:
BLOCK_NOTE_BLOCK_BASS

The teleport countdown should play the configured countdown sound during the 3-second warmup, followed by the Enderman teleport sound when teleportation succeeds.

If a configured sound is invalid, handle it safely without crashing the plugin.
Kodari AI
KodariAug 30 at 5:08 pm 5
  1. Refactor player-facing text into configurable messages.yml, including placeholders and clickable TPA actions.

  2. Add configurable, safely parsed sounds in config.yml and wire them into request, teleport, GUI, and toggle flows.

  3. Verify cross-file registrations and compatibility after the changes.

Task 1 is scoped to the request flow first: I’ll add component-based clickable request messages and UUID-validated accept/deny handling, while preserving the existing legacy/hex formatting.

  1. Clickable TPA chat: added configurable multiline layouts, hover text, safe UUID-specific /tpaccept and /tpdeny actions, and stale-request validation.

  2. Sound system: next I’ll replace the current shorthand sound lookup with per-sound enabled/name/volume/pitch settings and wire every requested event.

  3. Final consistency: inspect all sound call sites and patch only the required files.1. Clickable TPA chat is implemented.

  4. Sound system: I’m wiring distinct configurable sound keys for each requested event, including per-entry enable/name/volume/pitch and invalid-name safety.

  5. GUI and teleport flows will emit open/click/page/countdown/cancel/success sounds without changing their existing behavior.

  1. Clickable request chat and configurable message entries are in place.

  2. Configurable sound entries are wired for request lifecycle, GUI lifecycle, teleport lifecycle, /back, and both toggles.

  3. I’m doing the final symbol/path check now to catch any stale sound API calls or missing configuration keys.

Implemented the NTpa messaging and sound systems.

  1. Clickable TPA chat

    • Added configurable multiline request layouts in messages.yml.

    • Added configurable accept/deny button text, colors, spacing, and hover text.

    • Buttons execute UUID-specific /tpaccept <request-id> and /tpdeny <request-id>.

    • Stale or invalid request IDs are safely rejected.

    • Preserved legacy & and &#RRGGBB formatting.

  2. Configurable sounds

    • Added per-sound:

      • enabled

      • name

      • volume

      • pitch

    • Added sounds for:

      • TPA and TPAHere sent/received

      • Accept, deny, cancel, and expiry

      • GUI open, click, and page changes

      • Teleport countdown, success, and cancellation

      • /back success/unavailable

      • TPA and ignore toggles

    • Invalid sound names are ignored safely without crashing.

    • Countdown sounds play during the warmup, followed by the teleport success sound.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
22 1,194
src/main/java/com/ntpa/NTpa.java
package com.ntpa;

import com.ntpa.back.BackManager;
import com.ntpa.command.CommandHandler;
import com.ntpa.config.ConfigManager;
import com.ntpa.gui.GuiManager;
import com.ntpa.listener.NTpaListener;
import com.ntpa.request.RequestManager;
import com.ntpa.storage.StorageManager;
import com.ntpa.teleport.TeleportManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class NTpa extends JavaPlugin {
    private ConfigManager configManager;
    private StorageManager storageManager;
    private BackManager backManager;
    private RequestManager requestManager;
    private TeleportManager teleportManager;
    private GuiManager guiManager;
    private CommandHandler commandHandler;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        configManager = new ConfigManager(this);
        configManager.load();
        storageManager = new StorageManager(this);
        storageManager.load();
        backManager = new BackManager(this, storageManager);
        requestManager = new RequestManager(this, storageManager);
        teleportManager = new TeleportManager(this, backManager);
        guiManager = new GuiManager(this);
        commandHandler = new CommandHandler(this);

        NTpaListener listener = new NTpaListener(this);
        Bukkit.getPluginManager().registerEvents(listener, this);
        String[] commands = {"tpa", "tpahere", "tpaccept", "tpdeny", "tpacancel", "back", "tpignore", "tpatoggle", "ntpa"};
        for (String name : commands) {
            if (getCommand(name) != null) {
                getCommand(name).setExecutor(commandHandler);
                getCommand(name).setTabCompleter(commandHandler);
            }
        }
        Bukkit.getScheduler().runTaskTimer(this, requestManager::expireRequests, 20L, 20L);
    }

    @Override
    public void onDisable() {
        if (teleportManager != null) teleportManager.cancelAll();
        if (storageManager != null) storageManager.save();
    }

    public ConfigManager configManager() { return configManager; }
    public StorageManager storageManager() { return storageManager; }
    public BackManager backManager() { return backManager; }
    public RequestManager requestManager() { return requestManager; }
    public TeleportManager teleportManager() { return teleportManager; }
    public GuiManager guiManager() { return guiManager; }
}