Youssef Waleed

Create a Spigot/Paper Minecraft plugin targeting Minecraft version 26.2 and compiled using Java 25.

The plugin should implement a custom home teleportation system via an interactive GUI menu.

Requirements:

  1. Command: Create a player command "/homes".
  2. GUI Menu: When a player types "/homes", open a virtual chest GUI container (size 9 or 18 slots).
  3. Default State: By default, all slots in the GUI should be filled with a "Gray Bed" item named "Empty Home Slot (Click to Set)".
  4. Setting a Home: If a player clicks an empty slot (a Gray Bed), save their current X, Y, Z coordinates, rotation, and world to the plugin's data config.
  5. Visual Change: Once a home is successfully saved to a slot, change that specific slot's item from a "Gray Bed" to a "Blue Bed". Change its name to "Home #[Slot Number] (Click to Teleport)".
  6. Teleportation Logic: If a player opens the "/homes" GUI and clicks on any "Blue Bed", close the GUI and instantly teleport them back to the exact saved coordinates for that specific home slot.
  7. Event Handling: Cancel all inventory click events inside this GUI so players cannot pull the beds out into their actual inventories. Save data to a config.yml file so homes persist across server restarts.
Kodari AI
KodariSep 10 at 5:48 am 1
HomeMenuGUI
A Spigot/Paper plugin implementing a GUI-based home teleportation system. Players use /homes command to open a chest inventory where each slot represents a home location. Empty slots display gray beds that players click to save their current position, world, and rotation. Saved slots transform into blue beds showing the slot number, clicking them teleports the player instantly to the saved coordinates. All inventory clicks are cancelled to prevent item removal, and home data persists in config.yml across restarts. The plugin uses the custom inventory GUI framework with lazy initialization, button-based slot handling, and centralized GUI management for reliable event processing.
  1. Create the Gradle/Spigot plugin metadata targeting Java 25 and Minecraft 26.2.

  2. Add persistent home storage backed by config.yml.

  3. Add the per-player 18-slot home GUI, bed state rendering, click handling, teleportation, and drag protection.

  4. Register /homes and the inventory event listener in the main plugin class.

Created the Homes plugin with:

  • /homes command opening an 18-slot chest GUI.

  • Gray beds for empty slots and blue beds for saved homes.

  • Persistent world, coordinates, yaw, and pitch storage in config.yml.

  • Click-to-save and click-to-teleport behavior.

  • Inventory click and drag protection.

  • Java 25 Gradle configuration targeting Paper/Minecraft 26.2.

Youssef Waleed
๐Ÿ“Ž 1 file 2,463 chars
๐Ÿ“„
pasted-code-1789019865607.txt
txt 17 lines
โ–ถ
Create a Spigot/Paper Minecraft plugin targeting Minecraft version 26.2 and compiled using Java 25. 

The plugin must implement a custom GUI-based Random Teleportation (RTP) system with a Donut-SMP style countdown and randomized music disc queueing.

Requirements:
1. Command: Create a player command "/rtp".
2. GUI Layout: Opening "/rtp" must display a 27-slot virtual chest inventory (3 rows of 9 slots). Cancel all inventory click events so players cannot steal items from the menu.
3. Row 1 (Overworld): Slot 4 (middle of row 1) must be a "Grass Block" item named "Random Teleport: Overworld". Teleports to safe coordinates within a 10,000 block radius.
4. Row 2 (Nether): Slot 13 (middle of row 2) must be a "Netherrack" item named "Random Teleport: The Nether". Teleports to safe coordinates on solid ground inside the Nether caverns (not above the bedrock roof, not into lava).
5. Row 3 (The End): Slot 22 (middle of row 3) must be an "End Stone" item named "Random Teleport: The End (Outer Islands)". Teleports to random locations where X and Z coordinate ranges are strictly between 1,000 and 20,000 (positive or negative) to bypass the main Ender Dragon island completely and target outer End Cities.
6. Safe Location Search: The plugin must verify the destination is completely safe to stand on (no lava, no water, no void, and has 2 open air blocks for feet/head). 
7. Donut SMP Style Music & Countdown: When a player clicks a dimension, immediately close the GUI and start a 5-second asynchronous loading/teleport countdown. 
   - During these 5 seconds, play a randomized Minecraft music disc sound track explicitly dedicated to that player (choose randomly from standard vanilla disc sound keys like music_disc.cat, music_disc.blocks, music_disc.chirp, music_disc.far, music_disc.mall, music_disc.mellohi, music_disc.stal, music_disc.strad, music_disc.ward, music_disc.11, music_disc.13, music_disc.pigstep, music_disc.otherside, or music_disc.relic).
   - Display a live countdown timer on their action bar: "Finding safe destination... [5s remaining]".
   - If the player moves their position during the 5 seconds, cancel the countdown, stop the music track using player.stopSound(), and send a chat message: "Teleport cancelled because you moved!".
8. Final Teleport: Once the 5 seconds conclude successfully, stop the music disc track, instantly teleport the player to the safe pre-calculated coordinates, and play a clean portal sound effect.
Kodari AI
KodariSep 10 at 5:59 am 1

[Generation stopped]

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
8 248
src/main/java/com/kodari/homes/HomesPlugin.java
package com.kodari.homes;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public final class HomesPlugin extends JavaPlugin implements CommandExecutor {
    private HomeStorage homeStorage;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        this.homeStorage = new HomeStorage(this);

        if (getCommand("homes") != null) {
            getCommand("homes").setExecutor(this);
        }
        Bukkit.getPluginManager().registerEvents(new HomeMenuListener(), this);
    }

    public HomeStorage getHomeStorage() {
        return homeStorage;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player player)) {
            sender.sendMessage("Only players can open the homes menu.");
            return true;
        }

        HomeMenuHolder menu = new HomeMenuHolder(this, player);
        player.openInventory(menu.getInventory());
        return true;
    }
}