Skip to main content

How to Make a Minecraft Server Plugin TUTORIAL

How to Make a Minecraft Server Plugin

The Minecraft community seems to accept an obsession with doing everything on YouTube.  For some people that'due south great, but equally someone who is already a coder and I merely demand to know the environment-specific details for coding for Minecraft I take a really hard time sitting through an hr of tutorial videos only to get the four things I needed to know that I didn't already know how to exercise.  This is where having a text and pictures version of a tutorial comes in handy, so you can skim through it looking for the parts yous still need to know, and easily skip over the stuff you already know. Another friend of mine was too recently trying to get into writing a plugin for Spigot, and everything I could find to point him at which was text-based rather than a YouTube video was very outdated, had instructions that were no longer relevant considering Bukkit and Spigot and Eclipse have all evolved since then, etc.  Then I figured I'd write one, and here it is!

Update: since writing this up, I discovered a very nice page on the Spigot Wiki documenting much of this, which seems to be mysteriously absent from the search engine searches I did trying to find this information (or at to the lowest degree ranked depression plenty that all the YouTube videos and a bunch of forum posts that skirt this issue outrank it). How to create a Minecraft/Bukkit/Spigot plugin on the SpigotMC website. I'thousand posting this anyhow because I exercise a few things differently. Pick your flavor. 🙂

Setting up your development surroundings

Install Coffee

Yous demand the Java Evolution Kit, not the Runtime Environment.  Download the Java SE JDK from Oracle's site.  Brand sure y'all get the JDK, not the JRE, and make certain yous accept the right one for your operating system.  Java.com only has JREs, you accept to get to Oracle's site for the JDK.  Linux users can attempt installing the java-eight-openjdk package.

Annotation for Os Ten users: OS X no longer ships Java past default. It will automatically install if you lot endeavor to run something that needs Java, however, the version it installs is old (Java six) and Bukkit/Spigot evolution requires at to the lowest degree Java 7, and then you will need to download the newer Java even if y'all already take the system Java.

Download and Build Spigot

You need to link against Spigot in order to compile plugins, and so you'll need a local copy of Spigot to link to, even if y'all never actually run it.

Download BuildTools.jar from https://hub.spigotmc.org/jenkins/chore/BuildTools/

Place it in an otherwise empty directory.  Open up a control prompt (or a last window) and navigate to the directory you placed it information technology.  Run the post-obit command to build it:

java -jar BuildTools.jar

This will probably take a while. If all goes well, you should get a file called Spigot-1.14.2.jar in the same directory with BuildTools.jar (the version number in the filename may be different if Spigot has been updated since I posted this). Remember where this directory is, yous'll need it later when creating the projection in Eclipse.

Install Eclipse

Plugin development is done with a Coffee IDE.  If you already have a favorite Java IDE, I imagine you tin make it work, but if you don't, I recommend Eclipse, and that's what my instructions will be based on.

You lot can get Eclipse here: http://www.eclipse.org/downloads/

Nigh Linux distributions have Eclipse packaged already and you lot tin probably use your package managing director to install information technology.  Your mileage may vary in getting information technology to work.  Personally, I've had bug getting Eclipse plugins to piece of work correctly because updating plugins sometimes breaks the way the packager packaged the chief app, and sometimes plugins want a newer version of Eclipse (Ubuntu ships an older version), and then I employ a re-create of Eclipse downloaded from eclipse.org rather than the i Ubuntu ships.

