kallu jasus
📎 1 file 5,700 chars
📄
pasted-code-1790573449759.txt
txt 191 lines
▶
You are an expert Minecraft Spigot/Paper plugin developer.

Create a fully functional Minecraft plugin named **WildRTP** with a beautiful, modern GUI-based Random Teleport (RTP) system.

### 1. Core Concept

Players should be able to use `/rtp` to open a fancy inventory GUI where they can select which world they want to randomly teleport to.

My server uses **Multiverse-Core** and contains multiple worlds, such as:

* world
* world_nether
* world_the_end
* survival
* resource
* lifesteal
* events

The plugin must support multiple worlds without hardcoding world names.

### 2. GUI Design

Create a visually appealing inventory GUI using Bukkit Inventory API.

Main GUI:

* Title: `&8✦ &6WILD RTP &8» &fWorld Selector`
* Size: 54 slots (6 rows)
* Custom decorative glass panes around the menu.
* Each world should have its own selectable item.
* Use configurable materials for each world.
* Display world name, environment, player count, and teleport status in item lore.
* Add custom model data support.
* Add a close button.
* Add a refresh button.
* Add a back button if submenus are used.

Example world item:

`&6✦ Survival World`
`&7Click to teleport randomly!`
`` `&fEnvironment: &aNORMAL` `&fPlayers: &e12` `&fStatus: &aAvailable` ``
`&e➜ Click to select`

### 3. World Selection

* Automatically detect worlds loaded by Bukkit/Multiverse-Core.
* Allow administrators to enable or disable specific worlds in config.yml.
* Players must only see enabled worlds.
* Support NORMAL, NETHER, and THE_END environments.
* Allow custom display names and icons for every world.
* Never teleport players into unloaded or invalid worlds.
* If a world is unavailable, show a configurable error message.

### 4. Random Teleport System

After selecting a world:

1. Close the GUI.
2. Show a teleporting message.
3. Play configurable teleport sound and particle effects.
4. Find a random safe location within configured boundaries.
5. Teleport the player to the location.
6. Display coordinates and world name.
7. Apply configurable cooldown.

Safety requirements:

* Avoid lava, fire, cactus, magma blocks, and dangerous blocks.
* Check for solid ground.
* Ensure enough air space for the player.
* Avoid water if disabled in config.
* Support configurable minimum and maximum X/Z coordinates.
* Support world border restrictions.
* Support configurable minimum and maximum Y levels.
* Handle Nether roof restrictions.
* Use asynchronous chunk loading where supported, but perform Bukkit world operations safely on the main thread.
* Prevent players from being teleported into unloaded chunks or unsafe locations.
* Include a maximum number of location attempts to prevent infinite loops.

### 5. Commands

`/rtp` - Open world selection GUI
`/rtp reload` - Reload configuration
`/rtp ` - Direct teleport to a specific enabled world
`/wildrtp` - Alias for /rtp

### 6. Permissions

* wildrtp.use
* wildrtp.world.
* wildrtp.cooldown.bypass
* wildrtp.admin
* wildrtp.reload

Allow administrators to configure which permissions are required for each world.

### 7. Configuration

Generate a fully documented config.yml.

Example:

```yaml
settings:
  cooldown: 60
  max-attempts: 50
  teleport-delay: 3
  prevent-movement: true
  require-permission: false

gui:
  title: "&8✦ &6WILD RTP &8» &fWorld Selector"
  size: 54
  fill-empty-slots: true
  filler-material: BLACK_STAINED_GLASS_PANE

worlds:
  survival:
    enabled: true
    display-name: "&aSurvival World"
    material: GRASS_BLOCK
    min-x: -10000
    max-x: 10000
    min-z: -10000
    max-z: 10000
    min-y: 60
    max-y: 200
    avoid-water: true
    permission: "wildrtp.world.survival"

  resource:
    enabled: true
    display-name: "&eResource World"
    material: DIAMOND_PICKAXE
    min-x: -5000
    max-x: 5000
    min-z: -5000
    max-z: 5000
    min-y: 60
    max-y: 200
    avoid-water: true
    permission: "wildrtp.world.resource"

messages:
  prefix: "&8[&6WildRTP&8] "
  no-permission: "&cYou don't have permission!"
  cooldown: "&cPlease wait %time% seconds."
  searching: "&eFinding a safe location..."
  success: "&aTeleported to &e%world% &aat &f%x%, %y%, %z%"
  failed: "&cCould not find a safe location. Try again!"
```

