Minecats 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!”);

NameMC

MineCats on NameMC

The road to Top 10

Do you want to get Extra Vote Tokens?

Help us get back into the top 10 positions on NameMC and everyone who has liked us will get 10 Vote tokens at the End of the Month!

Follow these steps to Like MineCats, & to enter!

 

The instructions:

1) Read and understand this page before following these instructions!
2) Go to https://namemc.com/server/play.minecats.com
3) Read & Follow the instructions at the top of that page.
4) You will be given a unique Minecraft address similar to 7185xa43.like.namemc.com
5) Use Minecraft to connect to your unique server address (when your address is used, it will not work again)
Once you connect, you will immediately be disconnected, with a screen that looks similar to  this:
066ce894db-300x150.png
If this screen shows “Your like has been recorded!” You are all set!

 

6) If you have already “Liked” MineCats (Now or previously) You can confirm you have entered the contest
Go to your profile page and look for your “Favorite Servers” section
http://namemc.com/profile/your_minecraft_name_here
(Replace “your minecraft name here” with your username) & You will see this:

e1895e2fcd.png
7) Tell your friends to Like MineCats on NameMC.
You can even check your friends’ profile page to see if they already Like MineCats! Use the same link above, but put their username instead of yours after the ‘profile/’ part!

If you need to help your friend to connect to NameMC’s server to Like MineCats, you can reload https://namemc.com/server/play.minecats.com to get a new address which you can give to and tell your friend to connect to.  Each address can be used only once, so a new address must be generated from that web page. If you have already Liked MineCats in the past, or have entered our previous NameMC contest, YOU ARE STILL ENTERED (unless you unliked us – :( sad panda is sad)

MineCats rankings on NameMC

Recently, NameMC.com has opened up “voting” for Minecraft servers. This rankings list is based on total number of Likes. Each Minecraft account can ‘like’ the server one time. The servers users like appear on their NameMC user page.  This may allow your friends to see what servers you’re playing on.  Additionally, NameMC has opened up the ability for users to claim their profiles, for each Minecraft account they own.

To “Like” MineCats, go to ->NameMC’s page for MineCats<- You will see a message “To like play.minecats.com, open Minecraft and connect to:” followed by a server address that looks like prga28h6.like.namemc.com  where the prga28h6 portion will be random and change each time the page is (re)loaded. You must use the specific address given to you on the page, or you will not be able to connect to their server to “Like” MineCats.  Once you have done this correctly, you will be disconnected immediate and be given a screen that looks very similar to this:

066ce894db

Once you have voted, and looked at MineCats rankings page, you can click on your name. There are instructions to claim your profile on that page, if you wish to claim it. Choosing to not claim your profile is completely OK. No one else will be able to claim your profile, unless they gain access to your Minecraft account. (don’t let anyone use your account or know your passwords)

COMPETITION WINNERS:
Thank You for Liking MineCats on NameMC!  This competition has been much fun!
Time has come for the lucky few to have their names drawn.  Please message AeSix in-game, on Discord or via the forums regarding your prizes!  If you choose to give your prize to someone else, you may do so, but must let AeSix know as soon as possible.

The Winners:
1) Patriot, pick your server  – MegganTheFox
2) Citizen, pick your server – Evilmo
3) Citizen, pick your server – Nekoborg_v7X
EVERYONE who had liked MineCats before competition end will receive 15 tokens!

REMEMBER: Your “LIKE” counts only once! If you try a second time, your “like” will be removed and you will have to re-connect to their server again to “like” MineCats again!

1.9.4 Release and Discord :)

Hello Minecats!

Today Mojang released 1.9.4 for everyone to download. Don’t update just yet.
There is some plugin breaking things in this update and we need to wait for some our most valued plugins like WorldEdit to update to support the latest version.

We are closing watching the plugins so we can move forward when they are released.

In the meantime we are switching from using TeamSpeak to using DiscordApp for our voice chat (It supports text chat too).
Discord is web hosted, so you can get to it without needing to install a client. It also has android and iphone apps.

We addded a music bot to ours, so you can play music for others to share.
Discord Chat

Right now the Server list in your client should tell you to downgrade to 1.9.2 if you have accidentally updated. Do that for now, we will let you know when we are ready. 🙂

Have a purrfect day!
cindy_k

Mojang Releases 1.9 pre-release

Mojang has just released the 1.9 Pre-Release.
Read about that here: http://mojang.com/2016/02/minecraft-19-pre-release-1/

What’s new in 1.9?
First this is called the Combat Update.
There are shields, dual wielding and glide wings.
A new end, some new mobs, some new block and new arrow enchantments.
There’s more.. but if you want to read about it…
http://minecraft.gamepedia.com/1.9

Will Minecats update to 1.9?
The short answer is Yes!
When you ask? Well first the server mod we use needs to be released, that normally doesn’t take too long. But then we need to wait for important plugins that we use to also update.
With over 10 different game servers, there are a lot of plugins to check.

We will likely move one or two servers at at time. With a 1.9 lobby and a 1.8 lobby.
1.9 servers will be on the 1.9 lobby and 1.8 servers on the 1.8 lobby.
Based on your client version you will be attached to the correct lobby.

I still haven’t said how long all this will take… It will be as soon as possible. That could be 2 weeks, it could be a month. I will strive for 2 weeks, but some of the plugin updates are out of my control. Some plugins we can do without for a little bit, but others are critical to the servers running.

Will any servers be reset?
The quick answer is No.
However depending on what the update does may change force a change to this answer. I will try my hardest to introduce the new items/abilities without having to reset anything.

Biggest Change will likely be on Survival
Survival’s end right now resets every restart, so you can play with the enderdragon again.
The new end world is very interesting, my initial thought is the end reset will be change to be less often.
Just once a day or once a week… We will seeeeeee.

Have a Happy Purrrrfect Day!
cindy_k