/DFSpaghetti

A tool for coping

Primary LanguageJavaMIT LicenseMIT

A tool for translating DiamondFire templates into Java Spigot Dependency Code. 

If you wish to contribute, go ahead, but please follow the code standards laid out by the existing project files, and use the current systems I've created. (Unless you are trying to improve them, in which case, go for it.)

📚 Utility Classes

The java classes found in this repository need to be imported to provide the methods that your plugin needs to run. But first, read the sections below to learn how to generate your DFPlugin.java class. This class will communicate with the other classes found in this repo to move your games from DiamondFire to a server of your own. 👍

💾 Setting up your project

⚠️ ⚠️ ⚠️ WARNING: This tutorial is months out of date! I will publish another one, please be patient.

Before you can compile the code, you need to first set up your project in a standard IDE. This tutorial covers the IntelliJ IDE, so install this first.

Once installed, you should see this welcome screen when opening the IDE for the first time:

welcomeMenu

I have provided a starter project with all the boilerplate code you need. Download it here. [OUTDATED]

After downloading, Click on "Open or Import" from the welcome screen and import the project from the google drive.
Alternatively, if you've left the welcome screen or this isn't your first time using IntelliJ, navigate to File -> Open and import the project from there.

⭐ Downloading Spigot

At first, IntelliJ might not recognize some of the dependencies in your project. We'll worry about that later. Spigot, which is the main API powering minecraft plugins is not like other maven dependencies, as it's not part of the maven public repository, which means you will need to have it locally stored on your computer in order to compile properly.

To get started, download BuildTools. This will let you download spigot later on. After you've downloaded it, it'll probably be lying somewhere in your Downloads folder.

Open up the windows command prompt (or any equivalent on other operating systems), and type cd <BuildTools Directory Path. The directory path should be pointing to the folder that BuildTools.jar is in, not BuildTools itself. So for example: C:\Users\Wonk\Downloads instead of C:\Users\Wonk\Downloads\BuildTools.jar.

If you don't know where your BuildTools ended up, you can view so from your browser's downloads tab. On most browsers, the shortcut CTRL + J will open it up.

Once you've typed the command, you should see that your command directory has changed. Next, type java -jar BuildTools.jar --rev 1.19 Downnloading might take a few minutes, but don't close the tab until it's done.

🔄 Reloading Maven Dependencies

Now in order to load your dependencies, navigate to the right hand side of your screen, and click the button with the maven logo & trademark on it.

mvnButton

This will open a menu on the right, in which you need to click the arrows spinning counterclockwise which say "Reload All Maven Projects", fouund in the top left of the menu.

mvnReload

Reloading could take a bit on lower-end machines, but you can view the progress in the bottom right.


📦 Generating your DFPlugin.java class

In order to generate the code for your plugin, you first need to copy the template data from the line of code that you want to import. To do this, go up to the starting block of your code line, and break it while shifting. This will give you an enderchest containing the template data that you need, but before continuing, make sure to place back the enderchest to avoid losing the code. You will keep the item even after placing it back.

While holding the enderchest in your hand, run the command /i nbt in chat. This will send a large message with some gray text at the bottom.

nbtMsg

Open your chat and click on "Click to copy unformatted NBT". This will copy the data to your clipboard. Next, visit the project's website, and scroll down until you see an input field saying "Insert Template Data Here...":

nbtInput

Paste the template data that you've previously copied by Right Clicking -> Paste. Now click "Generate Code". The code will appear in the text area below. Copy & Paste this in your DFPlugin.java file inside your IDE.

🎁 Importing Commands

TODO: Fill out this section once commands are supported.

⚠️ Please keep in mind that generating code from code lines containing unsupported actions will yield errors. You can view a list of all the supported actions here.



📙 How to compile your plugin

For compiling your plugin, visit this.