gagaiominai

Make a One Way Nether Portal that only administrator can create a nether portal for a one way nether portal. Make all the existing portals to force disabled it and make also an database/.db for this plugin in order not to lost any sort of data and also make sure that this plugin is a lightweight plugin that doesnt cause any sort of tps drop, high mspt, high ping to players and spam error on the console.

Kodari AI
KodariSep 9 at 1:37 am 2
OneWayNetherPortal
Administrators can create one-way Nether portals that teleport players to the Nether but prevent return travel. All existing portals are force-disabled upon plugin load. Uses a lightweight SQLite database to persist portal locations, cooldowns, and settings. Optimized for minimal server impact with no TPS drops, no console spam, and efficient event handling. Features admin-only creation commands, automatic portal detection, and a safe fallback system for disabled portals.
  1. Create the Gradle/Paper plugin structure and runtime configuration.

  2. Add SQLite-backed portal persistence under the plugin’s database/ directory.

  3. Add administrator-only portal creation/registration and one-way portal event enforcement.

  4. Add commands for registering and removing portal locations.

Created the OneWayPortal plugin with:

  • Administrator-only Nether portal creation via onewayportal.admin.

  • All unregistered/existing Nether portals disabled.

  • One-way travel: registered portals allow travel into the Nether, but Nether-to-overworld travel is blocked.

  • SQLite persistence at: plugins/OneWayPortal/database/onewayportal.db

  • Lightweight in-memory portal lookup with database writes only during portal registration/removal.

  • Commands:

    • /onewayportal create — register the portal you are standing in.

    • /onewayportal remove — unregister the nearby portal.

    • /onewayportal status — show registered portal block count.

  • Admins can create portals normally with flint and steel; non-administrator portal creation is cancelled.

gagaiominai

make the author Velrion/Kryzi and remove the description

Kodari AI
KodariSep 9 at 3:18 am 1

Updated plugin.yml:

  • Author changed to Velrion/Kryzi

  • Removed the plugin description

gagaiominai

Add additional feature for end portal.

Kodari AI
KodariSep 15 at 11:05 pm 2
  1. Inspect the existing portal listener, registry, database, and commands.

  2. Extend the same administrator-only, one-way behavior to End portals.

  3. Update command help/configuration without changing the lightweight persistence design.

Added End portal support.

  • Administrators can register nearby End portals with /onewayportal create.

  • Registered End portals allow one-way travel into The End.

  • Travel from The End back out is blocked.

  • Unregistered existing End portals remain disabled.

  • Nether and End portal registrations are distinguished automatically.

  • End portal blocks are persisted in the existing SQLite database.

  • Updated command messages and plugin.yml descriptions to include Nether and End portals.

  • No database schema change was needed; world UUID and coordinates already prevent conflicts.

gagaiominai

make the commands separate like /onewayend and /onewaynether

Kodari AI
KodariSep 15 at 11:08 pm 1
  1. Split command handling into /onewaynether and /onewayend.

  2. Keep each command restricted to its matching portal type while preserving existing admin checks and persistence.

  3. Update command registration and help text in plugin.yml.

Implemented separate commands:

  • /onewaynether <create|remove|status|help> for Nether portals.

  • /onewayend <create|remove|status|help> for End portals.

Each command:

  • Requires onewayportal.admin.

  • Only detects and registers its matching portal type.

  • Stores changes in the existing SQLite database.

  • Supports removing nearby registered portals.

  • Keeps Nether and End portal management separate.

The old /onewayportal command was removed.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
settings.gradle
Code
10 580
src/main/java/com/kodari/onewayportal/OneWayPortalPlugin.java
package com.kodari.onewayportal;

import java.io.File;
import java.sql.SQLException;
import org.bukkit.World;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class OneWayPortalPlugin extends JavaPlugin {
    private DatabaseManager databaseManager;
    private PortalRegistry portalRegistry;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        File databaseFile = new File(getDataFolder(), "database/onewayportal.db");
        try {
            databaseManager = new DatabaseManager(databaseFile);
            databaseManager.initialize();
            portalRegistry = new PortalRegistry(databaseManager);
            portalRegistry.load();
        } catch (SQLException exception) {
            getLogger().severe("Could not initialize the portal database: " + exception.getMessage());
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        getServer().getPluginManager().registerEvents(new PortalListener(this, portalRegistry), this);

        registerCommand("onewaynether", World.Environment.NETHER, "Nether");
        registerCommand("onewayend", World.Environment.THE_END, "End");
    }

    @Override
    public void onDisable() {
        if (databaseManager != null) {
            databaseManager.close();
        }
    }

    public String messagePrefix() {
        return getConfig().getString("messages.prefix", "&8[&5OneWayPortal&8] &r").replace('&', '§');
    }

    private void registerCommand(String name, World.Environment destinationEnvironment, String portalType) {
        PluginCommand command = getCommand(name);
        if (command == null) {
            getLogger().warning("Command " + name + " is missing from plugin.yml.");
            return;
        }

        OneWayPortalCommand executor = new OneWayPortalCommand(this, portalRegistry, destinationEnvironment, portalType);
        command.setExecutor(executor);
        command.setTabCompleter(executor);
    }
}