fix: prevent redundant class lookups
LuaLink V2
LuaLink V2 has been completely rewritten from scratch. It now makes use of LuaJava with LuaJIT (previously LuaJ). Previous scripts made with V1 will need some changes. Below is a list of some of the documented breaking changes
Breaking Changes
Function's renamed
import->java.importscript.onLoad->script:onLoadscript.onUnload->script:onUnloadscript.hook->script:registerListenerscript.registerSimpleCommand->script:registerCommandscript.getServer- >server
Functions removed:
utils.instanceOf- Use Java's native Class.isInstance() method instead
-- Old way (v1) if not utils.instanceOf(causer, "org.bukkit.entity.Player") then return end -- New way (v2) local Player = java.import("org.bukkit.entity.Player") -- This would usually go at the top of your script. if not Player.class:isInstance(causer) then return end
- Use Java's native Class.isInstance() method instead
Please see the docs for more info on creating scripts
- Add a playerOnly option to command metadata
- If this is set to
trueit works exactly the same asconsoleOnlyexcept restricts it to players only.
- If this is set to
- Ability to disable scripts
- You can now disable scripts via /lualink disable|enable
- Disabling a script will unload it and prevent it from automatically being loaded on start
- Bump version
Resolve #15 and some code cleanup
Code Cleanup
- Improved code organization.
Structural Changes
- Moved script loading and unloading responsibilities to a dedicated script manager class.
- Scripts now load when the ServerLoadEvent is triggered, enhancing plugin performance and startup.
Breaking Changes
- Breaking:
onEnableandonDisablemethods have been removed from the script lifecycle.- Recommendation: Use
onLoadandonUnloadas alternative methods for initialization and cleanup.
- Recommendation: Use


