Debug Minecraft plugin in an IDE

Discussion in 'Spigot Plugin Development' started by Swords123456, Jun 3, 2018.

  1. in the .bat or .sh that you have running your server add this in between java and -jar
    Code (Text):
    Then run the server and you will see it is opening a dt_socket on port 5005. This shows its working. Im guessing your using IntelliJ

    So just run the debug configuration and whenever the plugin runs over a breakpoint in your code it will stop the server and let you look at everything.

    I use eclipse so i'm not sure exactly how it works in IntelliJ
  2. sorry for the late reply. the issue is that once it was connected. The plugin doesn't show when doing /plugins. And anything in the plugins isnt working. Am i doing something wrong?
    #3 Swords123456, Jun 3, 2018
    Last edited: Jun 3, 2018
  3. This could be down to a missing dependency. If it's a public plugin head over to their download page and check for any other plugins that it requires. If it's your plugin it shoulds like you're plugin.yml file is broken so double check there.
  4. Both of these tutorials are over complicated, here's a simpler one (%% = project root):

    Make a new folder called spigot, or server in %%.
    Put your spigot jar inside the folder
    In the top right corner, there should be a drop down, click that then click the option "Edit Configurations..." upload_2018-6-3_19-12-2.png
    In the window that opens, press the + and select Jar Application.
    Give the configuration a name
    For path to jar, link to the spigot jar we added into %%/spigot/ a minute ago
    Working directory is the folder your spigot jar is in
    Save the configuration
    In the dropdown, select the new configuration you made, then press the debug button (you'll need to accept the eula)

    Note, for this setup to work, you'll need to setup your buildtools to output the jar into your servers plugin folder. The intellij debugger does support hotswapping (run > reload changed classes), which allows you to automatically update your code without restarting the server, but it's very limited. I suggest setting up dcevm & hotswap agent for nearly unlimited hotswapping abilities. is also an option, but it's very expensive, the previous option is free.

    Buildtools setup:
    Add this somewhere in your build.gradle:
    Code (Text):
    tasks.withType(Jar) {
        destinationDir = file("$rootDir/spigot/plugins")
    Add this somewhere in your pom.xml
    Code (Text):
    Intellij Build Artifacts:
    #5 PiggyPiglet, Jun 3, 2018
    Last edited: Jun 3, 2018
  5. No i know it is not the plugin, because it works for an external server
  6. I am so close... in tried to install dcevm, but i got an error, i know that is a jdk. but it doesent say so
    Edit: nvm fixed it thank!
    Code (Text):
    java.lang.IllegalArgumentException: /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk is no JRE or JDK-directory.
        at com.github.dcevm.installer.Installation.<init>(
        at com.github.dcevm.installer.AddDirectoryAction.actionPerformed(
        at javax.swing.AbstractButton.fireActionPerformed(
        at javax.swing.AbstractButton$Handler.actionPerformed(
        at javax.swing.DefaultButtonModel.fireActionPerformed(
        at javax.swing.DefaultButtonModel.setPressed(
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(
        at java.awt.Component.processMouseEvent(
        at javax.swing.JComponent.processMouseEvent(
        at java.awt.Component.processEvent(
        at java.awt.Container.processEvent(
        at java.awt.Component.dispatchEventImpl(
        at java.awt.Container.dispatchEventImpl(
        at java.awt.Component.dispatchEvent(
        at java.awt.LightweightDispatcher.retargetMouseEvent(
        at java.awt.LightweightDispatcher.processMouseEvent(
        at java.awt.LightweightDispatcher.dispatchEvent(
        at java.awt.Container.dispatchEventImpl(
        at java.awt.Window.dispatchEventImpl(
        at java.awt.Component.dispatchEvent(
        at java.awt.EventQueue.dispatchEventImpl(
        at java.awt.EventQueue.access$500(
        at java.awt.EventQueue$
        at java.awt.EventQueue$
        at Method)
        at java.awt.EventQueue$
        at java.awt.EventQueue$
        at Method)
        at java.awt.EventQueue.dispatchEvent(
        at java.awt.EventDispatchThread.pumpOneEventForFilters(
        at java.awt.EventDispatchThread.pumpEventsForFilter(
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(
        at java.awt.EventDispatchThread.pumpEvents(
        at java.awt.EventDispatchThread.pumpEvents(
    #7 Swords123456, Jun 3, 2018
    Last edited: Jun 3, 2018