Guide Setting up Intellij to code your own Plugins!

Envoia

User Suspended

Status

offline

Posts

688

Likes

5,830

Bits Credits

195

LEVEL

10

2,465 XP

Member suspended from NullForums
* This guide only supports Minecraft 1.16 and above *
** Refer to this alternative guide for earlier versions. Support for prior versions is not available. **
*** Please note that this tutorial focuses on configuring IntelliJ and does not cover plugin coding. ***
Removing old Java versions
Before you start developing it is important to ensure no other installations of Java are present on your computer.

Step 1: Examine your computer's Java version through the console or control panel. If it indicates a version below 8, utilize the official tool provided here to eliminate any previous or outdated installations: Java Uninstall Tool
Step 2 (macOS Only): For Mac users, execute the following commands in your Terminal. Please be aware that this will uninstall all installed Java versions. Ensure that you are logged in as an administrator.
Code:
sudo rm -rf /Library/Java/*
sudo rm -rf /Library/PreferencePanes/Java*
sudo rm -rf /Library/Internet\ Plug-Ins/Java*
sudo rm -fr ~/Library/Application\ Support/Oracle/Java
Step 3: Confirm the successful uninstallation by running the DetectJava.jar tool available at this location: Detect Java Tool

Installing and Configuration
Starting from Minecraft 1.16, Java 17 is employed, and you can download it from this link: Java JDK Download

Configuring Java Variables (Windows Only)
If the "java" command is not automatically recognized when running a command prompt, you must configure the system variables to enable automatic recognition in Windows
Step 1: Locate the environment variables for your operating system.
Code:
Windows 7 – Right click My Computer and select Properties > Advanced
Windows 8 – Go to Control Panel > System > Advanced System Settings
Windows 10 and 11 – Search for Environment Variables then select Edit the system environment variables
Step 2: Add a new system variable named JAVA_HOME with a value pointing to the path of your Java JDK directory, for instance, C:\Program Files\Java\jdk-17.0.1.
Step 3: Edit the user variable PATH to include the same path as JAVA_HOME, along with the \bin folder.
Step 4: After completing the Java installation, re-run the DetectJava.jar to confirm a successful installation.
The tool should indicate that you are using a JDK (Java Development Kit, used for creating programs) rather than a JRE (Java Runtime Environment, designed solely for running programs but not for compilation).

Setting Up IntelliJ
Complete this guide even if you're experienced with IntelliJ, because these steps will help you write better code, in less time.

Step 1: Removing previous versions
Notice: If you already have a project on your computer that uses IntelliJ and you want to reset it, then remove the hidden .IDEA and .iml file in your project's source folder. On Windows you need to show hidden files using this guide first. On macOS, follow this guide.
Check this link for the official IntelliJ uninstallation guide.

Guide for Windows:
Step A: Uninstall IntelliJ using the “Apps” section of Settings (Windows 10/11) or the standard “Add or remove programs” in your Windows Control Panel (Windows 7/8).
Step B: Open Run and put the following entries into it. For each entry it's going to open a folder where you need to remove relevant IntelliJ files.
Warning: Do not remove these folders! Open them, and only remove “IntelliJ…” subfolders from them.
Code:
%APPDATA%\JetBrains
%LOCALAPPDATA%\JetBrains

Guide for macOS:
Step A: Download AppCleaner and drag IntelliJ application over it. Select all and remove it.
Step B: Open Finder, click Go in the menu bar and select “Go to Folder”. Type the followinglinks and remove all IntelliJ-related sub-folders from the list.
Warning: Do not remove these folders! Open them, look for “JetBrains” and onlyremove “IdeaIC…” subfolders from them (IdeaIC is a name for IntelliJ IDEA).
Code:
~/Library/Application Support/
~/Library/Caches/
~/Library/Preferences/
~/Library/Logs
Step 2: Download the IntelliJ for your computer here.

Editing Global Settings
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.
Notice: If you do not do this and access Settings from the File dropdown menu, your changes will only be applied to your current project.
In your Settings, open Keymap section. We will be adding a useful keymap to close your active tab, I recommend CTRL + W or command + W for Mac for your convenience.

First we need to make sure the keys we want to press to close our active tab are not in use. Click the bigger magnifying glass icon on the upper side of the screen. The icon is the one most to the right. In Find Shortcut, without clicking anywhere, just press the desired key combination on your keyboard. We press CTRL + W on Windows and command + W for Mac respectively.

If you see results corresponding with that key, we need to remove it. Right click all lines you see on your left from the search results and select Remove Ctrl+W or appropriate key combination. Now you are free to assign this key.

To assign the close active tab key, find the little magnifying glass icon on the upper right side of the screen. This little icon is located to the left of the bigger one that we used previously. You click in between this icons so you can start typing text. Type “close”. Navigate your eyes to Main Menu > Window > Editor Tabs > Close. If there is a key already, right click the line and remove it with “Remove (...)”. Now right click the line and select Add Keyboard Shortcut. New dialog appears in which you simply press the desired key on your keyboard. We press CTRL+W for Windows and command+W for Mac. Click OK.

Installing and Configuring Plugins
Installing Plugins

Navigate to File > Settings > Plugins tab and install the following plugins:
Code:
Save Actions Tool
Fast-Scrolling
Presentation Assistant (Optional)
Minecraft Development

For maximum performance, you can disable plugins you do not use. Plugins change with every IntelliJ release, so here are only estimates of what I personally never use and you can disable:
Code:
- Android section
- Build tools section: Gradle — only disable this if you're not using it
- Code Coverage section
- HTML and XML section
- Plugin Development section
- Test Tools section
- Version Controls section — we'll be using the standalone GitHub app later
- Code With ME
- Completion Stats Collector
- Copyright
- Grazie
- IDE Features Trainer — beginners can leave this on but I personally never used it
- Kotlin
- Qodana
- Space
- Task Management
Hit OK and restart.

Configuring Plugins
(If you've installed Presentation Assistant) Open Settings > Appearance & Behavior > Presentation Assistant. Configure the Presentation assistant to use the keymap you configured when launching IntelliJ for the first time. If unsure, click Keymap in Settings window and see what keymap you are currently using.

Open Settings > Other Settings > Save Actions and enabled the following entries:
General section:
- Activate save actions on save
Formatting actions:
- Optimize imports
- Reformat file
Build actions:
- Reload files in running debugger
- Some people may need to have the other option enabled “Compile files…”
Java inspection 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 “Shared build process heap size (Mbytes)” to 1500 if your computer memory allows it.

Stay in the In the Build, Execution and Deployment, go Build Tools > Maven > Importing. Enable “Automatically download” for “Sources” and “Documentation”.

Enhance Your Editor Settings
Open Settings > Editor > Code Style > Java > Tabs and Indents and enable “Use tab character”.

Open Settings > Editor > Inspections. Next to the magnifying glass, type “typo” and untick “Typo” option for Proofreading and UI form sections. Now search for “static methods declared final” and untick that option.

Open Settings > Editor > General > Auto Import. Enable “Optimize imports on the fly” and “Add unambiguous imports on the fly”.

Open Settings > Editor > General > Code Completion. Untick “Match case” setting, enable “Show the documentation popup” and set it to “500” and finally 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”
 
Last edited:

TartealaFraise

Newcomer

Status

offline

Posts

7

Likes

5

Bits Credits

0

LEVEL

1

210 XP

thank you very much, I love this idea but quite cumbersome to configure
 
Liked by:

Latest threads

Forum statistics

Threads
59,097
Messages
90,296
Members
56,034
Latest member
destroiapb
Top Bottom