GameModeManager
Gameplay v1.0.2Separate inventories and player state per gamemode, with world-change handling to preserve gamemode.
GameModeManager
Manages separate inventories and player states per gamemode, with world-change handling to preserve gamemode.
Features
- Tracks separate inventories for
CREATIVEandSURVIVALonly. - Stores inventory contents (41 slots), health, food, saturation, total experience, level, exp, and active potion effects.
- On gamemode change, captures the current state and applies the stored state for the new gamemode.
- On world change, captures the current gamemode before teleport/portal and restores it after the world change.
- Saves player data to
playerdata/<uuid>.yml. - Loads data on join, saves on quit, and saves all online players on plugin disable.
- Reload command for
config.yml.
Commands
| Command | Description | Permission |
|---|---|---|
/gmmanage / /gmm |
Show help | gmmanage.use |
/gmmanage help |
Show help | gmmanage.use |
/gmmanage reload |
Reload configuration | gmmanage.use + gmmanage.reload |
Permissions
| Permission | Description | Default |
|---|---|---|
gmmanage.* |
All GameModeManager permissions | op |
gmmanage.use |
Allows using the /gmmanage command | op |
gmmanage.reload |
Allows reloading the configuration | op |
Configuration
config-version: 1
messages:
no_permission: "&cYou don't have permission to use this feature!"
reloaded: "&aConfiguration reloaded!"
unknown_subcommand: "&cUnknown subcommand. Use &6/gmmanage help"
help:
- "&6/gmmanage reload &7- Reload the configuration"
- "&6/gmmanage help &7- Show this help"
Notes
- Only
CREATIVEandSURVIVALare tracked. Other gamemodes are ignored by the inventory/state manager. - Pending world-switch gamemodes are stored in memory and cleared on quit.
- Player data is stored per UUID under
playerdata/.
Dependencies
Bundles Adventure (adventure-platform-bukkit) inside its JAR,
relocated to com.chalwk.libs.adventure. No external dependencies.
Changelog
1.0.2
Changed
- Adventure (
adventure-platform-bukkit) is now shaded into the plugin JAR and relocated tocom.chalwk.libs.adventure. Runs on Spigot, Paper, and Purpur.
Fixed
- Reload no longer rewrites
config.yml. Comments and formatting are preserved across reloads.
Internal
MessageHelperis now an instance class wrappingBukkitAudiences, created inonEnableand closed inonDisable.GameModeCommandnow receives theMessageHelperinstance via constructor.
1.0.1
Fixed
PlayerQuitEventnow clears pending gamemode state viaclearPendingGameMode(UUID), preventing a stale entry from leaking between sessions if a player disconnects mid-world-switch.GameModeListener#onGameModeChangenow checksevent.isCancelled()before swapping inventories. Previously a cancelled gamemode change (e.g. by a protection plugin) would still trigger an inventory swap and desync state.WorldSwitchListenerno longer registers a separatePlayerPortalEventhandler.PlayerPortalEventextendsPlayerTeleportEvent, so the portal path was already covered by the teleport handler - the duplicate listener was dead code that could double-fire on portal traversal.
Changed
- Help and unknown-subcommand output moved out of Java source and into
config.yml./gmmanage helpnow reads from a newmessages.helplist, and the unknown-subcommand message ismessages.unknown_subcommand. Both are exposed throughPluginConfigand can be edited without rebuilding the plugin. - Tab completion for
/gmmanage reloadnow respects thegmmanage.reloadpermission, matching the command’s own permission check. Previously the subcommand was suggested to every player withgmmanage.use. - Case-insensitive comparison in tab completion uses
Locale.ROOT. - Startup, shutdown, and reload log lines no longer use exclamation marks and no longer advertise the plugin’s purpose on every enable (the description lives in
plugin.yml).
Internal
getCommand("gmmanage")is null-checked inonEnable. If the command is missing fromplugin.yml, the plugin logs a clear error and disables itself instead of throwing an NPE at startup.PluginConfig#getHelpLines()returns an unmodifiable list, so callers cannot mutate the config-backed help output.ConfigManagerandPluginConfignow carry class-level Javadoc.
1.0.0
- Initial release.