# Programming for non-programmers

When my elder brother had introduced me to Minecraft, I thought it was the greatest game ever. Two years after that, I discovered the Bukkit API and taught myself how to use it to create server plugins. Over 3 years ago, I had the idea of creating a program to allow non-programmers to create server plugins of their own. Now, I have the knowledge to begin that project.

Scratch is a visual programming language created by MIT which allows people to create programs using a block-based interface. Each block has a specific function, which when pieced together create a program. Google took this concept further and created Blockly which allows any developer to create a similar block-based interface which can be converted to a programming language of their choice (JavaScript, Python and Dart are supported naturally). By using Blockly, I am able to create custom blocks to allow anyone (with basic knowledge of logic) to create a Bukkit plugin.

I start by using the Blockly Developer Tools to create custom blocks, in particular, “starting blocks” which signify a player related event which could occur on the server. After creating these basic events:

• When a player joins the server
• When a player leaves the server
• When a player dies
• When a player breaks a block
• When a player places a block

I progress towards creating player related actions based on the Bukkit API, in particular:

I also add a simple block to get the player’s health and display name. These produce the blocks shown below:

From there, I make the blocks convert to code:

Which produces the following output in Java:

@EventHandler
public void onInteract(PlayerInteractEvent event) {
if(event.getAction().equals(Action.LEFT_CLICK_AIR)) {
((WitherSkull) event.getPlayer().launchProjectile(WitherSkull.class)).setCharged(true);
getLogger().info(event.getPlayer().getDisplayName());
}
}


So we’re getting somewhere. We can create custom blocks, we can generate Java code from those blocks, and now all we have to do is compile that into a server plugin.

To do that, I create a simple Swing application which takes the code as an input, as well as a plugin name, description and a name for the author tag. When the Generate button is pressed, the code is compiled (along with a class declaration, the required methods and imports) and a plugin .jar file is produced.

Of course, this project is still in Alpha and has limited functionality, which will be expanded on soon. I have yet to produce a GitHub repository for this, so keep your eyes peeled for that when it is available. My aim is that with this project, more people would be willing to create server plugins with greater ease compared to existing non-programming methods.

Written on May 17, 2018