Yashraj
📎 1 file 5,457 chars
📄
pasted-code-1793481041768.txt
txt 133 lines
▶
# Minecraft Plugin Development – Random Teleport (RTP) GUI for All 3 Dimensions

Act as a senior Minecraft plugin developer. Build a fully functional, optimized, and production-ready Minecraft plugin that allows players to randomly teleport to any of the three Minecraft dimensions through an interactive Chest GUI.

## 1. Main Feature – RTP GUI

When a player executes `/rtp`, open a Chest GUI with exactly 3 selectable options:

1. **Overworld** – Teleports the player to a completely random safe location in the Overworld.
2. **Nether** – Teleports the player to a completely random safe location in the Nether.
3. **The End** – Teleports the player to a completely random safe location in The End.

### GUI Design
- Use a 27-slot (3-row) Chest GUI.
- Give each dimension its own visually distinct item:
  - Overworld: Grass Block.
  - Nether: Netherrack or Nether Brick.
  - The End: End Stone.
- Display attractive names and descriptions using Minecraft color codes or MiniMessage.
- Place the three options in the center of the GUI.
- Fill unused slots with decorative stained glass panes.
- Prevent players from taking, moving, or modifying GUI items.
- Clicking an option should immediately start the RTP process for that dimension.
- Close the GUI after selection.

## 2. Random Teleportation System

The RTP must genuinely teleport players to random coordinates in the selected dimension.

Requirements:
- Generate random X and Z coordinates within configurable boundaries.
- Search for a suitable, safe location at those coordinates.
- Find the correct ground height automatically.
- Ensure the player does not spawn inside blocks, lava, fire, or other dangerous locations.
- Ensure there is enough space for the player's character.
- Handle dimension-specific terrain and safety checks.
- Avoid teleporting players into the void.
- Avoid dangerous Nether locations such as lava lakes and enclosed lava-filled spaces.
- In The End, avoid unsafe locations and excessive fall hazards.
- If the selected coordinates are unsafe, generate another random location and retry.
- Never teleport a player to an unsafe location just to complete the request.

## 3. No Cooldown – Important

There must be absolutely NO RTP cooldown.

- Players can use `/rtp` repeatedly.
- Players can select different dimensions as many times as they want.
- Do not implement cooldown timers.
- Do not implement daily limits.
- Do not implement waiting periods between teleports.
- Do not implement permission-based cooldown bypasses.
- Every successful GUI selection should trigger a new random teleport.

## 4. Commands

Implement:

- `/rtp` – Opens the dimension selection GUI.
- `/rtp reload` – Reloads the plugin configuration (admin only).

## 5. Permissions

- `rtp.use` – Allows players to use the RTP GUI.
- `rtp.reload` – Allows administrators to reload the plugin.

Make sure permissions work correctly with LuckPerms and other standard permission plugins.

## 6. Configuration

Create a configurable `config.yml` containing:

- Maximum and minimum X/Z boundaries for each dimension.
- Maximum RTP attempts.
- GUI title.
- GUI item names and descriptions.
- GUI item slots.
- Sound effects.
- Teleportation messages.
- Safe-location search settings.

Allow administrators to customize these settings without modifying Java code.

## 7. Teleportation Feedback

Provide clean messages such as:

- "&aSearching for a safe Overworld location..."
- "&aSearching for a safe Nether location..."
- "&aSearching for a safe End location..."
- "&cCould not find a safe location. Please try again."

Use appropriate sounds when opening the GUI, selecting a dimension, and completing a teleport.

## 8. Technical Requirements

- Use Java.
- Use the Paper API.
- Keep the code clean, modular, and properly organized.
- Use asynchronous processing for expensive random-coordinate generation where appropriate.
- Perform Bukkit/Paper world and entity operations on the main server thread.
- Avoid blocking the main server thread during extensive location searches.
- Prevent duplicate simultaneous RTP requests from the same player while a teleport is processing.
- Handle players disconnecting during the RTP process.
- Handle worlds that are not loaded or unavailable.
- Validate all configuration values.
- Avoid memory leaks and unnecessary resource usage.

