PLua is a plugin for the Pumpkin Minecraft server that enables loading and managing plugins written in Lua. This is a translation layer/runtime that allows server administrators to extend their Pumpkin server with Lua scripting capabilities.
New! PLua now supports loading Lua plugins directly from the server's plugins directory! Learn more
Pre-built binaries for the most common architectures are available from GitHub Releases:
| Platform | Architecture | Download |
|---|---|---|
| Linux | amd64 | Download |
| Linux | arm64 | Download |
| Windows | amd64 | Download |
Download the appropriate file for your platform and place it in the plugins directory of your Pumpkin server.
You can also download all platform builds from the latest release page.
If you prefer to build from source:
# Clone the repository
git clone https://github.com/PumpkinPlugins/PLua.git
cd PLua
# Build the plugin
cargo build --release
# The compiled plugin will be in target/release/For cross-compilation, you can specify the target platform:
# For Linux ARM64
rustup target add aarch64-unknown-linux-gnu
cargo build --release --target aarch64-unknown-linux-gnu
# For Windows
rustup target add x86_64-pc-windows-gnu
cargo build --release --target x86_64-pc-windows-gnu- Load and manage Lua plugins
- Enable/disable plugins via in-game commands
- Hot reload plugins without restarting the server
- Simplified API for Lua plugins to interact with the Pumpkin server
There are two ways to use PLua: via the traditional method (using /plua commands) or via the new direct plugin loading feature.
-
Install the plugin by downloading a pre-built binary or building from source.
-
Copy the compiled
.soor.dllfile to your Pumpkin server's plugins directory. -
Start or restart your Pumpkin server.
-
The plugin will create a
plugins/pluadirectory with apluginssubdirectory where Lua plugins will be stored. -
Install some Lua plugins or create your own and place them in the
plugins/plua/pluginsdirectory. -
Enable plugins using the in-game commands (see below).
-
Install PLua as described above.
-
Place your
.luaor.luaufiles directly in the server'spluginsdirectory. -
Start or restart your server - your Lua plugins will be loaded automatically as first-class server plugins.
PLua provides the following in-game commands:
/plua list- Lists all available Lua plugins and their status/plua enable <plugin_name>- Enables a plugin/plua disable <plugin_name>- Disables a plugin/plua reload- Reloads all plugins/plua reload <plugin_name>- Reloads a specific plugin/plua info <plugin_name>- Shows detailed information about a plugin
You can create either a traditional PLua plugin (in plugins/plua/plugins) or a direct Lua plugin (in plugins). Each plugin must have:
- A
PLUGIN_INFOtable with metadata on_enableandon_disablefunctions (optional but recommended)
-- Plugin metadata and lifecycle functions (required)
return {
name = "MyPlugin",
description = "An awesome plugin",
version = "1.0.0",
author = "Your Name",
-- Called when the plugin is enabled
on_enable = function()
pumpkin.log.info("MyPlugin enabled!")
-- Your initialization code here
end,
-- Called when the plugin is disabled
on_disable = function()
pumpkin.log.info("MyPlugin disabled!")
-- Your cleanup code here
end
}For more complex examples, check the examples directory in this repository.
PLua exposes a global pumpkin table with the following functionality:
pumpkin.log.info("Information message")
pumpkin.log.warn("Warning message")
pumpkin.log.error("Error message")
pumpkin.log.debug("Debug message")-- Send a message to all players
pumpkin.server.broadcast_message("Hello everyone!")-- Register event listeners
local join_listener = pumpkin.events.register_listener("player_join", function(event)
pumpkin.log.info("Player joined: " .. event.player_name)
-- Access event data: event.player_name, event.player_uuid, event.join_message
end)
local chat_listener = pumpkin.events.register_listener("player_chat", function(event)
pumpkin.log.info("Chat message: " .. event.message)
-- Access event data: event.player_name, event.player_uuid, event.message, event.recipients
end)
-- Multiple plugins can register for the same event without conflicts
-- Each listener gets a unique ID that combines plugin name, timestamp and random value
print(join_listener) -- e.g. "listener_MyPlugin_player_join_1683724592123_3829572093"
-- Unregister event listeners
pumpkin.events.unregister_listener("player_join", join_listener)
pumpkin.events.unregister_listener("player_chat", chat_listener)- PLua scans the
pluginsdirectory for.luafiles - It loads and evaluates each plugin file to get its manifest (which contains metadata and lifecycle functions)
- Enabled plugins are initialized by:
a. Loading the plugin script
b. Calling its
on_enablefunction from the manifest - When plugins are disabled, their
on_disablefunction from the manifest is called
PLua includes an event system that allows Lua plugins to respond to game events. Currently supported events:
Triggered when a player joins the server.
Event data:
player_name: The name of the playerplayer_uuid: The UUID of the playerjoin_message: The join message
Triggered when a player leaves the server.
Event data:
player_name: The name of the playerplayer_uuid: The UUID of the playerleave_message: The leave message
Triggered when a player sends a chat message.
Event data:
player_name: The name of the playerplayer_uuid: The UUID of the playermessage: The content of the chat messagerecipients: The number of players who will receive the message
Triggered when a player places a block.
Event data:
player_name: The name of the playerplayer_uuid: The UUID of the playerblock_placed: The type of block being placedblock_against: The type of block being placed againstcan_build: Whether the player is allowed to build in this location
Triggered when a block is broken.
Event data:
player_name: The name of the player (if a player broke it, otherwise nil)player_uuid: The UUID of the player (if a player broke it, otherwise nil)block_type: The type of block that was brokenposition_x,position_y,position_z: The coordinates of the blockexperience: The amount of experience that will dropdrop_items: Whether items will drop from this block
See the examples/hello_event and examples/event_logger directories for sample plugins that use the event system.
PLua now supports loading Lua plugins directly from the server's plugins directory, making them first-class citizens in the Pumpkin ecosystem.
- Seamless Integration: Lua plugins appear alongside native plugins in the server's plugin list.
- Standard Management: Use the server's plugin management commands instead of dedicated
/pluacommands. - Full Lifecycle: Direct plugins follow the same lifecycle as native plugins.
- Type Safety: Use Luau's strict typing for more robust plugins.
- Create a
.luaor.luaufile that returns a table with your plugin manifest (metadata and lifecycle functions). - Place it directly in the server's
pluginsdirectory. - Add
--!strictat the top of your file to enable Luau's type checking (optional but recommended).
Traditional PLua plugins continue to work as before. You can use both approaches side-by-side.
- More events (entity interactions, inventory actions, etc.)
- Command registration API
- Player and world manipulation
- Task scheduling
- Configuration file API for Lua plugins
- Improved Luau type definitions
Same license as the Pumpkin server.