### 8. Multiverse Compatibility

* Work with Multiverse-Core without requiring its API unless necessary.
* Detect worlds through Bukkit's World API.
* Support worlds created or loaded after plugin startup.
* Do not interfere with Multiverse world management.
* Never create or delete worlds automatically.

### 9. Technical Requirements

* Java 21
* Paper API (target a configurable modern Paper version)
* Maven project structure
* plugin.yml
* config.yml
* Clean object-oriented architecture
* Separate GUI, RTP, configuration, command, and listener classes.
* Proper event cancellation for GUI interactions.
* Prevent item stealing, moving, dropping, and shift-click exploits.
* Handle player disconnects during teleport countdown.
* Avoid memory leaks from scheduled tasks.
* Use Adventure/MiniMessage or legacy color formatting consistently.
* Include meaningful console logs and exception handling.

### 10. Deliverables

Generate the complete compilable Maven project, including:

* pom.xml
* plugin.yml
* config.yml
* All Java source files
* README.md with installation and configuration instructions

Do not provide pseudocode or incomplete methods. Implement every feature fully.

Ensure the plugin compiles successfully and works on a Paper server with Multiverse-Core installed.
Kodari AI
KodariSep 28 at 5:36 am 2
WildRTP
A comprehensive random teleportation plugin for Paper servers with a modern GUI-based world selector. Features multi-world support, automatic world detection, configurable world settings, safe location finding with async chunk loading, cooldown system, permissions, and full Multiverse-Core compatibility. Includes commands, configurable GUI with decorative elements, and robust event handling.
  1. Build the Maven/Paper project and documented defaults, including XSeries runtime packaging.

  2. Implement world configuration, the selector GUI, command/listener wiring, and safe async-chunk RTP with cooldown and cancellation.

  3. Add installation and configuration guidance.

Created the WildRTP Maven project for Java 21 and Paper 1.21.4, with a configurable Paper API version.

  • Added the 54-slot world selector, /rtp and /wildrtp commands, reload support, permissions, and documented configuration.

  • Added loaded-world discovery, per-world settings, cooldowns, movement prevention, and bounded safe-location searches using asynchronous chunk loading.

  • Added plugin metadata and installation/configuration instructions in README.md.

Build with mvn package; I haven’t run a build verification here.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
13 1,095
src/main/java/com/kodari/wildrtp/WildRTPPlugin.java
package com.kodari.wildrtp;

import com.kodari.wildrtp.command.RtpCommand;
import com.kodari.wildrtp.config.ConfigManager;
import com.kodari.wildrtp.gui.WorldSelectorGUI;
import com.kodari.wildrtp.listener.GuiListener;
import com.kodari.wildrtp.listener.PlayerListener;
import com.kodari.wildrtp.rtp.RtpService;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public final class WildRTPPlugin extends JavaPlugin {
    private ConfigManager configManager;
    private RtpService rtpService;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        configManager = new ConfigManager(this);
        rtpService = new RtpService(this, configManager);

        RtpCommand command = new RtpCommand(this, configManager, rtpService);
        getCommand("rtp").setExecutor(command);
        getCommand("rtp").setTabCompleter(command);

        Bukkit.getPluginManager().registerEvents(new GuiListener(this, configManager, rtpService), this);
        Bukkit.getPluginManager().registerEvents(new PlayerListener(rtpService), this);
        getLogger().info("WildRTP enabled.");
    }

    @Override
    public void onDisable() {
        if (rtpService != null) {
            rtpService.shutdown();
        }
        getLogger().info("WildRTP disabled.");
    }

    public void openWorldSelector(Player player) {
        WorldSelectorGUI.open(this, configManager, rtpService, player);
    }
}