Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix plugin reload only reloading main command. #167

Merged
merged 2 commits into from
Jan 12, 2025
Merged

Fix plugin reload only reloading main command. #167

merged 2 commits into from
Jan 12, 2025

Conversation

BlitzOffline
Copy link
Member

To explain the issue, Spigot is maintaining a reference of the Command object in a map for the main command, for aliases, for the labeled command (deluxemenus:command) and for labeled aliases.

The fix required the removal of all references from the map.

There is still one remaining issue and that is the SimpleCommandMap from CraftBukkit that holds a reference to the Command even after removing it. Since it is CraftBukkit, it would require extra work to remove the references from that map as there is no method for this in the Bukkit API.

Instead, I have extracted the Command from the Menu, passed a reference of the Menu to the Command and then released the reference to the Menu whenever the Command is unregistered. This results in the Command remaining in memory but not the Menu.

  • Fixed reload of registered menu commands
  • Upgraded gradle and gradle plugins
  • Upgraded libraries

Closes #3 and #166

Tested on Paper 1.21.3!

- Fixed reload of registered menu commands
- Upgraded gradle and gradle plugins
- Upgraded libraries
@Kqliber Kqliber merged commit 44192ea into main Jan 12, 2025
1 of 2 checks passed
@Kqliber Kqliber deleted the issue/3 branch January 12, 2025 16:26
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.

/dm reload does not always update menus
2 participants