Lukkit - Lua for Bukkit
3,744 Downloads
Last Updated: Jul 13, 2013
Game Version: 1.6.1
Lukkit v1.0-alpha5
It's back! The plugin that allows you to write other plugins in Lua is now at version 1.0 with a complete re-write. With the new version you have access to ALL Bukkit functions and events.
Documentation
For documentation, go to the Bukkit docs and the Lukkit wiki.
Download
Go to the Files tab to download the alpha release
Help
If you need some help with Lukkit you can post in the forums. Make sure to take a look at the examples and documenation.
Examples
More examples are available on github
-- Add command /shout to broadcast a message to the server -- Command name, short description, command usage lukkit.addCommand("shout", "Broadcast a message to the server", "/shout Your message here", function(sender, args) broadcast(table.concat(args, " ")) end)
-- Only allow ops to break blocks events.add("blockBreak", function(event) if not event:getPlayer():isOp() then broadcast(stringOf(format.RED) .. "You are not allowed to break blocks") event:setCancelled(true) end end)
-- lukkit.addPlugin(pluginName, pluginVersion, pluginContent) local helloPlugin = lukkit.addPlugin("HelloPlugin", "1.0", function(plugin) plugin.onEnable(function() plugin.print("HelloPlugin v" .. plugin.version .. " enabled") end) plugin.onDisable(function() plugin.warn("HelloPlugin v" .. plugin.version .. " disabled") end) -- At the moment naming a command with a capital letter will stop the command from being deregistered when running /lukkit reload or /lukkit resetenv plugin.addCommand("hello", "Send the sender the message 'Hello, world!'", "/hello", function(sender, args) sender:sendMessage("Hello, world!") end) -- Set the value if not already in the config -- plugin.config.setDefault(path, value) plugin.config.setDefault("test.bool", false) plugin.config.setDefault("test.int", 45) -- Set the value regardless of if it already exists -- plugin.config.set(path, value) plugin.config.set("test.float", 4.7) plugin.config.set("test.string", "a string") -- plugin.config.get(path, default) plugin.config.get("test.bool", true) -- Remove the config option plugin.clear("test.float") -- Save the config to file plugin.config.save() end)
Videos
Overview with examples from VX | cheese
How would one go about using an event such as PlayerChangedWorldEvent? I've tried just about every way I can think of to bind it, add it, etc, but nothing works. I'm trying to have the event cancel if a player would be sent to a specific world, or at least send them back out of it.
@UnwrittenFun
Understandable. However my next question becomes is it possible to write an LUA Plugin that uses Lukkit that will hook into those APIs? As opposed to adding generic support for it like the original question.
@HalestormXV
It's possible, however I won't be doing it xD
Is there anyway to hook this into the cauldron/forge API as well? So that you can get program full plugins that work with mods? Or mater of fact hook it into any other pugin/mod API like GriefPrevention or Botania
@Azazaav14
Okay, let's get started.
Read the wiki and make sure that syntax function is available for your version of Lukkit.
Getting the latest version of Lukkit is the best way.
@greenteaf
Don't use a variable if your assigning the function to a table. Tables are only used for more then one function or item for a module script.
To fix your module script problem:
Inside of your module script
Main.lua
Hello. I tried to use your example:
But I got error: [21:18:25 WARN]: [Lukkit] @D:\DATA\Servers\MS17-18W\plugins\Lukkit\1.lua:1 attem pt to index ? (a nil value)
@GlassOrganization
Thanks for the reply.
I'm new to the Lua file including, since the other game that uses Lua doesn't require me to include files. :c
Using:
Heres what I tried:
and
and other similar trys, but none of them work, always got "module XXX not found"
@greenteaf
Tell me your version of Lukkit. Can you also show me what you did for the require function? Like for example:
Does it support 'require' or something else that can import other .lua files?
I'v tried many ways, but it always returns this:
I'd like to know if we can use others library like the effectLib or the barApi and if we can, how is it possible.
Thanks.
This plugin has been giving me a lot of trouble. I don't know what's wrong. Not a single API function is working, except for broadcast(), but it only works when I change it to server.broadcast(). Otherwise, and for all other API functions I get an "Error: Attempt to call nil". And I just tried storing the .lua file in a subdirectory, and now the plugin won't see it at all. I'm sure I'm not doing anything wrong because I copied the examples directly from this page, and they didn't work. Please help! I want to be able to use this plugin!
Hello everyone, I was wandering thrugh plugins and this one makes me feel... let's say feel satisfied.
I haven't read whole wiki yet, but I wanna post some ideas: 1. Access to create some little HUD from effect list, with ablity to loop messages. Example: When player is going to check his vault.money, he is going thrugh command to know his balance, I wanna write script that creates emty, infinte effect with name "Money" and duration with string equal to players balance. Loop useless here but maybe in future I wanna do some pvp server and looped effect will be good for ranking, that's I wanna write script that makes effect with player name that have most kills and: effect name: <playername_with_most_kills> duration: <no_of_kills> after 1s: effect name: <playername_with_2nd_most_kills> duration: =||= and... this loop will be till the last player on the server.
2. I wanna see some fancy stuff like integer with idle time, string of weapon with most kills, "punch" log like I punching someone, and I takes his playername => this can be used to create some stick thats teleorting someone to the spawn...
Have nice time, Daniel
@vxcheese
player:getInventory()
How can I get a player's inventory?
If possible, could you create a backport to 1.6.4? I'm running Bukkit 1.6.4 and unable to upgrade for various reasons. The plugin looks amazing and I'd really like to use it. Writing a plugin in Lua is a lot less work than writing it in Java. Hopefully you can create a backport, thanks in advance.
EDIT: Nevermind. I ended up just coding the plugin in Java.
@UnwrittenFun
oops!
@Lord_Cuddles
server:getPlayer not server.getPlayer
player = server.getPlayer("Lord_Cuddles") returns the error:
bad argument: userdata expected, got string
is it possible to write Minigames with this?!