How-To Archive

Adding Logging and a Command to your Spigot Plugin

In our last post, I showed you how to create a Java Spigot plugin.
This plugin, while it will compile and run, won’t do anything.

Its time to make the plugin do something. First it would really nice to log things to the server log as the plugin runs. This lets you and the server owner running your plugin know that your plugin is working correctly or if its not, what is wrong.

The JavaPlugin class that your plugin is extended from includes a logger. You need to call getLogger() to get access to it. Also to make it easier to do this from any class your plugin, I recommend make a reference variable to your main plugin class as Static.

The code line plugin.getLogger().info(“My log information”); can be used anywhere in your plugin to create log lines.

public class BasicPlugin extends JavaPlugin {
   
    static BasicPlugin plugin;

    @Override
    public void onEnable() { 
        plugin = this;
        plugin.getLogger().info("Plugin Starting up!");

    ///....

Starting a new Minecraft Plugin with Intellij

1. Open IntelliJ (If you don’t have IntelliJ you can get it from JetBrains https://www.jetbrains.com/idea/)
2. Start a new Project.

Just choose Java, you don’t need any of the other options. If you don’t have a Java SDK, you should close IntelliJ and go get that first. Click Next.

You don’t need a template. Just click Next.

Name your plugin and Click Finish.

3. Add Spigot API Jar to libraries
Now you need to add the Spigot API jar to the Libraries in the Project Structure screen.
(If you don’t have the Spigot API, you need to go build it with BuildTools from https://www.spigotmc.org/wiki/buildtools/ )

Click on the Green + and choose Java.

Find the Spigot API Jar on your computer. If you ran BuildTools it will be in a Target folder under the SpigotAPI folder.
Choose modules dialog will appear with your project in it and highlighted. Click OK

Click Ok on the Project Structure window to close it.

4. Create First Package
Java likes to organize code into Packages.
Right-Click on the src folder. Choose New > and then Packages

You put in your domain and name. If you do not own a domain, you can just write something like: org.myname

5. Create First Class
Right-Click on your Package name in the tree under src and choose New > Java Class

Name your first class the same name as your Plugin.

Enter this code for you first class. The Package line should already be there for you.
This code will allow your plugin to load, but it currently does nothing.

package you.packagename.here;
import org.bukkit.plugin.java.JavaPlugin;
public class BasicPlugin extends JavaPlugin {
   @Override
   public void onEnable() {
        super.onEnable();
   }

   @Override
   public void onDisable() {
        super.onDisable();
   }
}

6. Add Plugin.yml
In order for Spigot to understand your plugin, you will need a plugin.yml file in your Jar.
Right-click on the src folder again, this time choose, New > File.

Name the new file: Plugin.yml

Add this code to your Plugin.yml

#the plugins name as it should appear in the plugin list /pl
name: YourPluginName
#Plugins Version
version: 1.0
#Author's Name
author: YourName
#your main class were the onEnable and onDisable methods are
main: your.package.path.plus.classname

7. Create Artifact
To compile your code into a Jar file, you need to create an Artifact in IntelliJ
Click on the Project Structure option on the File menu.

Choose Artifacts and Click on the green + to add one.

Choose JAR and empty

Name your plugin and double click on the Compile Output on the right.

Add the Plugin.yml by clicking on the Green + and choose File.

8. Build Jar
Ok now you can build your Plugin.

It will go into the Target directory in your project folder.

9. Add Jar to the plugin folder of your Spigot Server and Test

Additional line to add to your code
This is how you can log information from the onEnable and onDisable methods.
this.getLogger().info(“Plugin Starting up!”);

Basic WorldEdit Tutorial

This is a starting tutorial on how to use WorldEdit on a Minecraft Server.
Going over the basics of //set //copy //paste //move
As well as //wand //hpos and //l

How to Change your Minecraft Client Version

So you Clicked the button and Updated.
But your favorite server hasn’t been updated yet.

Follow these Easy Steps and you will be playing on a server with a different version

1. Click on the New Profile or Edit Profile Button
MC_Client_Screen_EditProfile

2. Click on the Use Version Dropdown
MC_Client_Screen_SetVersion

3. Scroll down until you find release the server is on and Select it
MC_Client_Screen_ChooseVersion

4. Click Save Profile

Now just enter your username and password and click Play and the client will do the rest.

How to Create a Minecraft Server with Bukkit or Spigot

Hello, this is a quick guide on how to start up a Minecraft server use Bukkit or Spigot.
These server jars allow you to extend minecraft with plugins. This is how the servers you play on add things like permissions, chat colors, ranks, kits, etc.
Plugins are found for download at dev.bukkit.org and spigotmc.org

This guide will teach you how to setup the server on a local machine. It will not teach you how to setup your network (assuming you are behind a firewall) to allow others to connect to it. Depending on the network setup on the computer you install on, people may or may not be able to connect to your server.

== Prerequisite ==
You need to have Java installed on the computer where you are going to run the server.

== Step 1 ==
You need to get the Server Jar.
You can download
craftbukkit.jar at http://dl.bukkit.org
or
Spigot.jar at http://ci.md-5.net/job/Spigot/

Either will work for running your server.

== Step 2 ==
Make a folder or directory on your computer and put the jar in it.
SimpleServer1

== Step 3 ==
Create a Batch or Shell script to run your jar.
Note: you could just type the command into the command line, but doing that over and over gets annoying quick. Its better to make the run script upfront.

Windows: Create a new text file called run.bat
You will need to know where the java.exe is on your computer. On mine, its on the D: drive in the Javabin folder.

@ECHO OFF
SET BINDIR=%~dp0
CD /D "%BINDIR%"
"D:Javabinjava.exe" -Xmx1024M -Xms1024M -jar spigot.jar
PAUSE

——————————————
Linux: Create a new text file called run.sh and make sure to grant it execute permissions.

java -jar -Xmx2000M -XX:MaxPermSize=256M -server spigot.jar nogui
———————————————-
== Step 4 ==
Run the script, whether its you Batch file or shell script.
NotRunYet

After you run the script, your folder will look like this:
Run for the First Time

And at this moment you have a working server!
You will probably want to adjust the server.properties and the bukkit.yml

You can add your character name to the ops.txt file if you want to automatically be op in game.
If you run a client on the same machine you will be able to connect to this server.
To connect to it from other machines, you will have to add the IP to the server.properties and perhaps adjust firewall settings.

How to make a Bukkit Plugin

I am starting a set of videos on how to make a bukkit plugin for Bukkit/Spigot Minecraft servers.
Hope this helps any inspiring plugin devs.

Things you need to start:
Basic Knowledge of Java or a similiar developement language
http://www.learnjavaonline.org/
A Minecraft server of your own to test on (Instructions on creating a server coming very soon)

How to Add Shaders to 1.7.2 Client in Windows

First you need have Forge Installed.
Download the Install for your computer from here:
Forge Mod

The Windows Installer is: Forge Windows Installer
For Windows, just run the installer and it will add a new Version to your client.

When you relaunch your client, you will need to change your profile to use: 1.7.2-Forge10.12.0.1019

Now for the Shaders.
There are two parts to this, first you need to ShadersModCore.
ShadersModCore Forum Post

You put that into the Mods folder of your .minecraft folder.
Start your minecraft client, so it loads and creates its folders.

Then you need the actual shaders:
Here is the link to SonicEther’s Shaders – Sonic Ether’s Shaders

This file goes into the ShaderPacks folder under .minecraft in your AppData folder.

That should be it for the install, now start your minecraft client again.

Make sure you have 1.7.2-Forge chosen as your Minecraft version.