Lukkit - Lua for Bukkit
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
luajava.findClass("some.plugin.class.path") Does not seem to work, only with bukkit classes
I'm guessing it is due to bukkits seperation of plugins with their own classloader.
So how would you go about fixing this issue?
@UnwrittenFun
Thanks!
@z0fa
Interesting quirk there with bukkit expecting an array of ItemStacks for addItem, although in Java you could just supply one, in lua you must force an array
simply change this
to
note the {} around thorHammer
@Citnam
Find it here (github)
So.... What's the ETA on 1.7.9? :3
What does it take to come up to speed with the latest version? Need any help?
I get "coercion error java.lang.IllegalArgumentException: argument type mismatch" with this code :S
@UnwrittenFun
Could you add support for the creation and detection of folders too?
Edit: and the option to write to a new line, instead of replacing the entire file?
@UnwrittenFun
Ahhh, great thank you! You did right here btw.
@Nabakin
It's plugin.readFile (I may have said it was plugin.read somewhere by accident)
could someone please give me an example of how to use the plugin.read function?
@UnwrittenFun
YES, THANK YOU!
@UnwrittenFun
What would the whole code look like if i wanted it at a specific location?
@DaGamerMinecraft
Assuming you have already got the block just do
You can replace STONE with anything here
Love that this plugin is back up and managed.
Requesting some type of network socket or database socket system, please! This is too good to be isolated to itself.
JSON system would be awesome too. Yes I know there are pure lua solutions for json.
Build it, and plenty will come... =)
@UnwrittenFun How do I set blocks in a plugin.
NVM I got it to work
@UnwrittenFun What Would The Whole Text Look Like Because I Am Not The Best At Programming.
Lukkit v1.0-alpha5 is out
You can grab it from github until Bukkit approves the file.
New in alpha5:
@DaGamerMinecraft
Assuming you have determined the block is actually a sign, the following should work (haven't tested):
Then you would just check if the text is equal to the text you want
@glessimus
I've yet to add a method plugins that allow you to get the directory for your plugin. Have had some plans to easily make config files, and I guess I could extend that to any file.