Creating a blank Spigot plugin in VS Code

Jul 20, 2021
Creating a blank Spigot plugin in VS Code
  • Creating a blank Spigot plugin

    in Visual Studio Code

    Visual Studio Code (VS Code) is a source code editor developed by Microsoft.
    VS Code is available for Windows, macOS and Linux.
    It is also customizable by installing extensions.
    In this tutorial, you can learn how to create a blank Spigot plugin by using VS Code and Maven.

    1. Prerequisites
    2. Prepare a workspace for developing Spigot plugin
    3. Setting up for blank plugin
    4. Create blank plugin
    5. Running your blank plugin

    • You would be using VS Code with Java Extension Pack to develop your Spigot plugin.
    • You will need OpenJDK. (Because Java Extension Pack requires OpenJDK.)
    • Apache Maven will be needed also.
    • You have basic Java knowledge.
    • There is an Internet domain you can use for group ID and package name of your plugin. (Or you can prepare an unique name from your e-mail address, etc.)

    Prepare a workspace for developing Spigot plugin

    In your VS Code, create a new workspace and edit settings for the workspace.
    You can change the settings from VS Code window menu, or by editing “default.code-workspace” file.

    Please add or change settings in below.

    files.autoGuessEncoding :
    Set true to enable text encoding guessing by VS Code.​

    files.encoding :
    Set text encoding type here.
    Please set "utf8" here.​

    java.home :
    Set an absolute path to OpenJDK.​ :
    Set extra Java VM arguments for launch Java Language Server.
    Please set "-Dfile.encoding=UTF-8".​

    javac-linter.javac :
    Set executable javac.
    Please set javac with an argument "-Dfile.encoding=UTF-8".​

    Finaly, you will get "default.code-workspace" file like below.
    Code (Text):
        "folders": [
                "path": "."
        "settings": {
            "files.autoGuessEncoding": true,
            "files.encoding": "utf8",
            "java.home": "C:\\openjdk-1.8.0",
            "": "-Dfile.encoding=UTF-8",
            "javac-linter.javac": "javac -Dfile.encoding=UTF-8"

    Setting up for blank plugin

    Right click the workspace directory, and click "Generate from Maven Archetype" in the menu.
    Click "maven-archetype-quickstart" from a menu that displayed above VS Code window.
    File explorer will be opened. Please select your workspace directory.
    You will be asked following settings of your plugin project by Maven in the shell pane.

    groupId :
    Type your Java package name.​

    artifactId :
    Type your plugin name without version number.​

    version :
    Type version number of your plugin, or just press enter key to use default version "1.0-SNAPSHOT".​

    package :
    I recommend, just press enter key to use default setting. Default setting is group ID.​

    Then you will be asked from Maven to confirm your Maven project settings.
    Type Y and press enter key to confirm if the settings are correct.
    If you get "BUILD SUCCESS" message in the shell pane, please open pom.xml in your plugin directory.
    And edit the file like following example.

    Note: “dev.cibmc.spigot.blankplugin” is used as group ID in this example.

    Code (XML):
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="" xmlns:xsi=""
    Of cource, you can change spigot API version.

    Create a resources directory to store plugin.yml file in [Project Base Dir]/src/main/.
    Create plugin.yml in the directory.
    Example of plugin.yml content is below.

    Code (YAML):
    main: dev.cibmc.spigot.blankplugin.App
    : BlankPlugin
    : 0.1
    You’ll get a directory tree like below in your workspace pane.

     ┣ src
     ┃ ┣ main
     ┃ ┃ ┣ java
     ┃ ┃ ┃ ┗ dev
     ┃ ┃ ┃   ┗ cibmc
     ┃ ┃ ┃     ┗ spigot
     ┃ ┃ ┃       ┗ blankplugin
     ┃ ┃ ┃         ┗
     ┃ ┃ ┗ resources
     ┃ ┃   ┗ plugin.yml
     ┃ ┗ test
     ┣ target
     ┗ pom.xml

    From "MAVEN PROJECTS" pane, right click "BlankPlugin" and select "install" from the menu.
    Please check there is "BUILD SUCCESS" message in the shell pane.

    Note: Please replace my group ID, "dev.cibmc.spigot.blankplugin" in the example with your group ID when you create your plugin.

    Note 2: If you don’t like a main class name “App”, please rename the file, change the class name in the Java file and edit main definition in “plugin.yml” file.

    Create blank plugin

    Open file in the directory that you created in previous chapter.
    (Or if you renamed it, open that file.)
    Example code is below.

    Code (Java):
    package dev.cibmc.spigot.blankplugin;
    public class App extends JavaPlugin {
        public void onEnable() {
            getLogger().info("Hello, SpigotMC!");
        public void onDisable() {
            getLogger().info("See you again, SpigotMC!");
    You will get a message, "Classpath is incomplete. Only syntax errors will be reported." in right-bottom of VS Code.
    Then, from "MAVEN PROJECTS" pane, right click "BlankPlugin", select "custom goals ..." from the menu.
    And type "eclipse:eclipse" on a input panel above VS Code window, and press enter key.

    Finally, from "MAVEN PROJECTS" pane, right click "BlankPlugin" and select "install" from the menu once again.
    After success building, you'll get your Spigot plugin in the target directory.

    Running your blank plugin

    Copy your plugin to Spigot plugins directory and start Spigot server.
    And you will get server logs like follows.
    Code (Text):
    [HH:MM:SS] [Server thread/INFO]: [BlankPlugin] Enabling BlankPlugin v1.0-SNAPSHOT
    [HH:MM:SS] [Server thread/INFO]: [BlankPlugin] Hello, SpigotMC!
    After you execute stop command in Spigot console, you will get server logs like follows.

    Code (Text):
    [HH:MM:SS] [Server thread/INFO]: [BlankPlugin] Disabling BlankPlugin v1.0-SNAPSHOT
    [HH:MM:SS] [Server thread/INFO]: [BlankPlugin] See you again, SpigotMC!
  • Loading...
  • Loading...