MineLua 2 - Lua for Minecraft
MineLua 2 - Lua for Minecraft
MineLua 2 is the new update for MineLua. MineLua is a java based plugin there allows you coding in lua, this means you simply can create lua scripts and run them on your server. The plugin has some features as custom api and encryption there gives you extra abilities.
For developers:
The plugin is based on LuaJ 3.0.1 which is a java to lua / lua to java converter,
That means do you make an addon is it a good thing to know little about LuaJ's api
LuaJ Homepage
Source code
Default Settings:
- Script folder: ./plugins/MineLua/scripts/
- Encrypted files folder: ./plugins/MineLua/encrypted/
- Auto encryption status: false
- File extension: .lua
- Encrypted extension: .clua
- Auto load scripts: true
Features:
- Custom Commands
- Tab Complete System
- Bukkit / Spigot API
- MineLua API
- Auto Encryption System
- Simple Config
- Skript Addon
Introduction:
You can use the bukkit javadocs: Bukkit Javadocs
Let's start:
function onEnable(plugin)
--Plugin Infomation
plugin:setName("MineExample")
plugin:setVersion("1.0.1")
plugin:setDescription("This is a example plugin")
end
function onDisable(plugin)
--Disable code here....
end
Now lets hook a event:
function onEnable(plugin)
--Plugin Infomation
plugin:setName("MineExample")
plugin:setVersion("1.0.1")
plugin:setDescription("This is a example plugin")
--Hook event
plugin:hookEvent("PlayerJoinEvent", onjoin)
end
function onJoin(event)
event:setJoinMessage(nil)
local player = event:getPlayer()
broadcast("§4" .. player:getName() .. " §chas joined the game!")
end
Let's try make a command:
function onEnable(plugin)
--Plugin Infomation
plugin:setName("MineExample")
plugin:setVersion("1.0.1")
plugin:setDescription("This is a example plugin")
--Make a command
plugin:bindCommand("test", command)
end
function command(player, args)
broadcast("Command executed by " .. player:getName())
player:sendMessage("Arg 1 of command is: " .. args[1])
end
Let's add a tabcompleter:
function onEnable(plugin)
--Plugin Infomation
plugin:setName("MineExample")
plugin:setVersion("1.0.1")
plugin:setDescription("This is a example plugin")
--Hook event
plugin:hookEvent("TabCompleteEvent", tabComplete)
--Make a command
plugin:bindCommand("test", command)
end
function command(player, args)
broadcast("Command executed by " .. player:getName())
player:sendMessage("Arg 1 of command is: " .. args[1])
end
function onTabComplete(event)
if event:getCommand():getName() == "test" then
local List = luajava.new(luajava.bindClass("java.util.ArrayList"))
List:add("help1")
List:add("help2")
List:add("help3")
List:add("help4")
event:setResult(List)
end
end
More detailed docs please?
Great plugin! I wonder where are functions such as
broadcast()
are defined? I tried looking trough source code, and couldn't find any.Thanks!