K

Create a Minecraft Paper plugin in Java targeting Minecraft 26.1.2 (Paper API 26.1.2.build.66-stable) with the following behavior:

Goal: There is only ONE nether world. Multiple overworlds exist (e.g., world, vanilla). When a player travels from any overworld to the nether and back, they should return to the SAME overworld they came from — not always world (which is Minecraft's default).

Exact behavior:

  • Player in any overworld enters a nether portal → goes to nether (keep Minecraft default behavior, do NOT touch this direction)
  • Player in nether enters a portal → returns to whichever overworld they came FROM (tracked per player UUID)
  • Portal linking and portal block finding must work exactly like vanilla Minecraft — find nearest existing portal, create one if none exists — only the DESTINATION WORLD is changed, not the coordinate logic

⚠️ Critical 26.1 API changes to follow:

  1. World identification — use getKey() not getName()

WorldInfo#getName is obsolete in 26.1+. Use world.getKey() (returns a NamespacedKey) everywhere instead of world.getName(). Store and compare worlds by their NamespacedKey, not by String names. In config, world names are written as plain strings (e.g. "world", "vanilla"), but internally always resolve them using Bukkit.getWorld(NamespacedKey.minecraft("world")) or Bukkit.getWorld(NamespacedKey.fromString("world")).

  1. Java & Maven

Requires Java 25. Use this in pom.xml:

<properties> <maven.compiler.source>25</maven.compiler.source> <maven.compiler.target>25</maven.compiler.target> </properties>

<dependency> <groupId>io.papermc.paper</groupId> <artifactId>paper-api</artifactId> <version>26.1.2.build.66-stable</version> <scope>provided</scope> </dependency>

  1. PlayerPortalEvent getTo() behavior

For NETHER_PORTAL cause, getTo() returns only the starting point for portal search (scaled coordinates, clamped to world border) — NOT the final destination. To redirect to a different world, call: event.setTo(new Location(targetWorld, event.getTo().getX(), event.getTo().getY(), event.getTo().getZ())) Only swap the world object, keep XYZ unchanged so Paper's portal search still works correctly in the target world.

Implementation details:

  • Listen to PlayerPortalEvent
  • When player is in an overworld and uses a nether portal: save their world's NamespacedKey to a HashMap<UUID, NamespacedKey>
  • When player is in the nether and uses a portal: look up saved NamespacedKey, resolve the world with Bukkit.getWorld(key), then call event.setTo() with that world and same XYZ
  • If no source world is saved, use the fallback world from config
  • Clean up HashMap on PlayerQuitEvent
  • Use Paper API only (not Spigot)
  • Java 25, Paper 26.1.2
  • Plugin name: NetherLinker
  • Author: niloy
  • Include plugin.yml, pom.xml, config.yml, messages.yml

config.yml — fully configurable, every key must have a comment explaining it:

The single nether world name

nether-world: "world_nether"

If no source world is saved for a player, send them here

fallback-world: "world"

List of all overworlds to track — players from these worlds will have their source saved

overworlds: - "world" - "vanilla"

messages.yml — every single message must be here, nothing hardcoded in Java:

Sent when player is returned to their source world

returned-to-world: "&aReturning to: &e{world}"

Sent when no source world found, using fallback

no-source-found: "&cNo source world found, sending to fallback."

Sent on successful reload

reload-success: "&aNetherLinker reloaded successfully."

Debug command messages

debug-source: "&eSource world of {player}: &a{world}" debug-no-source: "&c{player} has no saved source world."

  • Support {world} and {player} as placeholders in all messages
  • Convert & color codes using ChatColor.translateAlternateColorCodes
  • All messages must also be parsed through PlaceholderAPI.setPlaceholders(player, message) before sending, if PlaceholderAPI is installed

PlaceholderAPI Integration:

  • Add softdepend: [PlaceholderAPI] in plugin.yml
  • Plugin must work perfectly even if PlaceholderAPI is NOT installed (soft depend only)
  • Register a custom PlaceholderExpansion with identifier netherlinker:

- %netherlinker_source_world% — player's saved source world key (e.g. minecraft:world), empty string if none saved - %netherlinker_in_nether% — true if player is currently in the configured nether world, else false - %netherlinker_fallback_world% — the configured fallback world key from config - %netherlinker_nether_world% — the configured nether world key from config

  • Unregister the expansion cleanly in onDisable()
  • Parse ALL messages sent to players through PlaceholderAPI if it is available

Commands — all under /netherlinker:

  • /netherlinker reload — reloads both config.yml and messages.yml without server restart — permission: netherlinker.reload
  • /netherlinker debug <player> — shows that player's currently saved source world — permission: netherlinker.debug

On startup:

  • Validate that every world listed in overworlds and fallback-world in config actually exists on the server; log a [WARNING] for any world that is missing
  • Log a startup confirmation message showing the configured nether world and tracked overworlds
  • Never use world.getName() anywhere — always use world.getKey()
Kodari AI
KodariJun 15 at 12:12 pm 11

I’ll create a comprehensive Paper plugin that ensures players return to their original overworld when exiting the nether.

NetherLinker
A Paper plugin that tracks which overworld each player came from when entering the nether, ensuring they return to the same overworld instead of defaulting to the main world. Supports multiple overworlds sharing a single nether dimension with full PlaceholderAPI integration and configurable messages.

NetherLinker is ready. The plugin:

✅ Tracks source overworld per player UUID when entering nether
✅ Returns to origin when exiting nether (not always “world”)
✅ Paper 26.1.2 compliant — uses world.getKey() everywhere, Java 25, correct pom.xml
✅ PlayerPortalEvent handling — only swaps world in setTo(), keeps XYZ unchanged for proper portal search
✅ PlaceholderAPI soft depend — 4 custom placeholders, works without PAPI installed
✅ Fully configurable — config.yml with comments, messages.yml with all text
✅ World validation — warns on startup if configured worlds don’t exist
✅ Commands — /netherlinker reload and /netherlinker debug <player>
✅ Memory efficient — cleans up HashMap on player quit

Players from any tracked overworld will now reliably return to their origin world when exiting the nether.

K
📎 1 file 1,573 chars
📄
pasted-code-1782059737924.txt
txt 5 lines
▶
I have an existing Bukkit/Paper plugin called NetherLinker (package: com.niloy.netherlinker). It tracks which overworld a player came from before entering a shared nether world, and sends them back to that source world when they return through a nether portal. The destination override happens in PortalListener.onPortalTravel(), inside the PlayerPortalEvent handler.
Please fix two bugs in that method:
Yaw/pitch is lost on return. The new Location sent back to the source world is built only from to.getX(), to.getY(), to.getZ() — it drops the player's facing direction, so they always snap to face north (yaw=0, pitch=0) after returning. Fix this by carrying over to.getYaw() and to.getPitch() into the new destination Location.
No Y-coordinate safety check. When sending a player back to their source world, the code reuses the nether-side Y coordinate directly. If a player builds a portal high up in the nether, this can place them in the void or inside terrain in the overworld. Add a safety check before finalizing the destination: if the computed Y coordinate is below the source world's minimum height or there's no safe ground/solid block reasonably near that Y, fall back to a safe Y — for example, the highest solid block at that X/Z column (world.getHighestBlockYAt(x, z) + 1) — instead of teleporting blindly to the raw nether Y value.
Keep all existing logic (source-world tracking map, fallback-world behavior, messages, PlaceholderAPI integration) unchanged — only modify the destination Location construction in onPortalTravel() to apply these two fixes.
Kodari AI
KodariJun 21 at 4:36 pm 11

I’ll fix both bugs in the PortalListener by adding yaw/pitch preservation and Y-coordinate safety checks.

Both bugs fixed:

  1. Yaw/pitch now preserved — the new Location includes to.getYaw() and to.getPitch(), so players face the same direction after returning

  2. Y-coordinate safety check — if the nether Y is below the target world’s minimum height, it falls back to the highest solid block at that X/Z column (getHighestBlockYAt() + 1) instead of teleporting blindly

All existing logic (source tracking, fallback world, messages, PlaceholderAPI) remains unchanged.

K
📎 1 file 2,336 chars
📄
pasted-code-1782061891277.txt
txt 17 lines
▶
I have an existing Bukkit/Paper plugin called NetherLinker (package: com.niloy.netherlinker). It currently has one command, /netherlinker (alias /nl), handled by NetherLinkerCommand.java, with two subcommands: reload and debug , each gated behind its own permission (netherlinker.reload and netherlinker.debug, default: op).
Please add a new subcommand: /netherlinker version (also usable as /nl version).
Requirements:
Permission required: add a new permission node netherlinker.version, default: op. If the sender doesn't have this permission, show the same style of denial message used for reload/debug (e.g. "§cYou don't have permission to use this command.") and return.
Output should show four things (only shown if permission check passes):
Plugin version (use plugin.getDescription().getVersion())
Author (use plugin.getDescription().getAuthors() or the author field from plugin.yml — should print "niloy")
PlaceholderAPI integration status — whether PlaceholderAPI is currently detected/enabled by the plugin, shown as something like "PlaceholderAPI: Enabled" or "PlaceholderAPI: Disabled"
Server version — use Bukkit.getVersion() (or Bukkit.getBukkitVersion() for the API version), labeled something like "Server: "
Format the output similarly to the existing commands — colored chat output using § color codes (e.g. §a for labels, §e or §f for values), consistent with the style already used in NetherLinkerCommand.java.
Update the tab-completer (onTabComplete) so version appears as a suggestion alongside reload and debug when the player types /nl .
Update the usage message (currently "§cUsage: /netherlinker ") to include version: "§cUsage: /netherlinker ".
Update plugin.yml:
Add version to the command's usage description.
Add a new permission entry netherlinker.version with description "View plugin version information" and default op.
Note: The /nl alias for /netherlinker already exists in plugin.yml (aliases: [nl]) — no change needed there. Just make sure the new version subcommand works through both /netherlinker version and /nl version since they map to the same command executor.
Keep all existing functionality (reload, debug) unchanged — only add the new version subcommand with its permission gate, and update the usage/tab-complete/plugin.yml accordingly.
Kodari AI
KodariJun 21 at 5:12 pm 12

I’ll add the version subcommand to your NetherLinker plugin. Let me first check the existing command structure and style.

Now I’ll add the version subcommand with the same style and permission structure as the existing commands.Let me create properly formatted patches:

Now I’ll update plugin.yml to add the permission and update the usage:

Done! I’ve added the version subcommand to NetherLinker. Here’s what was implemented:

Changes made:

  1. NetherLinkerCommand.java:

    • Added version subcommand handler with permission check for netherlinker.version

    • Displays:

      • Plugin version from plugin.getDescription().getVersion()

      • Author from plugin.getDescription().getAuthors() (fallback to “niloy” if empty)

      • PlaceholderAPI status — “Enabled” if detected, “Disabled” if not

      • Server version from Bukkit.getVersion()

    • Updated both usage messages to <reload|debug|version>

    • Added “version” to tab completion suggestions

  2. plugin.yml:

    • Updated command usage to include version

    • Added netherlinker.version permission (default: op, description: “View plugin version information”)

Usage:

Plain Text
/netherlinker version
/nl version

Output format (matching existing style):

Plain Text
§a§lNetherLinker Version Information:
§eVersion: §f1.0.0
§eAuthor: §fniloy
§ePlaceholderAPI: §aEnabled
§eServer: §fgit-Paper-66 (MC: 1.21.4)

The subcommand works through both /netherlinker version and /nl version (since they use the same executor), and requires the netherlinker.version permission with the same denial message style as other commands.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
10 612
src/main/java/com/niloy/netherlinker/NetherLinker.java
package com.niloy.netherlinker;

import com.niloy.netherlinker.commands.NetherLinkerCommand;
import com.niloy.netherlinker.listeners.PortalListener;
import com.niloy.netherlinker.managers.ConfigManager;
import com.niloy.netherlinker.managers.MessageManager;
import com.niloy.netherlinker.placeholders.NetherLinkerExpansion;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.World;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Level;

public final class NetherLinker extends JavaPlugin {
    
    private final Map<UUID, NamespacedKey> sourceWorlds = new HashMap<>();
    private ConfigManager configManager;
    private MessageManager messageManager;
    private NetherLinkerExpansion placeholderExpansion;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        saveResource("messages.yml", false);
        
        this.configManager = new ConfigManager(this);
        this.messageManager = new MessageManager(this);
        
        this.configManager.load();
        this.messageManager.load();
        
        validateWorlds();
        
        Bukkit.getPluginManager().registerEvents(new PortalListener(this), this);
        
        NetherLinkerCommand commandHandler = new NetherLinkerCommand(this);
        getCommand("netherlinker").setExecutor(commandHandler);
        getCommand("netherlinker").setTabCompleter(commandHandler);
        
        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            this.placeholderExpansion = new NetherLinkerExpansion(this);
            this.placeholderExpansion.register();
            getLogger().info("PlaceholderAPI integration enabled");
        }
        
        getLogger().info("NetherLinker enabled - Nether world: " + configManager.getNetherWorld().asString());
        getLogger().info("Tracked overworlds: " + configManager.getOverworlds().size());
    }
    
    @Override
    public void onDisable() {
        if (this.placeholderExpansion != null) {
            this.placeholderExpansion.unregister();
        }
        this.sourceWorlds.clear();
    }
    
    public void reload() {
        reloadConfig();
        this.configManager.load();
        this.messageManager.load();
        validateWorlds();
    }
    
    private void validateWorlds() {
        NamespacedKey netherKey = configManager.getNetherWorld();
        World netherWorld = Bukkit.getWorld(netherKey);
        if (netherWorld == null) {
            getLogger().log(Level.WARNING, "Configured nether world '" + netherKey.asString() + "' does not exist!");
        }
        
        NamespacedKey fallbackKey = configManager.getFallbackWorld();
        World fallbackWorld = Bukkit.getWorld(fallbackKey);
        if (fallbackWorld == null) {
            getLogger().log(Level.WARNING, "Configured fallback world '" + fallbackKey.asString() + "' does not exist!");
        }
        
        for (NamespacedKey overworldKey : configManager.getOverworlds()) {
            World overworld = Bukkit.getWorld(overworldKey);
            if (overworld == null) {
                getLogger().log(Level.WARNING, "Configured overworld '" + overworldKey.asString() + "' does not exist!");
            }
        }
    }
    
    public Map<UUID, NamespacedKey> getSourceWorlds() {
        return sourceWorlds;
    }
    
    public ConfigManager getConfigManager() {
        return configManager;
    }
    
    public MessageManager getMessageManager() {
        return messageManager;
    }
}