If you have more than 1 version of Java installed (OS X users, this is probably y'all), become into Eclipse's preferences, click the triangle next to "Java", and look for the "Installed JREs" section.  Make sure the one you just installed is listed in at that place, and checkmarked.  If it is not, click Add together, then click on Directory to the right, navigate to where you installed the Java JDK, and find the "jre" directory inside it.  On Os 10, Oracle'due south installer will install within /Library/Java/VirtualMachines/. Examples:

Mac Bone Ten:            /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Domicile/jre            Linux:            /usr/lib/jvm/java-8-openjdk-amd64/jre          

Install a YAML editor plugin to Eclipse

The file you create that tells Spigot how to interact with your plugin is in YAML format.  Equally shipped, Eclipse does not understand how to edit YAML files (even though information technology's really only a text file).  There are several plugins that will teach it how, though.

MarketplaceMenu
MarketplaceYEdit

Go to Help -> Eclipse Marketplace, and type "yaml" into the Discover box.  There are several plugins that can do this, find 1 you like and install it.

UPDATE 2019/07/thirteen: I used to recommend YEdit here (at the time I wrote this, it was the only one), but it's gone out of the Eclipse Marketplace. There are several others available now, whatsoever of them should work.

Creating your first project in Eclipse

Create the project itself

  1. Choose File -> New -> Java Project
  2. Enter the name of your plugin
  3. Choose Next (not Finish)
  4. Click the Libraries tab.
  5. Click Add External JARs…
  6. Cull the shaded version of the Spigot-API JAR file from the Spigot directory that y'all compiled in a higher place. Within the directory with BuildTools.jar the API file will be in Spigot/Spigot-API/target and will probably exist named something like spigot-api-1.14.2-R0-SNAPSHOT-shaded.jar
  7. Toggle the triangle to the left of spigot-api
  8. Cull Javadoc Location
  9. Click Edit…
  10. In Javadoc location path, enter: https://hub.spigotmc.org/javadocs/spigot/ . This will permit the autocomplete in Eclipse to autocomplete Spigot API objects and methods.
  11. Click OK
  12. Click Finish

Create a parcel

  1. Cull File -> New -> Package
  2. Enter the name of your package.  This is usually structured like a domain name, but in contrary.  Information technology should first with something that identifies yous, and and so have the name of the project at the stop, and be all lower-instance.  Minecraft itself is internet.minecraft.server for example, Spigot is org.spigotmc, and the Bukkit plugin API is org.bukkit.plugin.  I'll use tld.example.myplugin in the examples.
  3. Click Finish

Create the Principal grade

  1. Cull File -> New -> Grade
  2. Enter the name of the course which will be loaded by Spigot when it loads the plugin.  You can really name this annihilation you desire (we'll deal with telling Spigot how to find it later), only for simplicity I'll call it Main in the examples.
  3. Side by side to Superclass, click Browse…
  4. In the search box, type JavaPlugin, and choose what should be the simply match (org.bukkit.plugin.java)
  5. Click OK
  6. Click Finish

It should automatically open in the editor, and you should now be looking at code that looks like this:

package tld.example.myplugin;  import org.bukkit.plugin.java.JavaPlugin;  public form Primary extends JavaPlugin {  }

There are two functions divers by the API which yous are required to implement. Those are onEnable and onDisable, which go run when your plugin is enabled or disabled. They don't need to exercise anything, but if yous have whatever resource that need allocating or disposed of, those are the places to do it. Add those two functions to your Main.java file, so that it looks like this:

parcel tld.example.myplugin;  import org.bukkit.plugin.coffee.JavaPlugin;  public class Principal extends JavaPlugin {      @Override     public void onEnable() {      }      @Override     public void onDisable() {      }  }

Create the plugin.yml file

  1. Cull File -> New -> File
  2. Select the top-level folder of your project (the project name)
  3. for the File proper noun enter plugin.yml
  4. Click Finish

It should open in the editor. If it doesn't, yous probable forgot to install YEdit up at the top of this tutorial.

This file volition be in YAML format, and describes to Spigot how to interact with the plugin. The superlative of the file leads off with some basic information nearly the plugin, and is and then followed past a description of the commands which are made available past the plugin.

main: tld.example.myplugin.Main proper noun: MyPlugin version: i.0 author: me description: An Case plugin commands:     mycommand:     description: An case command     usage: /mycommand     permission: myplugin.mycommand     permission-message: You lot don't accept the myplugin.mycommand permission.

The "chief:" line needs to list the packet and class name of the class which is loaded past Spigot when it loads the plugin's jar file.  "version", "author", and "description" are human readable, and shown to the user past the /plugins and /aid commands.

The "commands:" block should contain i line for each command you implement.  If information technology's not listed hither, Spigot won't send the control to you lot when users use it.

Inside each control'due south block, the "description" and "usage" sections are shown to the user when they utilize the /aid control.  The "permission" line describes which permission grants access to the command. "permission-message" is shown to users who don't take permission to utilise information technology if they endeavor to. The "permission" should first with the name of the plugin, a dot, and then an arbitrary permission name.  Yous can also borrow some other plugin'south permission or a core permission.  For example, if your plugin adds additional features to MultiWorld y'all could require "mw.admin" permission or so forth.  You lot can get out out this line if you lot want it bachelor to all users.

Create your build script

To be able to install the plugin into Spigot, yous need to create a JAR file (Coffee Archive).  You tin use File -> Export -> Java -> Java JAR to create it, but then you end up having to specify which files to include every time.  In the long run, it'southward easier on you lot to gear up up Eclipse to automatically build information technology.  So in this step we'll be creating a build script that defines the contents of the JAR file so that Eclipse tin do that.

  1. Go to File -> New -> File
  2. Choose the top-level folder (the name of your project)
  3. For File name enter build.xml
  4. Click Finish

Information technology should open in the editor.

Paste in the following:

< ?xml version="1.0" encoding="UTF-viii"?> <projection name="MyPlugin" default="makejar" basedir=".">     <target name="makejar" description="Create a jar for the project">         <mkdir dir="target"></mkdir>         <jar destfile="target/${ant.project.name}.jar">             <fileset dir="bin"></fileset>             <fileset file="plugin.yml"></fileset>         </jar>     </target> </project>

Where information technology says "MyPlugin" at the top, you'll want to replace with your project name. Too, WordPress adds a space between the < and the ?xml in the first line because it looks too much like the syntax used to commencement a php code block. Y'all'll demand to remove that space for the file to be valid.

Tell Eclipse to employ your build script

  1. Right-click (control-click or 2-finger-click on Mac) on the project name and choose Properties.
  2. Cull Builders on the left side.
  3. Click New…
  4. Choose Pismire Architect and click OK
  5. Set the name to Make JAR
  6. For Buildfile, enter ${project_loc}/build.xml (literally, including the $ and the braces)
  7. Click the Refresh tab
  8. Checkmark Refresh resources upon completion
  9. Choose The projection containing the selected resources
  10. Switch to the Targets tab.
  11. Click on Prepare Targets… next to each of "Auto Build" and "During a 'clean'" and just click the OK button on the resulting dialog.
  12. Click OK to close out of the Edit Configuration window.
  13. Click OK to close out of the Properties window.

At this indicate you should accept a working project, and any fourth dimension you make changes to annihilation in your project, information technology will automatically rebuild the plugin'south jar file in the target directory. As long equally y'all've been saving your changes, information technology should always exist up-to-date with your code.

Commencement Coding

If you've followed the above instructions up to this point, you now have a working plugin file which does admittedly nothing, but has all of the necessary framework.

Oh, 1 more thing.

The plugin.yml file included a description of a command just to use an example of how to put that in the plugin.yml file. I would be remiss if I didn't as well give you lot the sample code for actually treatment that command. That goes in Main.java by adding an onCommand() handler function. Your final Main.coffee would look similar this:

packet tld.example.myplugin;  import org.bukkit.command.Command; import org.bukkit.control.CommandSender; import org.bukkit.plugin.coffee.JavaPlugin;  public class Main extends JavaPlugin {      @Override     public void onEnable() {      }      @Override     public void onDisable() {      }      @Override     public boolean onCommand(CommandSender sender,                              Control command,                              String label,                              String[] args) {         if (command.getName().equalsIgnoreCase("mycommand")) {             sender.sendMessage("You ran /mycommand!");             return true;         }         return faux;     }  }

Additional Resource

Spigot Plugin Evolution Folio
Spigot API Reference

UPDATED 2016/05/06: Still works in ane.9, so updated references accordingly. Fixed step 6 in creating the project to apply the shaded version of the API file. Thanks to several people in the comments for pointing information technology out.

UPDATED 2017/02/21: I haven't had a chance to try it myself recently, but multiple people accept said in the comments that this even so works in ane.eleven.x, so I've updated the references accordingly.

UPDATED 2019/07/xiii: Likewise. Haven't tried it myself, but people are maxim it nonetheless works in ane.fourteen.x in the comments, then updating the title and references. Also added a note near YEdit being gone from the Eclipse Marketplace.

UPDATED 2019/07/22: Looks like WordPress finally broke the syntax highlighter plugin I've been using that hasn't been updated in 4 years, just replaced it with a Gutenberg-uniform i and attempted to set up the formatting of the lawmaking. Build.xml in particular was completely hosed, it should be fixed at present.

DOWNLOAD HERE

How to Make a Minecraft Server Plugin TUTORIAL

Posted by: brendatwereent.blogspot.com

Comments




banner



Popular Posts

Rajce Bazen : Bazén Doma,Jezero ,tanky - marta - album na Rajčeti

Rajce Bazen : Bazén Doma,Jezero ,tanky - marta - album na Rajčeti . Not only bazen rajce vane, you could also find another pics such as alba rajce bazen, vane rajce de, rajce bazen strada, rajce se, rajce vane 2, rajce el, rajce bazen sekiller. Dětské bazénky jsou nafukovací konstrukce, odolné a maximálně bezpečné. Not only bazen rajce vane, you could also find another pics such as alba rajce bazen, vane rajce de, rajce bazen strada, rajce se, rajce vane 2, rajce el, rajce bazen. Získáte tak jedinečnou inspiraci ze stovek českých alb. Slana voda nije agresivna za razliku od hlorisane vode, ona osvežava. 25m bazén, 5 plaveckých drah, 1,2 m hluboký víceúčelový bazén s teplotou vody 30 °c, vířivka, chrliče, divoká řeka, dětské brouzdaliště, 42 m dlouhý tobogán. Získáte tak jedinečnou inspiraci ze stovek českých alb, nahraných každý den na rajče. Rajce bazen / pontaqua bazeni sa čeličnim stranicama. Získáte tak jedinečnou inspiraci ze st. Intex novi bazen 549x274x132cm u

Dessin Tete De Mort Stylé : tête de mort

Dessin Tete De Mort Stylé : tête de mort . Les tête de mort peuvent être un sujet intéressant à dessiner. Coloriage de tête de mort. Pas la peine de te faire un dessin, ces modèles tout droit arrivés des flammes de l'enfer ne sont pas faites pour ces ceintures tête de mort viennent apporter un style absolument démoniaque à celui qui ose les enfiler. Comment dessiner tête de mort ? Voici un nouveau tutoriel sur comment dessiner un crane ou une tête de mort. Coloriage tete de mort mexicaine 20 dessins a imprimer. Voici un nouveau tutoriel sur comment dessiner un crane ou une tête de mort. Commencez par dessinez la silhouette de la tête de mort. Fait entièrement au cretérium et à partir d'un modèle. Coloriage tête de mort mexicaine 20 dessins à imprimer. Débardeur homme - Tête de mort clown flammes - skull - 9103 from cdn.store-factory.com Hallow

Max Verstappen Win : Max Verstappen Wins Emilia Romagna Grand Prix Sports German Football And Major International Sports News Dw 18 04 2021

Max Verstappen Win : Max Verstappen Wins Emilia Romagna Grand Prix Sports German Football And Major International Sports News Dw 18 04 2021 . Verstappen stopped one more time than his rival after red bull rolled the tactical dice and outfoxed. Max has a dutch father and a belgian mother. Max verstappen passed hamilton on the penultimate lap to win a pulsating french grand prix. Max verstappen passed charles leclerc with less than three laps to go to win the austrian grand red bull's max verstappen won the austrian grand prix with a great comeback after a terrible start. He is the youngest to win a grand prix, his first career podium and leading a race (spanish gp 2016). Max emilian verstappen (dutch pronunciation: Max verstappen passed hamilton on the penultimate lap to win a pulsating french grand prix. He is the youngest to win a grand prix, his first career podium and leading a race (spanish gp 2016). Helmut marko, the date september 2014. That's exactly t

Guegos Gratis Sin Internec Para Mokia Tactil - Guegos Gratis Sin Internec Para Mokia Tactil / Todos ...

Guegos Gratis Sin Internec Para Mokia Tactil - Guegos Gratis Sin Internec Para Mokia Tactil / Todos ... . Happy wheels, el juego repasamos todo el catálogo de juegos disponibles para pc y que se pueden jugar sin internet para contaros cuáles son los mejores para disfrutar en no. Se trata de uno de los juegos para descargar juegos java tactil para celular gratis. Descargar juegos online gratis para celular tactil samsung. Los clásicos juegos de pelea nos acompañan desde hace mucho tiempo, cuando con amigos íbamos a las salas de árcade a jugar con fichas, donde debíamos combatir en las calles golpeando a todos y jugando uno contra uno. Juegos gratis sin conexión a internet para pc. Juega juegos gratis en línea en paisdelosjuegos.com.ec, la máxima zona de juegos para chicos de toda edad! Juegos android gratis juegos android sin internet mejores juegos nuevos juegos android de pago juegos android de estrategia. También podrás disfrutarlos en tus dispositivos móviles favo

Μαθηματικα Γ Δημοτικου : ΜΑΘΗΜΑΤΙΚΑ Γ' ΔΗΜΟΤΙΚΟΥ ΤΕΤΡΑΔΙΟ ΕΡΓΑΣΙΩΝ ΤΕΥΧΟΣ Β'

Μαθηματικα Γ Δημοτικου : ΜΑΘΗΜΑΤΙΚΑ Γ' ΔΗΜΟΤΙΚΟΥ ΤΕΤΡΑΔΙΟ ΕΡΓΑΣΙΩΝ ΤΕΥΧΟΣ Β' . Εξεταστέα ύλη για τον πρώτο διαγωνισμό θαλησ για κάθε τάξη είναι η διδακτέα ύλη όλων των προηγουμένων τάξεων σύμφωνα με το αναλυτικό πρόγραμμα κάθε τάξης του ιεπ για τα μαθηματικά. Ασκήσεις μαθηματικών γ τάξης δημοτικού. Πλούσιο υλικό για όλες τις ενότητες στα μαθηματικά της γ' δημοτικού. Δείγμα άσκησης μαθηματικών γ' δημοτικού.στα μαθηματικά τα παιδιά της γ΄ δημοτικού παίρνουν τις βάσεις για όλες τις υπόλοιπες τάξεις αφού μαθαίνουν τα. Κανονικά η δεύτερη δόση με το εμβόλιο της astrazeneca. Βιβλιο εργασιασ γλωσσα δ' δημοτικου τευχοσ α' 100 φυλλων. 0 ratings0% found this document useful (0 votes). Παρουσιάζει αναλυτικά τις απαντήσεις στις ερωτήσεις του. Δημοτικού και βίντεο με τα μαθήματα. Συμπιεσμένη μορφή των λογισμικών για αντιγραφή σε cd. ΜΑΘΗΜΑΤΙΚΑ Γ' ΔΗΜΟΤΙΚΟΥ ΤΕΤΡΑΔΙΟ ΕΡΓΑΣΙΩΝ

Baby Boy 1St Birthday Cake Images : Number 1 birthday boy cake … | Boys first birthday cake ...

Baby Boy 1St Birthday Cake Images : Number 1 birthday boy cake … | Boys first birthday cake ... . Servicing sydney and surrounding areas such as wollongong, penrith, campbelltown, miranda, cronulla and more! Here we have listed baby birthday cakes images and pictures that could be used for baby birthday cake preparation. If you searching 1st birthday wishes then you land a perfect place. Toddler boy birthday boys first birthday cake birthday cake with photo first birthday pictures 11th birthday birthday ideas birthday bash circus 1st birthdays carnival birthday parties. Baby boy birthday cakes ba boy on a birthday cake celebrating his first birthday holding a. Best of all, if you can't find the right cake design here, our. Request a cake decorated with choose your favorite first birthday cake idea for your baby boy, and we will bake it to perfection. Birthday cake kids boys truck birthday cakes disney birthday 1st bday cake birthday ideas birthday themes for 1st

Mankoko Husband Pastor - Thobela FM DJ dumps pastor husband - All 4 Women

Mankoko Husband Pastor - Thobela FM DJ dumps pastor husband - All 4 Women . He furthers the work of the church while leading others into a growing relationship with jesus christ. What is a pastor's job?. If i were a husband, i would get it right. Many terms describe clergy members of christian churches, including pastor, elder, bishop, reverend, minister and priest. If you're thinking of becoming a pastor, or are searching for a church congregation to join, it's important to understand what qualities make a good church pastor. Who doesn't want to be married to that perfect man we saw on a fiction story? What is a pastor's job?. We may earn a commission through links on our site. The feelings aren't going away and you realize you. I would kiss her every morning and bring her coffee. Top DJ and Actress Mankoko Mathe DUMPS her Cheating Ben10 ... from 4.bp.blogspot.com

Safety Quotes For Work : Scott Bellware: Workplace Safety | Workplace safety ...

Safety Quotes For Work : Scott Bellware: Workplace Safety | Workplace safety ... . Explore our collection of motivational and famous quotes by authors you know and love. Captivate food safety quotes that are about fire safety. Display them around your workplace, or add them to internal newsletters. I failed a health and safety course at work today. Always make sure your car is road compliant and your driving skills and habits are focused. Captivate food safety quotes that are about fire safety. Safety quotes can also be used to make your employees and management safety conscious. Display them around your workplace, or add them to internal newsletters. 2410 famous quotes about safety: Safety saying, circa early 1900s. Image result for manufacturing working safely | Safety ... from i.pinimg.com In the event of a tire, what steps would you take? Office w

Baju Anak Capel Armi : Baju Anak Capel Armi - Jual Kaos Baju T Shirt Anak Camo ...

Baju Anak Capel Armi : Baju Anak Capel Armi - Jual Kaos Baju T Shirt Anak Camo ... . Pantun anak merupakan pantun yang dibedakan berdasarkan usia sebelum remaja. Viva weddingcek baju anak pasar tanah abangterimakasih telah mampir dan menonton vidio viva weddingdukung channel ini dengan cara:subscribe ya. Kemudian saling berpelukan di dalam sarung lagi. Бекарор 139 кисм узбек тилида. Bisa meliputi nasihat, anjuran, pendidikan, humor jenaka, pertemanan, dan kegembiraan lainnya. Ada film baru pak.kata mama. Cara memilih pakaian buah hati yang layak sesuai karakter. Aku dan bang ikhsan cukup sibuk sehingga takut nantinya tak. Lihat ide lainnya tentang baju anak, anak, pola. Cemilan dari sayur kol : Baju Anak Capel Armi - Farelly Couple Mom Baju Couple ... from cf.shopee.co.id Paket ini memudahkan anda yang ingin berbelanja grosir, karena paketl ebaran. Du
close