The hardest part of getting into plug-in development is sEtTiNg uP tHe dAnG pRoJeCt! In this video, I’ll guide you through the process as quickly as possible while still making sure to actually explain what each step does. (coughs) Just a heads up though. Java is janky and weird And you will end up banging your head against the wall. This is normal power through it. (softly) I believe in you. All right, the very first thing you’re gonna wanna do is download IntelliJ IDEA. This is by far the best code editor for anything to do with Java. So go ahead and download the community edition, unless you feel like paying a hundred or so dollars for the SAME program. And Once you’ve got that installed, come back here. When you open it up, you’ll be greeted by a screen something like this. Now you might think that to create a project we’d want to go to “New Project” and then select our programming language. But no, no, no, no, no. First, You gotta go to “Plugins” and then we have to search for a plugin in the marketplace. This will make our life infinitely easier. Find the plugin called “Minecraft Development”. Make sure it’s the one with over 600,000 downloads, then hit install. Mine’s already installed. All This does is add some project templates for all sorts of Minecraft related stuff. But today we are making a plugin, a Spigot plugin. That’s why we’re gonna select “Paper” (chuckles). The difference between Paper and Spigot is that paper is about a million, bajillion times faster. And… Good. Whereas Spigot is the older version, that is a separate project, and is worse. Okay, make sure the project SDK is set to “17”. If you don’t have 17 up here, you can click “Download JDK” and hit version 17 and then choose one of these. The reason for this is that Minecraft 1.18 Uses Java 17. Now we can proceed by hitting the next button. Okay, this is the worst screen in the entire thing, because when you haven’t done any Java development before you don’t know what a GroupId is, and you don’t know what an ArtifactId is. So what are they? Okay, confusingly, GroupId Is usually a website URL that you own, written down, back to front… So for me, that would be something like com.legitimoose. “But I don’t own a domain!” I hear you saying. That’s fine. If you’re doing it casually, what I would recommend doing is putting in “me.yourname” or some unique thing in There. Why is this even here? Well, it’s here to prevent overlaps of names. If two projects have the exact same name, there could be a potential conflict where Java doesn’t really know what code you’re talkin’ about. This shouldn’t be an issue. So go with “me.yourname”. So for me, That would be “me.legitimoose”. ArtifactId is like the name of your project, but it’s all lowercase, and with no spaces, and doesn’t start with a number, and a couple other rules. By the way, I put the full standard in the description in case any of you are curious, like I am. I’ll Call this plugin extreme-flight, cuz we’re gonna be making a /fly plugin. And for the version, 1.0 snapshot signifies that it’s a development version of the 1.0 release. Down here we can choose between Maven and Gradle, that’s the project manager type thing. Maven is more popular, So I’m going with that. They do the same thing though. All right, here’s our plug-in name, it’s automatically filled this in, Plugin Name: “Extreme Flight”, Main Class Name: “me.legitimoose.extremeflight.ExtremeFlight”. That’s fine. Minecraft version 1.18.1. Uh, that’s not the latest, so we’ll have to change that. Then we can set the description, The authors, the website, the log prefix for server logs, plugins it has to load before, dependencies and soft dependencies. None of which we need. So let’s click “Next”. Then we choose the actual project name, this is just for IntelliJ IDEA. I’ll call this “ExtremeFlight”. By the way, Don’t put spaces here. I did that once and it broke everything, and I don’t know why… Don’t do it. All right, if you’re happy with all these file locations, you can hit “Finish”. All right, Here we are with the w i d e s t borders you’ve ever seen, and this is an empty Java plugin. Look how easy that was. It has already set us up with the whole thing. Let’s make a quick “Hello, World” program. So a lot of people will tell you to do “Bukkit.getConsoleSender().sendMessage(“Hello World!”)”. This is wrong, because every plugin actually comes with a logger that will send plugin signed messages to the server log so that you know where your messages are coming from. To access that from inside a Java plugin class, like we’re in here, all you have to do is “getLogger()” And you might think it’s “.log”, no, it’s “.info”. We’re sending information to the server log. So here we can say “Hello world!”. If you wanted to send a warning, you would do “getLogger().warning” and then it would show up in yellow. Cool, now we just have to put this into Our Paper MC server. How do we get this into a nice file that we can load into our server? Well, first you’re gonna want to hit the beautiful hot key Control-Alt-Shift-S, or you could go to File > Project Structure, then go down to artifacts. For some reason, Java uses the word artifact to mean thing, like a file. We’re gonna hit this little plus button to create one and then hit JAR and then go to “From modules with dependencies”. All of these default settings are totally fine. Don’t change them, hit “Ok”. All right, now this output directory is where our jar will wind up. Let’s change that to our server plugins folder. If you don’t have a Paper server set up, there are a million billion tutorials on YouTube. Just look up “How to set up Paper server” and you’ll find Out how to get this. So you’ll see this plugins folder go in there, copy the location of it, and then paste that into the output directory. So now when we build this thing, it will go directly Into our plugins folder and we won’t have to move it around, hit “Apply”, or just hit “Ok”. Now we should be able to build our plugin. So to do this, we have to go to Build > Build Artifacts and then Go down here and then hit “Build”. That’s a lot of button presses. So what I like to do is hit Control-Alt-S, no Shift this time to get into our regular settings, then go to Keymap and search for “build artifacts”. And I like to just bind this to f5 . That’s my preference. Alternatively, You can click “Include in project build” from the JAR screen here. Make sure you hit “Apply”. And then, when you click this little Build Project button, it should build the artifact. Yes, indeed it does. So that; is a much better way of doing it. Now you can see our Extreme Flight plugin is in here and we can run our server and see our beautiful message appear. Yeah, yeah. It’s telling me everything’s out of date. That’s fine. “Could not load uses the space-character in its name”. Uh-oh, how do we change the plugin name now? Isn’t it a little late for that? Well, Fear not because all that information is stored in a convenient file called plugin.YML. In this left side project browser here, you can open and close this by hitting this Project tab here, go into our plugin ExtremeFlight, go into the “Source” (src) folder for all of our source code, go into “main”. Underneath Java is where all our Java code goes, and under resources, plugin.YML! In here- oh, you’ll see there’s our name. It’s even warning us. It’s saying it needs to have no spaces in it. Let’s remove that space and then build our project again. Let’s see if it works this time. There it is. ExtremeFlight says “Hello world!”. So now that we’ve got Hello world working in Java, let’s just say I’m not the biggest fan of Java. I much prefer a new up-and-comer called Kotlin. Now the cool thing about Kotlin is that anything you can do in Java, you can do in Kotlin. That means using the same libraries, using the same Java virtual machine, it will be exactly the same as compiled Java once you build it into your plugin. And because IntelliJ IDEA is made by the Same company who creates Kotlin, they have made it very, VERY easy to set up. All we’re gonna do is right click on our entire project up here and hit “Convert Java File to Kotlin File”. When I do that The first time, it’s gonna say, “Hey, Kotlin is not configured in your project” so hit “OK”. And now we’re gonna configure Kotlin, pick the latest release. So right now, 1.7.0 is a release candidate, so it’s not fully released. I’m gonna go back to the last stable version of 1.6.21, Pick the latest one without anything at the end of it and hit “OK”. Now it takes us into this scary looking file (laughs). This is our pom.XML, and this stores everything about the project that we’ve got here. This is what Maven uses. That’s our project manager type thing. And this Contains all the info of any dependencies, this contains the GroupId, the ArtifactId the version, what kind of packaging we’re gonna use, the Java version. Oh, and now the Kotlin version. And if we go all the way down here, you’re gonna see it also includes the Paper MC API. Now remember earlier, When I said that we were actually using an outdated version of the Paper API, you can see we’re using 1.18.1, when we should be using 1.18.2 or whatever the latest version is at the time of you watching this video. You’re never gonna guess how we do this. That’s right. We change The text that says 1.18.1 to 1.18.2. Yes. That is literally what you do. Now to get all this, to take effect, we’re gonna have to reload Maven. If we were to try and convert to Kotlin again, It would just say it wasn’t set up again and you would end up adding more and more lines of Kotlin to this thing. So to get it, to actually update everything, we have to hit this “Reload All Maven Projects” button. Always hit the Reload Maven projects button.If you forget, You will be confused for days. It took me a very long time to find out that I have to press this button every time I add a dependency or change anything in pom.XML. (sternly) Do not forget To reload your Maven project. And with the little press we wait, and you’re gonna see it says “Resolving dependencies” and “Downloading Maven sources and documentation” down here. That means it is going to all of these repositories and it is looking for anything called Paper API under the GroupId io.papermc.paper. And then it is looking for the 1.18.2-RO.1 Snapshot version. Now there is a version with this name. You can see cuz it hasn’t turned red, but actually there’s a full release, so we no longer need to have snapshot on the end there. I think I could be wrong. How do We find out what the latest version is? Well, it’s on their website. That’s right here on papermc.io, link the description, you can scroll down and click this little tiny, Use Our API button, and then it’ll tell you the stuff that you have to add to your Maven thing. See? Yep. Here’s the latest version. Now, let me show you something that confuses me just a little. Here it says our Java version is 1.8 When it should be Java 17 for a Minecraft plugin. Down here, it also says 1.8 I’m gonna just change that to 17. And in theory, everything should still work, but Strangely it was working before, so I don’t know what that’s actually changing. (laughs) [I don’t know if] it’s just changing some display setting or if it’s making it run faster or what, but if I do that, rElOad my Maven project and then build my Extreme Flight plugin, then it Should still work. Imma just stop my server, start it again. And we’ll see what we get. Yep. Everything still works. Awesome. Now let’s finish converting to Kotlin because now we have added all the Kotlin dependency stuff here. We’ve specified a version of our pom.XML, which means now If we right click on Extreme Flight, hit convert Java File to Kotlin File, it will just do it, or- it should… seems to have done nothing, let’s try that again. I’m gonna try clicking on the source cuz maybe it doesn’t think this is a file or something, convert. Okay. That worked for Me. I swear. I’ve clicked on that before and it’s worked fine. But that’s what I had to do today. Don’t you just love development. “Some code in the rest of your project may require”- yeesss, do correct the code. Oh and instantly, literally so fast, it has converted our thing into Kotlin, Notice how much more compact it is. Can we get a before and after here? Yeah, that’s pretty good. And that’s all it takes to get Hello world working in Kotlin. I trust you can figure out everything Else from here. Seriously though. If there’s more you want to know, let me know in the comments of this video, what plugin tutorials you’d like to see. I’ll put a link to some more of ’em here. If I end up making more, otherwise go watch my devlogs where I make my own plugins. See ya! Video Information
This video, titled ‘Minecraft Plugin Tutorial (in Kotlin) | Project Setup’, was uploaded by Legitimoose on 2022-06-16 13:00:02. It has garnered 67602 views and 2718 likes. The duration of the video is 00:12:22 or 742 seconds.
Learn how to make a 1.19/1.18 plugin for Minecraft Paper/Spigot/Bukkit servers… with Kotlin (or Java, if you want)! You’ll make a small “hello world” program and set up an empty project in IntelliJ IDEA.
INSTRUCTIONS FOR NEWER VERSIONS (1.19+): At 9:05: Use the latest version from here https://papermc.io/using-the-api At 7:14: Change the api-version to your desired version (e.g. 1.19) Don’t forget to reload Maven!
If you’re curious about Java vs. Kotlin, here’s a comparison from the Kotlin website: https://kotlinlang.org/docs/comparison-to-java.html
Patreon: https://www.patreon.com/legitimoose Discord: https://discord.gg/n7z4sVG Twitter: https://twitter.com/Legitimoose
IntelliJ Idea: https://www.jetbrains.com/idea/download/ Java’s Package Name Rules: https://docs.oracle.com/javase/specs/jls/se6/html/packages.html#7.7 Latest Paper API Version: https://papermc.io/using-the-api
=== Timestamps === 0:00 – Intro 0:21 – Download IntelliJ IDEA 0:38 – Create a Project 1:43 – What are GroupId and ArtifactId? 2:58 – More Project Settings 3:57 – How to Hello World 4:52 – How to Build a Plugin .JAR 6:45 – Changing Name/Settings After Creation 7:26 – Finished Project in Java 7:32 – Converting to Kotlin 8:28 – Updating to the Latest Version 10:21 – I make a mistake (for educational purposes) 10:46 – Unsolved Mysteries of Java Versioning? 11:24 – Finish Converting to Kotlin
In this video, you’ll learn how to do project setup, set up a project, in IntelliJ IDEA for a Minecraft plugin/server-side mod. Bukkit plugins, spigot plugins, and paper plugins are for the most part, identical. Only slight feature changes have occured. Bukkit isn’t used anymore, but its name lives on in the community. Spigot is older and not used very often in modern servers. It’s what the newer, slicker, PaperSpigot is based on. PaperSpigot/PaperMC/Just Plain Ol Paper is what I use in this tutorial, and it’s what you should always use (in most situations). This video serves to help you do the hardest part of plugin development, set up a project. Setting up a development environment for Paper plugins is very hard, and finding one for Kotlin in English is even harder (there are an abundance in German though, which is pretty funny). I actually watched one of those german tutorials to learn this. With auto-translate and everything lol. This is not keyword optimization, and idk why you’d be reading this far, so this story doesn’t belong here, it’s just funny. Ahem- Kotlin and Java are compatible with eachother, and this is a minecraft java plugin tutorial, as well as a minecraft plugin tutorial kotlin, as the cool kids might say. Kotlin is much more fun to write, and is great for mods and plugins. Wondering how to write a minecraft plugin in kotlin? You’ve come to the right place. Looking for a minecraft plugin tutorial in IntelliJ? Also the right place. Good luck on your minecraft plugin making journey, in version 1.18, 1.19, 1.20? This tutorial is from 2022 and still works. It should work for a long time and I’ll update you if it doesn’t. Hope you enjoy this minecraft plugin coding tutorial and that you learn how to make a plugin for minecraft 1.19/1.18. ~Metadata Soupsmith