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.import
script.onLoad
->script:onLoad
script.onUnload
->script:onUnload
script.hook
->script:registerListener
script.registerSimpleCommand
->script:registerCommand
script.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
true
it works exactly the same asconsoleOnly
except 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