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
This is awesome! You can do a lot with this, in half the time you can with bukkit. Lua provides a easy way to write code using a lot less code, and it is easier to learn and understand rather than Java.
+1
@UnwrittenFun
alright that seems nice though eclipse makes it very easy for beginners too lol :P
@UnwrittenFun
Thanks a lot for support.
I've made some kind of weapon
I'm going to make shooter minigame
@glessimus
Here is an example for shooting a snowball when typing /shoot in chat
I have a question. How can i implement this in Lua?
@UnwrittenFun
Everything is fine now. Awesome plugin
@nullschritt
You could use inventoryClick - docs here
You can bind any Java class with luajava.bindClass("class.name.here") so you may be able to do it that way, otherwise I would need to add support for that.
@glessimus
Sorry about that, my bad, new version until Bukkit approves - github
@nedurland
Their are some examples on github now
could you make an example lua plugin, if i copy the code above and put in .lua and then in the lukkit folder and i use the command it doesnt work. it says this in the console: http://f63.net/i/update_available_on_snapr.pw-b211ac100e92098.png
What event would I listen for to get when the user clicks their head slot in their inventory? (I'm trying to make certain blocks auto equip as hats)
Also how do I execute a task outside the main thread? (so I can use sleep/http requests without freezing the whole server)
@UnwrittenFun
Now this error :(
[14:34:29] [Server thread/ERROR]: Error occurred while enabling Lukkit v1.0-alpha2b (Is it up to date?) java.lang.NullPointerException at java.io.Reader.<init>(Unknown Source) [?:1.7.0_51] at java.io.InputStreamReader.<init>(Unknown Source) [?:1.7.0_51] at java.util.Scanner.<init>(Unknown Source) [?:1.7.0_51] at unwrittenfun.minecraft.lukkit.Lukkit.convertStreamToString(Lukkit.java:96) [?:?] at unwrittenfun.minecraft.lukkit.environment.LukkitEnvironment.loadLuaLibs(LukkitEnvironment.java:41) [?:?] at unwrittenfun.minecraft.lukkit.environment.LukkitEnvironment.loadEnvironment(LukkitEnvironment.java:37) [?:?] at unwrittenfun.minecraft.lukkit.Lukkit.onEnable(Lukkit.java:28) [?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:250) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:350) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:389) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at org.bukkit.craftbukkit.v1_7_R1.CraftServer.loadPlugin(CraftServer.java:439) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at org.bukkit.craftbukkit.v1_7_R1.CraftServer.enablePlugins(CraftServer.java:375) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at net.minecraft.server.v1_7_R1.MinecraftServer.m(MinecraftServer.java:342) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at net.minecraft.server.v1_7_R1.MinecraftServer.g(MinecraftServer.java:319) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at net.minecraft.server.v1_7_R1.MinecraftServer.a(MinecraftServer.java:275) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at net.minecraft.server.v1_7_R1.DedicatedServer.init(DedicatedServer.java:175) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:424) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
@thesbros
nothing is impossible in bukkit
@UnwrittenFun
Hey, seems like an awesome plugin, will try it later.
@DeaShiva
It would be impossible to make Bukkit in Lua.
Hi.
Can you create bukkit for lua?. I have a custom server in c (see here a servers on c www.mc-server.org)
Because so i can use essentials and other plugins.
Sry for my bad eng... xD
Yes! I've been waiting to make a project on Minecraft with Lua. Thanks!
@glessimus
That means you have an old version of java (compared to me), what version are you running?I compiled the code with Java 8, that may be the issue, I'll throw up a version compiled with Java 7 and see if that fixes your issue.New Version: You can download the fix for Java 7 from github until it's approved on Bukkit.
Getting error:
[12:56:32] [Server thread/ERROR]: Could not load 'plugins\Lukkit-1.0-alpha2.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: unwrittenfun/minecraft/lukkit/Lukkit : Unsupported major.minor version 52.0 at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:137) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:313) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:236) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at org.bukkit.craftbukkit.v1_7_R1.CraftServer.loadPlugins(CraftServer.java:350) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at org.bukkit.craftbukkit.v1_7_R1.CraftServer.<init>(CraftServer.java:312) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at net.minecraft.server.v1_7_R1.PlayerList.<init>(PlayerList.java:63) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at net.minecraft.server.v1_7_R1.DedicatedPlayerList.<init>(SourceFile:14) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at net.minecraft.server.v1_7_R1.DedicatedServer.init(DedicatedServer.java:126) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:424) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] Caused by: java.lang.UnsupportedClassVersionError: unwrittenfun/minecraft/lukkit/Lukkit : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) [?:1.7.0_51] at java.lang.ClassLoader.defineClass(Unknown Source) [?:1.7.0_51] at java.security.SecureClassLoader.defineClass(Unknown Source) [?:1.7.0_51] at java.net.URLClassLoader.defineClass(Unknown Source) [?:1.7.0_51] at java.net.URLClassLoader.access$100(Unknown Source) [?:1.7.0_51] at java.net.URLClassLoader$1.run(Unknown Source) [?:1.7.0_51] at java.net.URLClassLoader$1.run(Unknown Source) [?:1.7.0_51] at java.security.AccessController.doPrivileged(Native Method) [?:1.7.0_51] at java.net.URLClassLoader.findClass(Unknown Source) [?:1.7.0_51] at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:77) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:62) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at java.lang.ClassLoader.loadClass(Unknown Source) [?:1.7.0_51] at java.lang.ClassLoader.loadClass(Unknown Source) [?:1.7.0_51] at java.lang.Class.forName0(Native Method) [?:1.7.0_51] at java.lang.Class.forName(Unknown Source) [?:1.7.0_51] at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:40) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) [server.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] ... 9 more
@ipod2114
I wouldn't say It's necessarily better than writing plugins in Java, just another option. It's good for quick and easy plugins, and I feel it's a little more beginner friendly. It also means you don't need to compile your mod each time and move it into the plugin folder, just write and reload.