## 9. Compatibility

- Target the latest stable Paper version compatible with the server.
- Make sure all three dimensions work correctly.
- Support multiplayer servers.
- Work with LuckPerms.
- Do not interfere with other plugins' teleportation systems.

## 10. Deliverables

Provide the COMPLETE working plugin project, including:

- All Java source files.
- `plugin.yml`.
- `config.yml`.
- Maven `pom.xml` or Gradle build configuration.
- Proper package structure.
- Build and installation instructions.
- Compiled `.jar` plugin.

Do not provide pseudocode, incomplete examples, or placeholder methods.

Before finishing, inspect the entire project for compilation errors, API incompatibilities, and logical bugs. Build the plugin and verify that it compiles successfully.

**IMPORTANT:** The primary objective is a reliable, genuinely random, safe RTP system for all three dimensions using a Chest GUI. No cooldowns, no daily limits, and no artificial restrictions on repeated use.
Kodari AI
KodariOct 31 at 9:14 pm 2
DimensionRTPGUI
An interactive chest GUI plugin that randomly teleports players to safe locations across all three Minecraft dimensions. Players execute /rtp to open a 27-slot menu with distinct items for Overworld, Nether, and The End. The plugin generates random coordinates within configurable boundaries, performs dimension-specific safety checks to avoid lava, void, and unsafe terrain, and retries up to a configurable attempt limit. Features no cooldowns, async location searching, configurable GUI titles, item names, sounds, and messages, plus /rtp reload for administrators. Includes full permission support for rtp.use and rtp.reload.
  1. Create the Paper/Gradle project files and configurable RTP settings.

  2. Implement the three-option GUI, command/permissions, and safe asynchronous search with no cooldown.

Created the SafeRTP project with the three-dimension GUI, configurable boundaries and messages, safe-location checks, asynchronous chunk loading, and no cooldown.

To get the plugin jar: click Compile in the top bar, then Compile in the window. When the build succeeds, click Download and place the jar in your server’s plugins folder.

Yashraj

there's a bug in nether teleportation that its teleporting always on roof of bedrock rather than a safe place in nether when try to tp to nether so could fix the bug

Kodari AI
KodariOct 31 at 10:15 pm 1
  • Fix Nether ground selection so the bedrock ceiling cannot be accepted as a teleport floor.

  • Keep the existing safety checks and retry behavior unchanged.

Fixed Nether RTP to skip bedrock as a valid floor, so the roof can’t be selected as the destination. The search continues downward for a safe location and still retries if none is found.

Yashraj

dont want to compile another soo would it still work if i add this along wiht safe rtp previous plugin?

Kodari AI
KodariOct 31 at 10:17 pm 1

No—the existing SafeRTP jar won’t include the fix, so Nether RTP will still use the old behavior. Adding the changed Java file beside the jar won’t update the plugin, and adding a second SafeRTP jar can cause a plugin conflict. To use the fix, compile the updated project and replace the old jar with the new one.

Yashraj

in overworld its also tping to the caves which is not needed so fix it pls and make it play beautiful sound when tp to other place and make sure sounds dont overrite for tping in diff dimensions and random sounds must be from minecraft and there must be no music only sounds and totally random

Kodari AI
KodariNov 1 at 10:18 pm 1
  1. Prevent Overworld RTP from choosing cave locations.

  2. Add randomized Minecraft sound effects without music or dimension sound overlap.

Fixed the Overworld search so it checks only the surface block, rather than dropping into caves. Successful teleports now randomly play a vanilla sound effect from a separate list for each dimension—no music—and older configs get random fallback sounds too.

Compile the updated project and replace the existing SafeRTP jar for the changes to take effect.

Yashraj

could you make it it can rtp in whole world and only world border is limit and thats like anywhere just randomly and also make sure it don't just tp me to world border everytime i tp so make sure of that and first tell me if its already in this compiled version latest

Kodari AI
KodariNov 1 at 10:39 pm 1
  1. Check the current RTP bounds and sampling to see whether the latest project already searches the whole world.

  2. If not, change the search to sample across the world border while avoiding edge-biased destinations.

