Code Patterns
Copy-paste examples for common plugin tasks. Commands, events, ECS, GUI, and more.
Command Patterns
60/add command using AbstractAsyncCommand
Create async commands that open custom GUIs. Use CompletableFuture.runAsync with world executor.
Pattern for async commands that need to access the world/ECS. Based on working AdminUI code.
/autosave command using AbstractCommand
/changeworld command using CommandBase
/admin command using AbstractAsyncCommand
Control who can use commands with setPermissionGroup() using GameMode enum.
Use various argument types: STRING, INTEGER, DOUBLE, BOOLEAN, PLAYER_REF, WORLD, ITEM_ASSET, BLOCK_TYPE_KEY, GAME_MODE, etc.
Create a command with required and optional arguments using ArgTypes.
Useful helper methods on CommandContext for player commands.
/config command using AbstractCommand
/debug command using AbstractCommand
/test command using CommandBase
/finish command using AbstractAsyncCommand
/hidepois command using AbstractCommand
/hidewarps command using AbstractCommand
/hideplayers command using AbstractCommand
/hideunexploredpoi command using AbstractCommand
/hideunexploredwarps command using AbstractCommand
/loot command using AbstractCommand
/show command using AbstractAsyncCommand
/spawn command using AbstractCommand
/map command using AbstractCommand
/radius command using AbstractCommand
/maxscale command using AbstractCommand
/minscale command using AbstractCommand
/quality command using AbstractCommand
/vote command using CommandBase
/markerteleport command using AbstractCommand
/maxchunks command using AbstractCommand
/memory command using CommandBase
/menu command using AbstractPlayerCommand
Create a command that requires a player context. Extends AbstractPlayerCommand for automatic ECS parameter injection.
/location command using AbstractCommand
/maxscale command using AbstractCommand
/minscale command using AbstractCommand
/radarrange command using AbstractCommand
/radar command using AbstractCommand
Register a command in the plugin setup() method.
/reload command using AbstractCommand
/shareallexploration command using AbstractCommand
/shop command using CommandBase
/adminshortcut command using AbstractAsyncCommand
/show command using AbstractAsyncCommand
Create a simple command using AbstractCommand. Best for server-wide commands or when you dont need ECS/player access. Supports async execution via CompletableFuture.
/spawn command using AbstractCommand
/spectator command using CommandBase
Create a synchronous command using CommandBase. Runs on main thread, good for simple commands that need immediate world access.
Enable/disable player flight using MovementManager and MovementSettings. Based on working Simple Fly mod by davidhenk.
/track command using AbstractCommand
/t command using AbstractAsyncCommand
/untrack command using AbstractCommand
/add command using AbstractPlayerCommand
/waypoint command using AbstractCommand
/remove command using AbstractPlayerCommand
/removeglobal command using AbstractPlayerCommand
/id command using AbstractPlayerCommand
/list command using AbstractPlayerCommand
/waypointteleport command using AbstractCommand
/update command using AbstractPlayerCommand