makromod

Create a Minecraft Java Edition Paper plugin named PosTP.

The plugin is a teleport and hub management plugin for Minecraft 1.21.x.

The plugin must work with Java 21 and Paper 1.21.x.

================================================== MAIN IDEA ==================================================

PosTP allows players to open a teleport INVENTORY GUI using:

/postp

The INVENTORY GUI must automatically detect which world the player is currently in.

The player should only see teleport locations that belong to that current world.

For example:

Survival world:

  • Spawn
  • Market
  • Mine
  • PvP Arena

Lifesteal world:

  • Spawn
  • PvP Arena
  • Shop

If the player is currently in Survival, the INVENTORY GUI must only show Survival locations.

If the player is in Lifesteal, only Lifesteal locations should appear.

================================================== NPC SUPPORT ==================================================

PosTP must NOT have its own NPC system.

It must NOT depend on any specific NPC plugin.

Any NPC plugin can be used.

The NPC only needs to execute:

/postp

when a player clicks it.

For example, a Citizens NPC, FancyNpcs NPC, or any other NPC can execute /postp.

PosTP receives the command and opens the teleport INVENTORY GUI.

================================================== SPAWN SETTING ==================================================

An admin can stand at a location and create a teleport point using:

/postpset <name> add

Example:

/postpset Spawn1 add /postpset Market add /postpset PvPArena add

The exact location where the admin is standing must be saved.

Save:

  • World
  • Coordinates
  • Yaw
  • Pitch
  • Biome

Each teleport point belongs to the world where it was created.

Admins can also:

/postpset <name> remove

/postpset list

/postp reload

================================================== INVENTORY GUI ==================================================

When /postp is used, open a Minecraft inventory INVENTORY GUI.

The INVENTORY GUI should contain the available teleport locations for the player's current world.

Each teleport should have:

  • Custom item
  • Custom name
  • Lore
  • Slot
  • Description
  • World name
  • Biome name

When a Java Edition player moves the mouse cursor over an item, the normal Minecraft item tooltip should show its name and lore.

Example:

Spawn

World: survival Biome: Plains

Click to teleport.

================================================== TELEPORT ==================================================

When the player clicks a teleport location:

Teleport the player to that saved location.

Optionally use a countdown before teleporting.

Default countdown:

3 seconds.

Show:

Teleporting... 3 2 1

Then teleport.

The countdown can be cancelled if the player moves or takes damage.

Cooldown must also be configurable.

================================================== WORLD-SPECIFIC LOBBY ==================================================

Every enabled world can have its own Lobby.

Admin uses:

/lobbyset

while standing at the desired lobby location.

Example:

Survival:

Lobby = Survival Lobby

Lifesteal:

Lobby = Lifesteal Lobby

Skyblock:

Lobby = Skyblock Lobby

When a player is in Survival and uses:

/lobby

they must go to the Survival Lobby.

When a player is in Lifesteal and uses:

/lobby

they must go to the Lifesteal Lobby.

The Lobby is always based on the player's current world.

================================================== GLOBAL HUB ==================================================

There is one Main Hub for the entire server.

Admin uses:

/hubset

while standing at the desired location.

This location becomes the Main Hub.

When any player uses:

/hub

they are teleported to the Main Hub.

Unlike /lobby:

/lobby = current world's lobby

/hub = server's main/global hub

================================================== ENABLED WORLDS ==================================================

The plugin must have a configuration where the server owner can choose which worlds PosTP works in.

Example:

enabled worlds:

  • survival
  • lifesteal
  • skyblock

If a player is in a world that is not enabled, /postp should not open the INVENTORY GUI.

Show a configurable message such as:

PosTP is not available in this world.

================================================== HUB PROTECTION ==================================================

The world where /hubset was created must automatically become the protected Hub world.

The Hub must be a completely safe area.

Normal players cannot:

  • Break blocks
  • Place blocks
  • Use buckets
  • Place water
  • Place lava
  • Use flint and steel
  • Use TNT
  • Create explosions
  • Damage entities
  • Edit armor stands
  • Break item frames
  • Break paintings
  • Destroy vehicles

================================================== HUB PVP ==================================================

PvP must be completely disabled in the Hub.

Players cannot damage other players.

Disable:

  • Melee PvP
  • Bow damage
  • Crossbow damage
  • Trident damage
  • Projectile damage
  • Splash potion damage
  • Lingering potion damage
  • TNT damage
  • End crystal damage
  • Player-caused fire damage

If someone tries to attack another player:

PvP is disabled in the Hub.

================================================== HUB MOB PROTECTION ==================================================