No—the current project source still limits RTP to configured rectangles (±10,000 in Overworld/End and ±5,000 in Nether). I’ll switch sampling to the active world border, with a small inset so it can search the whole interior without targeting the border edge.

No—the current project source was still limited to fixed coordinate ranges, rather than the world border. I changed RTP to randomly sample across the border’s interior, with a small inset to avoid targeting the edge.

Your existing compiled jar won’t include this change. To use it, click Compile in the top bar, click Compile in the window, then download the new jar and replace the old SafeRTP jar on your server.

Yashraj

is new jar for no limitatinos one?

Kodari AI
KodariNov 1 at 10:40 pm 1

Yes—a jar compiled from the latest updated project uses the world border as the limit and chooses random locations throughout its interior, rather than only the old fixed ranges. It keeps a small inset from the border, so destinations aren’t right on the edge. Your previously compiled jar won’t have this change.

Yashraj

could you update the jar

could you make it it can rtp in whole world and only world border is limit and thats like anywhere just randomly and also make sure it don't just tp me to world border everytime i tp so make sure of that

Update this

Kodari AI
KodariNov 1 at 10:41 pm 1

The project is already updated to pick random locations throughout the world-border interior, with an inset to avoid targeting the edge. To get the updated jar, click Compile in the top bar, click Compile in the window, then Download the successful build and replace the old jar on your server.

Yashraj

make plugin to have limit of 10k x 10k and make sure there's no rule that u can't move if you moved after doing rtp so also make sure there's no countdown and no cooldown for rtp and make sure it never rtp inside ocean and also never in caves and also make it rtp as fast as possible so it finds for safe place fast also make sure the nether and overworld both have limit to be rtp in 10kx10k but that limit do not exist in End dimension so in end dimension the limit is basically nothing so random rtp in dimension whichever player have choosen

Kodari AI
KodariNov 4 at 1:43 pm 1
  1. Set Overworld and Nether RTP bounds to 10,000 × 10,000; leave the End unrestricted.

  2. Remove movement cancellation, countdowns, and cooldowns.

  3. Reject oceans and caves while keeping location searches fast.

  1. Bounds updated: Overworld and Nether now search a 10,000 × 10,000 square centered on their world-border center, still clipped to the border. The End remains border-wide. Next I’m checking for movement locks, countdowns, and cooldowns.2. Movement/countdown/cooldown check: None are implemented. The active-search guard only prevents simultaneous RTP requests and clears when the search ends; teleporting is not cancelled if the player moves.

  2. I’m tightening surface selection to reject ocean biomes and avoiding an unnecessary async hop in each search attempt. The Nether still needs a special search because its bedrock roof means it has no ordinary surface.

Updated the RTP source:

  • Overworld and Nether are limited to a 10,000 × 10,000 area centered on each world border’s center, and still stay inside the border. The End remains unrestricted except by its world border.

  • Overworld RTP rejects ocean biomes and checks only the surface; End RTP also checks only the surface, avoiding underground locations.

  • Removed an unnecessary async step from each search attempt to speed up finding a destination.

  • There was already no countdown, cooldown, or movement-cancel rule. The “already searching” message only blocks a second request while the first one is still running.

The Nether has no ordinary surface beneath its bedrock roof, so its safe-floor search can still find open cavern areas; this change can’t guarantee a cave-free Nether destination.

These changes are in the project source, not an already compiled jar. To use them, compile the project and replace the old SafeRTP jar.

Yashraj

Now removee the end rtp fully and keep 2 dimensions only overworld and nether pls

Kodari AI
KodariNov 4 at 1:48 pm 1

Removed End RTP. The menu, dimension enum, Nether/Overworld service handling, and default config now support only the Overworld and Nether. Compile the updated project and replace the old jar for the change to take effect.

Yashraj

could you make it more beautiful like there aren't in good order to be orgamized like there is only 2 of btn to press but they are mislocated like so locate them on right place as where they should be so it looks good

Kodari AI
KodariNov 4 at 1:55 pm 1
  • Center the two dimension buttons next to each other in the middle row.

  • Update both the default layout and config slot overrides so the menu matches.

