Home›Java›Mods›LuaInMinecraftBukkit
LuaInMinecraftBukkit
ModsJava

LuaInMinecraftBukkit

Java mod listed for Minecraft 1.7–1.18. Downloads from the MC Java Mods app on Android.

⬇ Download on Spigot
LuaInMinecraftBukkit.png

LuaInMinecraftBukkt


Using lua script to make Bukkit plugin.​

There are two lua script running modes here. The first one is default one, it is lua VM made by Java, and supports to lua 5.2. And the other one is native vm, it is supports to lua 5.4; about this mode, it is just support the server which is running in Windows or Linux, not MacOS.

Introduction | Quick Start | Register Command | Register Listener | luaBukkit

use C/C++ to help lua script
Linking C/C++ Shared Library at Minecraft Server | Use FFI Library in Minecraft Server

More information go to wiki, please: https://github.com/SmileYik/LuaInMinecraftBukkt/wiki
If you like this plugin, please help me to translate wiki, thank you very much! ​

Java to calculate 1 plus to 1000000000, it used time: 25s
[​IMG]

Mode 2 to calculate 1 plus to 1000000000, it used time: 14s
[​IMG]

Mode 1 to calculate 1 plus to 1000000000, it used time: bukkit break.

Install:
download this plugin, put in plugins folder and restart server.

Add a lua script plugin:
when you add this plugin, it will create a folder named 'plugins' in '[bukkit's plugins folder]/LuaInMinecraftBukkit/plugins'

into '[bukkit's plugins folder]/LuaInMinecraftBukkit/plugins' folder, and then create a folder named 'HelloLua' (You can make any name you want, in this example i call it HelloLua).

then, make a file named 'lua_plugin.yml' and write these text in this yml file.
Code (YAML):
# Display Name
displayName
: My Lua Plugin
# lua script id, make sure as same as folder name, and just contants a-zA-Z0-9
id
: HelloLua
# author
author
: SmileYik
# version
version
: 1.0
# dependens lua script ids
dependents
: [ ]
# soft dependents lua script ids
softDependents
: [ ]
after modify 'lua_plugin.yml', make a file named 'main.lua', and write
Code (Text):

-- get logger
local logger = self:getLogger()

command = {}
listener = {}

-- onEnable function will be run after load this script.
function onEnable()
   logger:info("Hello lua!!!!!")

   -- register a command
   -- param two allow this format: '<lua script id>.<function>'
   -- in this example, my lua script named 'HelloLua',
   -- and this function is 'command.dispatch'.
   -- then i will use 'HelloLua.command.dispatch'
   luaBukkit.commandRegister:registerCommand(
       "test", "HelloLua.command.dispatch"
   )
   -- register a player join event
   -- the param two is as same as register command.
   luaBukkit.eventRegister:registerListener(
       "PlayerJoinEvent", "HelloLua.listener.onPlayerJoin", 2
   )
end

-- onDisable function will be called after disable this script plugin.
function onDisable()
   logger:info("I am disabled!")
end

function listener.onPlayerJoin(event)
   local playername = event:getPlayer():getName()
   event:setJoinMessage("Nice to meet you,  " .. playername)
   event:getPlayer():sendMessage("Hi" .. playername)
end

function command.dispatch(arg, sender, strs)
   args = {}
 
   if (sender == nil) then
       args.isPlayer = arg[1]
       args.sender = arg[2]
       args.args = arg[3]
   else
       args.isPlayer = arg
       args.sender = sender
       args.args = strs
   end

   -- isPlayer(bool), sender(who), args(command params)
   if (args.args[2] == "openInventory" and args.isPlayer) then
       local inv = luaBukkit.server:createInventory(NIL, 27, "First window~")
       args.sender:openInventory(inv)
       logger:info("excute command over")
       return
   end
   args.sender:sendMessage("this command is wrong!")
end

logger:info("Hello Lua, loaded!")
 
In quick start documentation you can see the running picture like that.
[​IMG]
[​IMG]


Have fun! ;)

Commands

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

LuaInMinecraftBukkit is a free Minecraft Java mod. Compatible with Minecraft 1.7, 1.8, 1.9, 1.10 and newer. Downloaded 348 times (via Spigot). Download it and open it directly in the game.

Explore more