CompuBlock
CompuBlock
Any tech-loving Minecraft modder knows of dan200's famous ComputerCraft, in which you can build computers and program them in Lua. CompuBlock is a similar concept created for unmodded Bukkit servers.
Dependencies
This plugin requires Holographic Displays for displaying output
Usage
There are no commands to go with this plugin, so you can start scripting right away! Scripts are written in one of two ways: Either by writing them in a book and quill, where the script can span multiple lines and pages, or by typing the script directly into a command block. To transfer a script into a command block, simply left-click the block with the book and quill. Only players with the "lua" permission set are able to transfer scripts into command blocks, ensuring that only trusted people can write Lua scripts. The scripts are run when the command block receives power.
As far as using Bukkit features in Lua, most of what you need is created dynamically. By default, the Bukkit class and all its methods are loaded, and its method names remain the same.
For example, here is a simple Lua script to change the type of a block:
world = Bukkit.getWorlds().get(0) block = world.getBlockAt(0, 64, 0) rand = Random.nextInt(192) block.setTypeId(rand)
Additional functions include
print(text) -- Takes any number of arguments and prints them to the display clear() -- Clears the display setLinePos(linePos) -- Takes a single integer argument and sets the display's line position at that line shutdown() -- Clears the display and resets the ComputerBlock
WARNING
This plugin is highly experimental
Since this plugin allows players access to native Bukkit methods ingame, there is a possibility for malicious scripts to be created and run. Methods and classes may be blacklisted in the config file, but always take precautions before allowing someone to run scripts.
-
View User Profile
-
Send Message
Posted May 15, 2015Also just a quick question, what exactly would be the api call to execute the command in the command block as a normal command block command? (I want to sudo a command @ all users on my server on a timer, but I can't find out how to execute a commandblock command through lua, so the command block is spammining the building with errors, since it's executing a command and not lua.)
-
View User Profile
-
Send Message
Posted May 15, 2015Love it, still playing around with ti and seeing what all I can do with it.
But one small problem is that when a player deletes a computer the output stays, clear() has to be called to remove the displayed data. This could cause a problem with left over holograms all over the server,
-
View User Profile
-
Send Message
Posted Feb 19, 2015@minedark815
You can just use Bukkit's API documentation. All objects and methods are identical to those in Bukkit.
-
View User Profile
-
Send Message
Posted Feb 14, 2015Easy Question, Do you got a wiki or a pastebin file or anything else to show the list of the scripting codes?