Moved the Overworld and Nether buttons side by side in the center of the menu’s middle row. Updated the default slots and config; compile and replace the existing jar for the layout change to appear in-game.

Yashraj

there's a but that making oerworld keep searching and not rtping properlly like its likely just saying its searching and it never rtp actually so make bug fix and it rtp properly

Kodari AI
KodariNov 4 at 2:04 pm 1
  • Make every Overworld search attempt recover from chunk-load or safety-check errors instead of leaving the request stuck.

  • Add a timeout that clears a search if chunk loading never completes.

Fixed the stuck-search behavior in the project source. Search errors now retry instead of leaving the request active, and a 30-second timeout ends searches whose chunk loading never completes.

Compile the updated project and replace the old jar for the fix to take effect.

Yashraj

make nether to be on its right slot and between overworld btn and nether btn there's empty slot ( that same glass pane )

Kodari AI
KodariNov 4 at 2:05 pm 1
  • Keep Overworld in its current slot.

  • Move Nether one slot right, leaving the existing glass-pane filler slot between them.

Moved Nether one slot to the right, leaving the center glass pane between it and Overworld. Compile the updated project and replace the old jar to see the new layout.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
9 639
src/main/java/com/kodari/saferTP/RtpPlugin.java
package com.kodari.saferTP;

import com.cryptomorin.xseries.XSound;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.List;
import java.util.Objects;
import java.util.concurrent.ThreadLocalRandom;

public final class RtpPlugin extends JavaPlugin implements Listener {
    private RtpService rtpService;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        rtpService = new RtpService(this);
        Objects.requireNonNull(getCommand("rtp"), "The rtp command is missing from plugin.yml")
                .setExecutor(new RtpCommand(this));
        Bukkit.getPluginManager().registerEvents(this, this);
    }

    @Override
    public void onDisable() {
        if (rtpService != null) {
            rtpService.clear();
        }
    }

    public RtpService getRtpService() {
        return rtpService;
    }

    public void sendMessage(Player player, String message) {
        player.sendMessage(ChatColor.translateAlternateColorCodes('&', message));
    }

    public void sendConfigured(Player player, String path, String fallback) {
        sendMessage(player, getConfig().getString(path, fallback));
    }

    public void playSound(Player player, String path) {
        String sound = getConfig().getString(path, "");
        if (sound != null && !sound.isBlank()) {
            XSound.matchXSound(sound).ifPresent(xSound -> xSound.play(player));
        }
    }

    public void playRandomTeleportSound(Player player, RtpDimension dimension) {
        List<String> sounds = getConfig().getStringList("sounds.teleport." + dimension.configKey());
        if (sounds.isEmpty()) {
            sounds = switch (dimension) {
                case OVERWORLD -> List.of("ENTITY_PLAYER_LEVELUP", "BLOCK_AMETHYST_BLOCK_CHIME",
                        "ENTITY_ENDERMAN_TELEPORT", "ENTITY_EXPERIENCE_ORB_PICKUP");
                case NETHER -> List.of("BLOCK_PORTAL_TRAVEL", "BLOCK_FIRE_EXTINGUISH",
                        "ENTITY_BLAZE_SHOOT", "ENTITY_WITHER_SPAWN");
            };
        }
        String sound = sounds.get(ThreadLocalRandom.current().nextInt(sounds.size()));
        XSound.matchXSound(sound).ifPresent(xSound -> xSound.play(player));
    }

    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        if (event.getView().getTopInventory().getHolder() instanceof RtpMenu menu) {
            menu.handleClick(event);
        }
    }

    @EventHandler
    public void onInventoryDrag(InventoryDragEvent event) {
        if (event.getView().getTopInventory().getHolder() instanceof RtpMenu) {
            int topSize = event.getView().getTopInventory().getSize();
            if (event.getRawSlots().stream().anyMatch(slot -> slot < topSize)) {
                event.setCancelled(true);
            }
        }
    }

    @EventHandler
    public void onPlayerQuit(PlayerQuitEvent event) {
        rtpService.onQuit(event.getPlayer().getUniqueId());
    }
}