This plugin allows you to write Lua scripts to interact with Minecraft server events and create custom commands.
plugin- The plugin instance (JavaPlugin)Class(name)- Returns a Java class by fully-qualified name (cached)runLater(ticks, fn)- Run a Lua callback on the main thread afterticksrunRepeating(delayTicks, periodTicks, fn)- Run a Lua callback repeatedly on the main threadrunAsync(fn)- Run a Lua callback asynchronously (do not call Bukkit API async)runAsyncLater(ticks, fn)- Run a Lua callback asynchronously aftertickscancelTask(taskId)- Cancel a scheduled task by idcancelAllTasks(nil)- Cancel all tasks created by scripts
Class() is intended for admin-only scripts and provides access to any class available on the server classpath.
- Getting Started
- Event System
- Command System
- Player API
- World API
- Entity API
- Inventory API
- Server API
- Logger API
- Bukkit Integration
-- Listen to block break events
on("BlockBreakEvent", function(event)
local player = event:getPlayer()
player:sendMessage("You broke a block!")
end)
-- Register a command
registerCommand("hello", "permission.hello", function(sender, args)
sender:sendMessage("Hello, " .. sender:getName() .. "!")
end)All Lua scripts should be placed in the LuaScripts folder in your server's root directory. Scripts are automatically loaded when the server starts or when using the /luascript command with the following subcommands:
reloadall- Reload all scriptslist- List all scripts found in theLuaScriptsfolderrun <script>- Run a specific scriptreload <script>- Reload a specific script