Envoia
Community Champion
Status
offline
Posts
688
Likes
5,828
Credits
195
LEVEL
10
2,465 XP
* This guide will be using Windows - macOS and Linux might be added later*
** Pictures will be added later **
*** This guide wont be going over plugin coding, just how to get started with IntelliJ and Plugins. I plan on posting beginner coding guides in the future. ***
Installing Intelli
Start by downloading IntelliJ HERE.
Once on the site, click on the blue or black download button. These will redirect you to the download page where you can pick between Windows, macOS and Linux operating systems. You'll find there's Ultimate and Community. (Feel free to purchase Ultimate, but it's not needed.) Under Community, click on the download button to get the installer.
Setting up IntelliJ
If you already have IntelliJ installed, I recommend you uninstall; then delete the hidden ".IDEA" and ".imi" files in any project folder.
You can locate the hidden files in "%APPDATA%\JetBrains\" and "%LOCALAPPDATA%\JetBrains".
Before we start with the plugin itself, we'll be editing global settings on IntelliJ. It's recommended you apply all these settings to save time.
You should now be on the "Welcome to IntelliJ IDEA." If you already have a project opened, close the project to show the screen. Adjusting the settings from the welcome screen ensures all projects (current/new) receive these settings. Now click on "Customize" and click on "All Settings" at the bottom. In your settings, open the Keymap section. Here will be adding a keymap to close your active tab. Set this to whatever you want, but I recommend CTRL+W. Search "Keymap", then open that up and search "Close Active Tab". We'll now be adjusting the plugins used by IntelliJ. Clear your search for Keymap, and Plugins will appear below Editor.
Install the following plugins:
Increasing performance with IntelliJ.
Configuring plugins
Build projects automatically
Enhance your editor settings
Now close that out and create a new project. Upon clicking create a new project, you'll need to change "Build system" to Maven and select your JDK. If you don't have one already, it's okay since IntelliJ can download it. I recommend Java 17 as Minecraft now requires it. Now you may choose the name of your project, but try not to use spaces. It will make your life harder.
Setting up pom.xml
Before we start, you need to decide on an API version HERE
Now, open up the pom.xml file and paste the text at the bottom above "</project>".
Afterwards replace "PUT API VERSION HERE" with the one you chose from the Spigot site. Now IntelliJ already should automatically download the sources from the settings above, but it's always good to double check. To confirm everything downloaded, right-click on the pom.xml file, navigate to "Maven", and click on "Download Sources and Documentation".
Package and Class Setup
Under your project files, you should see the ".idea" and "src" folders. Everything involving the plugin itself will go under the "src" folder, so open that up. Now open the "main" folder you'll find a folder called "java". Right-click the "Java" folder and create a new package. I recommend naming it something like "com.yourname.pluginname". Now right-click the package to create a Java Class. This will be the main class file of the plugin. Some people name it "Main", but I go with whatever I'm calling the plugin.
Class File Setup
When opening your class file, you should see something similar depending on your package and class names.
Copy the text below and do NOT replace your class or package name. Failure to follow this step will result in errors.
Plugin.yml Setup
Under the "src" and "main" folders, you should see a "resources" folder. Here we'll be creating the plugin.yml, which can be done by right-clicking the resources folder and create a new file. Make sure to name it "plugin.yml", as this is needed for plugins to work. Copy the text below into the file you just created.
** Pictures will be added later **
*** This guide wont be going over plugin coding, just how to get started with IntelliJ and Plugins. I plan on posting beginner coding guides in the future. ***
Installing Intelli
Start by downloading IntelliJ HERE.
Once on the site, click on the blue or black download button. These will redirect you to the download page where you can pick between Windows, macOS and Linux operating systems. You'll find there's Ultimate and Community. (Feel free to purchase Ultimate, but it's not needed.) Under Community, click on the download button to get the installer.
Setting up IntelliJ
If you already have IntelliJ installed, I recommend you uninstall; then delete the hidden ".IDEA" and ".imi" files in any project folder.
You can locate the hidden files in "%APPDATA%\JetBrains\" and "%LOCALAPPDATA%\JetBrains".
Before we start with the plugin itself, we'll be editing global settings on IntelliJ. It's recommended you apply all these settings to save time.
You should now be on the "Welcome to IntelliJ IDEA." If you already have a project opened, close the project to show the screen. Adjusting the settings from the welcome screen ensures all projects (current/new) receive these settings. Now click on "Customize" and click on "All Settings" at the bottom. In your settings, open the Keymap section. Here will be adding a keymap to close your active tab. Set this to whatever you want, but I recommend CTRL+W. Search "Keymap", then open that up and search "Close Active Tab". We'll now be adjusting the plugins used by IntelliJ. Clear your search for Keymap, and Plugins will appear below Editor.
Install the following plugins:
Save Actions
Fast-Scrolling
DO NOT install Minecraft Development. It's unnecessary and will restrict what versions of Minecraft your plugins support.
Fast-Scrolling
DO NOT install Minecraft Development. It's unnecessary and will restrict what versions of Minecraft your plugins support.
Increasing performance with IntelliJ.
Disable the following plugins:
Andriod Selection
Code Coverage Section
HTML and XML Section
Groovy
Plugin Development Section
Test Tools Section
Version Controls Section (Optional if you don't want to use GitHub. If you plan on using GitHub disable this)
Code With ME
Completion Stats Collector
Copyright
Grazie
IDE Features Trainer (Optional, but you probably won't need it)
Kotlin
Task Management
Once finished, click on OK and restart IntelliJ
Andriod Selection
Code Coverage Section
HTML and XML Section
Groovy
Plugin Development Section
Test Tools Section
Version Controls Section (Optional if you don't want to use GitHub. If you plan on using GitHub disable this)
Code With ME
Completion Stats Collector
Copyright
Grazie
IDE Features Trainer (Optional, but you probably won't need it)
Kotlin
Task Management
Once finished, click on OK and restart IntelliJ
Configuring plugins
Open Settings > Other Settings > Save Actions and enable the following entries:
Generation section:
Activate save actions on save
Formatting actions:
Optimize Imports
Reformat file
Build actions:
Reload files in running debugger
Java Inspect and quick fix:
Add missing @override annotations
Remove final from private method
Remove explicit generic type for diamond
Remove unnecessary semicolon
Generation section:
Activate save actions on save
Formatting actions:
Optimize Imports
Reformat file
Build actions:
Reload files in running debugger
Java Inspect and quick fix:
Add missing @override annotations
Remove final from private method
Remove explicit generic type for diamond
Remove unnecessary semicolon
Build projects automatically
Open Settings > Build, Execution and Deployment > Compiler
Select "Build project automatically" and also increase "Share build process heap size (Mbytes)" to 1500 if your computer allows for it.
Inside the same settings menu, go to Build Tools > Maven > Importing. Enable "Automatically download" for "Sources" and "Documentation".
Select "Build project automatically" and also increase "Share build process heap size (Mbytes)" to 1500 if your computer allows for it.
Inside the same settings menu, go to Build Tools > Maven > Importing. Enable "Automatically download" for "Sources" and "Documentation".
Enhance your editor settings
Open Settings > Editor > Code Style > Java > Tabs and Indents
Enable "Use tab character".
Open Settings > Editor > Inspections
Search "typo" and untick "Typo" option for proofreading and UI form sections.
Search "Static Methods Declared Final" and untick that option.
Open Settings > Editor > General > Auto Import
Enable "Optimize Imports on the fly" and "Add unambiguous import on the fly".
Open Settings > Editor > General > Code Completion
Untick "Match case" setting.
Enable "Show the documentation popup" and set it to "500"
Enable "Show Parameter name hints on completion"
Open Settings > Editor > General > Code Folding
In Java section untick "One-line methods" and "Closures"
Open Settings > Editor > General > Editor Tabs
Tick "Mark modified(*)"
Open Settings > Editor > General > Smart Keys
Untick "Use "CamelHumps" words".
Enable "Use tab character".
Open Settings > Editor > Inspections
Search "typo" and untick "Typo" option for proofreading and UI form sections.
Search "Static Methods Declared Final" and untick that option.
Open Settings > Editor > General > Auto Import
Enable "Optimize Imports on the fly" and "Add unambiguous import on the fly".
Open Settings > Editor > General > Code Completion
Untick "Match case" setting.
Enable "Show the documentation popup" and set it to "500"
Enable "Show Parameter name hints on completion"
Open Settings > Editor > General > Code Folding
In Java section untick "One-line methods" and "Closures"
Open Settings > Editor > General > Editor Tabs
Tick "Mark modified(*)"
Open Settings > Editor > General > Smart Keys
Untick "Use "CamelHumps" words".
Now close that out and create a new project. Upon clicking create a new project, you'll need to change "Build system" to Maven and select your JDK. If you don't have one already, it's okay since IntelliJ can download it. I recommend Java 17 as Minecraft now requires it. Now you may choose the name of your project, but try not to use spaces. It will make your life harder.
Setting up pom.xml
Before we start, you need to decide on an API version HERE
Now, open up the pom.xml file and paste the text at the bottom above "</project>".
Code:
<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<!--This adds the Spigot API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>PUT API VERSION HERE</version>
<scope>provided</scope>
</dependency>
</dependencies>
Afterwards replace "PUT API VERSION HERE" with the one you chose from the Spigot site. Now IntelliJ already should automatically download the sources from the settings above, but it's always good to double check. To confirm everything downloaded, right-click on the pom.xml file, navigate to "Maven", and click on "Download Sources and Documentation".
Package and Class Setup
Under your project files, you should see the ".idea" and "src" folders. Everything involving the plugin itself will go under the "src" folder, so open that up. Now open the "main" folder you'll find a folder called "java". Right-click the "Java" folder and create a new package. I recommend naming it something like "com.yourname.pluginname". Now right-click the package to create a Java Class. This will be the main class file of the plugin. Some people name it "Main", but I go with whatever I'm calling the plugin.
Class File Setup
When opening your class file, you should see something similar depending on your package and class names.
Java:
package net.nullforums.tutorial;
public class NFTutorial {
}
Copy the text below and do NOT replace your class or package name. Failure to follow this step will result in errors.
Java:
package net.nullforums.tutorial;
public class NFTutorial extends JavaPlugin { //Extend the JavaPlugin so we can implement internal methods.
public void onEnable() { //Code used when plugin is loaded
}
public void onDisable() { //Code used when plugin is unloaded
}
}
Plugin.yml Setup
Under the "src" and "main" folders, you should see a "resources" folder. Here we'll be creating the plugin.yml, which can be done by right-clicking the resources folder and create a new file. Make sure to name it "plugin.yml", as this is needed for plugins to work. Copy the text below into the file you just created.
Code:
main: net.nullforums.tutorial.NFTutorial //Replace with package and class name
name: NFTutorial //Replace with plugin name
version: 1.0
api-version: PUT API VERSION HERE //Same as pom.xml file
Compiling and Testing
At the top right of IntelliJ you'll see an "Add Configuration" button. Click on that and click the plus, located in the top left corner of the new window. Select Maven and name it whatever. Inside you'll see a "Run" section with a "Command line" text box. Inside the text box type "clean install" and hit apply. You can now close out of that window. You'll now see a green arrow to the right of where it used to say "Add Configuration"(Should be replaced with NAME [clean, install]). Once your plugin is ready clicking on that green arrow will compile the plugin.
With that you're now ready to start coding your first plugin.
Last edited: