J
📎 1 file 2,421 chars
📄
pasted-code-1780767684681.txt
txt 88 lines
▶
Create a Minecraft Paper/Spigot plugin for Java 21 (Minecraft 1.21.x).

Plugin Name: MultiWorldPortalManager

Goal:
Allow server owners to create separate groups of worlds that share portals only within their own group. The plugin should automatically manage Nether and End portal travel based on world groups instead of requiring manual portal linking.

Example:
Group 1:

* survival
* survival_nether
* survival_the_end

Group 2:

* lifesteal
* lifesteal_nether
* lifesteal_the_end

If a player enters a Nether portal in "survival", they should always go to "survival_nether".
If they enter an End portal in "survival", they should always go to "survival_the_end".

Similarly:

* lifesteal ↔ lifesteal_nether
* lifesteal ↔ lifesteal_the_end

Players should never be teleported between different groups. For example:

* survival must NEVER connect to lifesteal_nether.
* lifesteal must NEVER connect to survival_the_end.

Features:

1. Automatic portal linking based on configuration.
2. No need to manually create or assign every portal.
3. Preserve portal coordinates like vanilla Minecraft:

   * Nether ratio 8:1.
   * End returns player to their group's overworld spawn or last known portal.
4. Automatically create destination portals if they do not exist.
5. Support unlimited world groups.
6. Reload command:
   /mwpm reload
7. Permission:
   mwpm.admin
8. Config file (config.yml):

world-groups:
survival:
overworld: survival
nether: survival_nether
end: survival_the_end

lifesteal:
overworld: lifesteal
nether: lifesteal_nether
end: lifesteal_the_end

9. Plugin should listen for:

   * PlayerPortalEvent
   * PlayerTeleportEvent (if needed)
   * EntityPortalEvent (optional for mobs)

10. If a configured world does not exist, log a warning instead of crashing.

11. The plugin should be optimized for large servers and avoid unnecessary chunk loading.

12. Include:

* plugin.yml
* config.yml (generated automatically)
* Main plugin class
* PortalManager class
* ConfigManager class
* Commands and permission handling
* Fully commented source code.

Target platform:

* Paper 1.21.11
* Java 21
* Maven project structure.

The code should compile without errors and behave exactly like separate independent servers, except players can switch between the overworld, nether, and end within their own assigned world group.
Kodari AI
KodariJun 6 at 5:45 pm 1
MultiWorldPortalManager
Automatically manages Nether and End portal travel within configured world groups. Players are kept within their assigned group (overworld, nether, end) when using portals, preventing cross-group teleportation. Supports unlimited world groups, preserves vanilla 8:1 nether coordinates, auto-creates destination portals, and includes a reload command. Optimized for large servers with minimal chunk loading.

I’ll create a portal management plugin. This is a fresh project so every file is new

Maven project structure — all files created from scratch.

MultiWorldPortalManager
Automatically manages Nether and End portal travel within configured world groups. Players are kept within their assigned group (overworld, nether, end) when using portals, preventing cross-group teleportation. Supports unlimited world groups, preserves vanilla 8:1 nether coordinates, auto-creates destination portals, and includes a reload command. Optimized for large servers with minimal chunk loading.
Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
8 615
src/main/java/com/multiworldportalmanager/MultiWorldPortalManager.java
package com.multiworldportalmanager;

import com.multiworldportalmanager.config.ConfigManager;
import com.multiworldportalmanager.portal.PortalManager;
import com.multiworldportalmanager.command.ReloadCommand;
import org.bukkit.plugin.java.JavaPlugin;

/**
 * Main plugin class for MultiWorldPortalManager.
 * Handles plugin lifecycle, command registration, and event listener setup.
 */
public class MultiWorldPortalManager extends JavaPlugin {

    private ConfigManager configManager;
    private PortalManager portalManager;

    @Override
    public void onEnable() {
        // Save default config.yml if it doesn't exist
        saveDefaultConfig();

        // Initialize managers
        this.configManager = new ConfigManager(this);
        this.portalManager = new PortalManager(this, this.configManager);

        // Register event listeners
        getServer().getPluginManager().registerEvents(this.portalManager, this);

        // Register commands
        ReloadCommand reloadCommand = new ReloadCommand(this, this.configManager);
        getCommand("mwpm").setExecutor(reloadCommand);
        getCommand("mwpm").setTabCompleter(reloadCommand);

        getLogger().info("MultiWorldPortalManager has been enabled!");
    }

    @Override
    public void onDisable() {
        getLogger().info("MultiWorldPortalManager has been disabled!");
    }

    /**
     * Reloads the plugin configuration and re-initializes world groups.
     */
    public void reload() {
        reloadConfig();
        this.configManager.loadWorldGroups();
        getLogger().info("Configuration reloaded.");
    }
}