Skip to content

Add experimental Velocity plugin reload support#95

Draft
MrSimpleJS wants to merge 23 commits into
Test-Account666:masterfrom
MrSimpleJS:Velocity
Draft

Add experimental Velocity plugin reload support#95
MrSimpleJS wants to merge 23 commits into
Test-Account666:masterfrom
MrSimpleJS:Velocity

Conversation

@MrSimpleJS

@MrSimpleJS MrSimpleJS commented Jul 14, 2026

Copy link
Copy Markdown

This PR adds experimental runtime plugin management for Velocity 3.4.0 through 4.1.0. Newer versions use the Velocity 4.x adapter after runtime capability checks.

PlugManX can now load, unload, enable, disable, restart, and reload compatible Velocity plugins without restarting the proxy.

Java 25 or newer is required. Velocity has no official runtime reload API, so this development build uses capability-checked internal APIs that may require updates when Velocity changes.

Features:

  • Runtime loading, unloading, enabling, disabling, restarting, and reloading
  • Support for Velocity 3.4.0 through 4.1.0
  • Version-specific adapters for Velocity 3.4+ and 4.x
  • Startup validation of required internal classes, fields, methods, and registries
  • Automatic capability checks for newer Velocity builds
  • Reload is disabled safely when required runtime internals are incompatible
  • Serialized operations to prevent concurrent registry and classloader changes
  • Dependency validation and dependency-aware bulk operation ordering
  • Plugin initialization and shutdown lifecycle event handling
  • Fault-tolerant cleanup that continues when individual steps fail
  • Cleanup of listeners, scheduled tasks, commands, messaging channels, registries, and classloaders
  • Classloader-aware packet registry cleanup
  • Packet registry snapshots and per-plugin registration delta tracking
  • Safe removal of exactly the packet mappings added during plugin initialization
  • Fallback cleanup for late or asynchronously registered packet mappings
  • Runtime validation of Velocity StateRegistry and packet registry layouts
  • Protection against duplicate packet registrations after reload
  • Tracking of plugin-owned messaging channels
  • Detection of remaining threads, registrations, classloaders, and other unload leaks
  • Detailed reporting of failed cleanup steps
  • Automatic rollback to the previous JAR when loading or reloading fails
  • Recovery from partial unload and cleanup failures
  • Protection for critical plugins with Velocity-only --force support
  • Console-only Velocity commands to prevent conflicts with backend PlugManX installations
  • Velocity-specific configuration, messages, help output, and plugin lists
  • Colored console output and development-build startup diagnostics
  • Reload timings and detailed diagnostics with velocityReloadDebug: true
  • Crash dumps with unique IDs for runtime and cleanup failures

Showcase:
https://www.youtube.com/watch?v=X3AOtK3jhPo

Download for Velocity:
PlugManX-3.0.5.Velocity.zip

I added experimental Velocity plugin loading, unloading, and reloading with runtime cleanup, platform-specific configuration and messages, startup warnings, detailed diagnostics, reload timings, and a separate versioned Velocity build.
Velocity unload cleanup fault-tolerant, added version-specific runtime adapters, and introduced debug leak detection for remaining listeners, tasks, commands, and plugin threads.
@Test-Account666

Copy link
Copy Markdown
Owner

Wait, how's the disable command going to work?
Velocity doesn't really have that concept?

@Test-Account666

Copy link
Copy Markdown
Owner

Nevermind, I see now.
Though... This could confuse users, no?

@MrSimpleJS

Copy link
Copy Markdown
Author

Yeah, that’s a fair point. On Velocity, “disable” effectively means unloading the plugin, while “enable” loads it again. I’ll make that distinction clearer in the messages and documentation to avoid confusion. keep that?

I clarified that Velocity’s `disable` command fully unloads a plugin and `enable` loads it again, updating the command handling, messages, help output, and documentation accordingly.
@MrSimpleJS
MrSimpleJS marked this pull request as draft July 14, 2026 18:51
…ling

Renamed the experimental Velocity runtime to a Development Build.
Renamed ExperimentalVelocityRuntime to VelocityDevelopmentRuntime.
Updated startup warnings, diagnostics, documentation, and adapter messages.
Added velocityCrashDumps for automatic crash dumps with unique IDs.
Added velocityDevTestFunctions for protected development tools.
Added /plugman dev status and /plugman dev crashdump.
Added the plugman.dev permission.
Added Velocity version, Java version, context, thread, OS, and stacktrace details to crash dumps.
Restricted --force entirely to Velocity.
Added runtime capability checks before parsing --force.
Removed --force from Paper/Bukkit command help, usage text, messages, and documentation.
Added Velocity-specific help entries for commands supporting --force.
Added migration cleanup for old [--force] entries on non-Velocity platforms.
I restricted PlugManX proxy commands to the Velocity console so player commands can reach backend Paper servers, and added verbose development-mode logging for startup details, runtime operations, command execution, and diagnostics.
I separated Velocity from the shared Core and Paper assembly to prevent Paper reload issues. Paper now uses the stable PR Test-Account666#90 implementation, while Velocity is built separately.
I introduced a platform SPI for Velocity-specific behavior, removed the duplicated Core classes and Sonar exclusions, preserved the stable Paper behavior, and verified both builds with all tests passing.
I separated the Velocity console command alias from /plugman, allowing player commands and tab completion to pass through to Paper while keeping Velocity plugin management console-only.
@Test-Account666

Test-Account666 commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Could you clarify the Java 25 requirement, please?
Are you specifically targeting/compiling against Java 25 instead of Java 21?

And is it just the Velocity module?

@MrSimpleJS

Copy link
Copy Markdown
Author

Yes, the Java 25 requirement only applies to the Velocity module because it targets Velocity 4.0 internals. The Core, Paper, Bukkit, and Bungee modules remain on Java 21.

I aligned the Velocity Maven build with Java 25. Falling back to Java 21 would require dropping Velocity 4.0 support or publishing a separate Java 21 artifact for older Velocity versions.

@Zoriot Zoriot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that works great so far. I had to make the changes to make it build locally.

Comment thread pom.xml
Comment thread plugman-velocity/pom.xml Outdated
added classloader-aware packet registry cleanup during plugin unload and failed-load rollback to prevent duplicate packet registrations.

This currently works only on Velocity 4.0; I will test and add support for older Velocity versions later.
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants