Blake Crooks

Make a Paper Plugin for 26.3 that makes it so you can set home using /home set like for example /home set base then when you do /home base you get teleported to base and make a gui that is usable with stuff like delete homes, set home, and teleport home and make it so you can do /gui and it brings up a gui that has the home stuff but also has a tpr section so you can tp to people and make it so you can do /gui in combat like 1 minute from you hitting another player or a player hitting you but mobs can't enable combat

Kodari AI
KodariMon at 5:39 am 1
HomeHubGUI
A Paper plugin for Minecraft 26.3 providing comprehensive home management and teleportation features. Players can set named homes using /home set <name>, teleport with /home <name>, and manage homes through an interactive GUI. The /gui command opens a menu with home management options (set, delete, teleport) and a player teleport section. Combat protection prevents GUI usage for 60 seconds after player combat, but mob attacks don't trigger this restriction. The plugin uses a lazy-initialized inventory GUI framework with button-based interaction, centralized management, and automatic event handling for seamless player experience.
  • Add the Paper 26.3 plugin setup and persistent named-home storage.

  • Implement /home, the homes/TPR GUI, and teleport-request commands.

  • Track player-versus-player combat for 60 seconds and block GUI access during that period.

Created the Paper 26.3 home and teleport plugin.

  • /home set <name>, /home <name>, /home list, and /home delete <name> manage persistent homes.

  • /gui opens the homes and player-teleport menu. Click a home to teleport; right-click to delete. The menu can also set or replace a home named home.

  • Click a player in the TPR menu to send a request; they can use /tpaccept or /tpdeny. Requests expire after 60 seconds.

  • The GUI is unavailable for 60 seconds after PvP damage to or from a player. Mob damage does not start combat.

Blake Crooks

\

Kodari AI
KodariMon at 5:40 am 1

What would you like to change or add to the plugin?

Blake Crooks

can you call it Rusted Essentials nad make the author say Rusty

Kodari AI
KodariMon at 5:41 am 1
  1. Rename the plugin in its metadata to Rusted Essentials.

  2. Set the author to Rusty.

  3. Leave commands and implementation unchanged.

Renamed the plugin to Rusted Essentials and set the author to Rusty in plugin.yml.

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

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

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

public final class HomeTPPlugin extends JavaPlugin {
    private HomeManager homeManager;
    private CombatManager combatManager;
    private TeleportRequestManager teleportRequestManager;
    private GuiManager guiManager;

    @Override
    public void onEnable() {
        homeManager = new HomeManager(this);
        homeManager.load();
        combatManager = new CombatManager();
        teleportRequestManager = new TeleportRequestManager();
        guiManager = new GuiManager(homeManager, combatManager, teleportRequestManager);

        Bukkit.getPluginManager().registerEvents(combatManager, this);
        Bukkit.getPluginManager().registerEvents(guiManager, this);

        HomeCommand homeCommand = new HomeCommand(homeManager, guiManager);
        getCommand("home").setExecutor(homeCommand);
        getCommand("home").setTabCompleter(homeCommand);

        getCommand("gui").setExecutor((sender, command, label, args) -> {
            if (!(sender instanceof Player player)) {
                sender.sendMessage("This command can only be used in-game.");
                return true;
            }
            guiManager.openMain(player);
            return true;
        });

        TeleportCommand teleportCommand = new TeleportCommand(teleportRequestManager, guiManager);
        getCommand("tpr").setExecutor(teleportCommand);
        getCommand("tpaccept").setExecutor(teleportCommand);
        getCommand("tpdeny").setExecutor(teleportCommand);
    }

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

    private static String color(String message) {
        return ChatColor.translateAlternateColorCodes('&', message);
    }

    private static final class HomeCommand implements org.bukkit.command.CommandExecutor, TabCompleter {
        private final HomeManager homes;
        private final GuiManager gui;

        private HomeCommand(HomeManager homes, GuiManager gui) {
            this.homes = homes;
            this.gui = gui;
        }

        @Override
        public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
            if (!(sender instanceof Player player)) {
                sender.sendMessage("This command can only be used in-game.");
                return true;
            }
            if (args.length == 0) {
                gui.openHomes(player, 0);
                return true;
            }
            if (args[0].equalsIgnoreCase("set")) {
                if (args.length != 2 || !HomeManager.isValidName(args.length > 1 ? args[1] : "")) {
                    player.sendMessage(color("&cUsage: /home set <name> (1-16 letters, numbers, _ or -)"));
                    return true;
                }
                homes.setHome(player.getUniqueId(), args[1], player.getLocation());
                player.sendMessage(color("&aHome '&e" + args[1].toLowerCase(Locale.ROOT) + "&a' set."));
                return true;
            }
            if (args[0].equalsIgnoreCase("delete")) {
                if (args.length != 2) {
                    player.sendMessage(color("&cUsage: /home delete <name>"));
                    return true;
                }
                if (homes.deleteHome(player.getUniqueId(), args[1])) {
                    player.sendMessage(color("&aHome '&e" + args[1] + "&a' deleted."));
                } else {
                    player.sendMessage(color("&cYou don't have a home named '&e" + args[1] + "&c'."));
                }
                return true;
            }
            if (args[0].equalsIgnoreCase("list") && args.length == 1) {
                List<String> names = new ArrayList<>(homes.getHomes(player.getUniqueId()).keySet());
                player.sendMessage(names.isEmpty()
                        ? color("&eYou haven't set any homes yet. Use /home set <name>.")
                        : color("&aHomes: &e" + String.join(", ", names)));
                return true;
            }
            if (args.length != 1) {
                player.sendMessage(color("&cUsage: /home [set <name>|delete <name>|list|<name>]"));
                return true;
            }
            homes.getHome(player.getUniqueId(), args[0]).ifPresentOrElse(location -> {
                if (player.teleport(location)) {
                    player.sendMessage(color("&aTeleported to home '&e" + args[0] + "&a'."));
                }
            }, () -> player.sendMessage(color("&cYou don't have a home named '&e" + args[0] + "&c'.")));
            return true;
        }

        @Override
        public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
            if (!(sender instanceof Player player)) {
                return List.of();
            }
            if (args.length == 1) {
                String prefix = args[0].toLowerCase(Locale.ROOT);
                List<String> suggestions = new ArrayList<>(List.of("set", "delete", "list"));
                suggestions.addAll(homes.getHomes(player.getUniqueId()).keySet());
                return suggestions.stream()
                        .filter(value -> value.toLowerCase(Locale.ROOT).startsWith(prefix))
                        .toList();
            }
            if (args.length == 2 && (args[0].equalsIgnoreCase("delete"))) {
                String prefix = args[1].toLowerCase(Locale.ROOT);
                return homes.getHomes(player.getUniqueId()).keySet().stream()
                        .filter(name -> name.startsWith(prefix)).toList();
            }
            return List.of();
        }
    }
}