The Hub must not allow unwanted mobs to spawn.

Disable:

  • Hostile mobs
  • Animals
  • Ambient mobs
  • Water mobs
  • Phantoms
  • Patrols
  • Other unwanted entity spawning

Also prevent:

  • Creeper explosions
  • TNT explosions
  • Wither damage
  • Ender Dragon block damage
  • Enderman griefing

================================================== HUB WEATHER ==================================================

The Hub weather must be configurable.

Default:

CLEAR

The server owner can choose:

CLEAR RAIN THUNDER

Weather locking can be enabled or disabled.

================================================== HUB TIME ==================================================

The Hub time can optionally be locked.

For example:

DAY

or a specific Minecraft time.

================================================== DEVELOPER ACCESS ==================================================

The Hub must remain protected even for:

  • OP
  • Admin
  • Server Owner

Only users with the developer permission:

postp.dev

can bypass Hub protection.

A developer can build and edit the Hub normally.

Admin/OP without postp.dev must still be unable to build.

================================================== BACK ==================================================

Provide:

/back

This returns the player to their previous location.

The previous location should be saved after a successful PosTP teleport.

It should work with:

  • Hub teleport
  • Lobby teleport
  • Spawn teleport

================================================== PERMISSIONS ==================================================

Provide permissions for:

postp.use postp.admin postp.reload postp.dev postp.hub postp.lobby postp.back postp.spawn

The developer permission is specifically used for Hub editing/protection bypass.

================================================== PLACEHOLDERAPI ==================================================

If PlaceholderAPI is installed, PosTP should provide placeholders.

Useful placeholders include:

%postp_world%

%postp_world_enabled%

%postp_hub%

%postp_hub_world%

%postp_is_hub%

%postp_lobby%

%postp_is_lobby%

%postp_current_spawn%

%postp_last_spawn%

%postp_spawn_count%

%postp_spawn_biome%

%postp_countdown%

%postp_cooldown%

%postp_total_teleports%

%postp_is_dev%

%postp_hub_players%

%postp_lobby_players%

These placeholders can be used in TAB, scoreboards, holograms and other PlaceholderAPI-supported plugins.

================================================== OPTIONAL PLUGIN SUPPORT ==================================================

The plugin should be able to work alongside:

  • PlaceholderAPI
  • LuckPerms
  • Multiverse-Core
  • Vault
  • WorldEdit
  • WorldGuard
  • DecentHolograms

These should not be required for the basic PosTP system.

If they are installed, PosTP can use their functionality where appropriate.

================================================== CONFIGURATION ==================================================

The server owner should be able to configure:

  • Enabled worlds
  • INVENTORY GUI title
  • INVENTORY GUI size
  • Spawn item
  • Spawn name
  • Spawn lore
  • Spawn slot
  • Teleport countdown
  • Teleport cooldown
  • Cancel teleport on movement
  • Cancel teleport on damage
  • Hub protection
  • Hub PvP
  • Hub mob spawning
  • Hub explosions
  • Hub weather
  • Hub time
  • Developer permission
  • Messages
  • Sounds
  • Particles

================================================== OVERALL BEHAVIOR ==================================================

The final plugin should work like this:

NPC ↓ NPC executes /postp ↓ PosTP detects player's current world ↓ PosTP opens that world's teleport INVENTORY GUI ↓ Player selects a location ↓ Teleport to saved location

/lobby ↓ Detect current world ↓ Teleport to that world's Lobby

/hub ↓ Ignore current world ↓ Teleport to the global Main Hub

/hubset ↓ Save current location as Main Hub ↓ Automatically protect that world

/postpset Spawn1 add ↓ Save current location ↓ Assign spawn to current world

Hub ↓ No building No breaking No PvP No unwanted mobs No weather changes No explosions

postp.dev ↓ Developer can bypass Hub protection

The plugin must be designed as a professional, clean, configurable teleport and hub-management system for Minecraft Java Edition Paper 1.21.x.

Kodari AI
KodariAug 8 at 3:51 am 4
PosTP
PosTP is a teleport and hub management plugin for Paper 1.21.x that opens a world-aware inventory GUI via /postp, showing only teleport locations belonging to the player's current world. Admins create points with /postpset, set world-specific lobbies with /lobbyset, and a global hub with /hubset. The hub world is automatically protected against building, PvP, mob spawning, explosions, and weather changes, bypassable only with postp.dev. Features configurable teleport countdowns, cooldowns, /back support, full permissions, and optional PlaceholderAPI integration.
  1. Create the Paper/Java 21 project structure, plugin metadata, permissions, and configurable defaults.

  2. Implement persistent teleport points, world lobbies, global hub, cooldown/countdown teleports, /back, and commands.

  3. Implement the current-world inventory GUI with configurable items, lore, slots, sounds, and particles.

  4. Implement hub protection, PvP/mob/weather/time controls, developer bypass, and optional PlaceholderAPI placeholders.

  • Corrected teleport cancellation behavior and empty-menu handling.

  • Fixed Hub weather locking so configured weather states are enforced rather than every weather event being cancelled.

  • Scoped teleport point storage to world + name so common names such as Spawn can exist independently in multiple worlds.

Implemented the PosTP Paper 1.21.x plugin foundation with:

  • /postp world-specific teleport GUI

  • /postpset <name> add/remove and /postpset list

  • Persistent locations including world, coordinates, yaw, pitch, and biome

  • World-specific lobbies via /lobbyset and /lobby

  • Global hub via /hubset and /hub

  • /back support after successful PosTP teleports

  • Configurable countdown, cooldown, movement/damage cancellation

  • Configurable GUI title, size, item material, names, lore, and slots

  • Hub protection with postp.dev bypass

  • Hub PvP, entity damage, mob spawning, explosions, fire, vehicle, hanging entity, weather, and time controls

  • PlaceholderAPI expansion with the requested %postp_*% placeholders

  • NPC-plugin-independent command integration

  • Java 21 and Paper 1.21.x Gradle setup

  • Permissions and configurable messages in plugin.yml and config.yml

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
settings.gradle
Code
22 1,507
src/main/java/com/kodari/postp/PosTPPlugin.java
package com.kodari.postp;

import com.kodari.postp.command.BackCommand;
import com.kodari.postp.command.HubCommand;
import com.kodari.postp.command.HubSetCommand;
import com.kodari.postp.command.LobbyCommand;
import com.kodari.postp.command.LobbySetCommand;
import com.kodari.postp.command.PostpCommand;
import com.kodari.postp.command.PostpSetCommand;
import com.kodari.postp.config.Settings;
import com.kodari.postp.data.LocationManager;
import com.kodari.postp.gui.TeleportMenu;
import com.kodari.postp.listener.GameplayListener;
import com.kodari.postp.listener.ProtectionListener;
import com.kodari.postp.placeholder.PosTPExpansion;
import com.kodari.postp.teleport.TeleportManager;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public class PosTPPlugin extends JavaPlugin {
    private Settings settings;
    private LocationManager locationManager;
    private TeleportManager teleportManager;
    private TeleportMenu teleportMenu;
    private ProtectionListener protectionListener;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        settings = new Settings(this);
        locationManager = new LocationManager(this);
        teleportManager = new TeleportManager(this);
        teleportMenu = new TeleportMenu(this);
        protectionListener = new ProtectionListener(this);

        registerCommand("postp", new PostpCommand(this));
        registerCommand("postpset", new PostpSetCommand(this));
        registerCommand("lobby", new LobbyCommand(this));
        registerCommand("lobbyset", new LobbySetCommand(this));
        registerCommand("hub", new HubCommand(this));
        registerCommand("hubset", new HubSetCommand(this));
        registerCommand("back", new BackCommand(this));

        Bukkit.getPluginManager().registerEvents(new GameplayListener(this), this);
        Bukkit.getPluginManager().registerEvents(protectionListener, this);
        Bukkit.getScheduler().runTaskTimer(this, () -> {
            if (locationManager.getHub() != null && locationManager.getHub().getWorld() != null) {
                protectionListener.enforceWorldSettings(locationManager.getHub().getWorld());
            }
        }, 1L, 20L);

        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            new PosTPExpansion(this).register();
            getLogger().info("PlaceholderAPI expansion registered.");
        }
    }

    @Override
    public void onDisable() {
        Bukkit.getScheduler().cancelTasks(this);
    }

    private void registerCommand(String name, Object executor) {
        PluginCommand command = getCommand(name);
        if (command == null) {
            getLogger().severe("Command is missing from plugin.yml: " + name);
            return;
        }
        if (executor instanceof org.bukkit.command.TabCompleter completer) {
            command.setTabCompleter(completer);
        }
        command.setExecutor((org.bukkit.command.CommandExecutor) executor);
    }

    public Settings getSettings() {
        return settings;
    }

    public LocationManager getLocationManager() {
        return locationManager;
    }

    public TeleportManager getTeleportManager() {
        return teleportManager;
    }

    public TeleportMenu getTeleportMenu() {
        return teleportMenu;
    }
}