Skip to content

Master ‐ Plugin Compilation

FlyingPikachu edited this page Jan 31, 2019 · 20 revisions

Alert: This information is intended for developers. Learn how to use Java first!

Set up an IDE

If you would like to submit a Pull request (PR) without the use of Github's online tools, or would just like to change some aspects of the plugin for yourself, the best way to do so is to compile the plugin locally on your own machine.

Although this can be accomplished in several programs, this guide will proceed using the popular Eclipse IDE for Java Developers. Get it from their official website at https://www.eclipse.org/downloads/packages/

Once you've got Eclipse up and running, you'll need to install the EGit plugin in order to download the Quests source from Github. The easiest way to install it is to drag this Install link into Eclipse:

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

Alternatively, you can follow these instructions which will guide you through several windows for installation. The "preference page" that the instructions tell you to go to should look something like this:

SoftwarePic

This project also requires the use of Maven by Apache. The included Maven integration that comes with Eclipse should be sufficient, but alternatively you could install a plugin like M2Eclipse.

Download the source code

With your machine raring to go, let's download the Quests source. If you intend on submitting a Pull request, we recommend forking the Quests repository so that you have your own copy to edit, which you can then request to be merged into the original. Otherwise, if you only want to compile a copy with your own edits, copy this link:

[email protected]:FlyingPikachu/Quests.git

In Eclipse, click the Clone a Git Repository button. You're looking for it in this perspective added by EGit:

clone

Pro-tip: If you don't see the Git Repositories perspective, go to Window -> Open Perspective -> Other... -> Git

Now, you should see a window like this appear:

git

If you copied the link from earlier, all the necessary fields should populate. Otherwise, enter all the text manually. When you're done click Next > and then Finish.

Great! You've got everything you need - you just can't see it yet. Right-click in the Package Explorer perspective, then select New -> Java Project. In the Project name: field, call it something appropriate like "Quests" and then un-check the box labeled Use default location. Click 'Browse' and (on most installations) select YourAccountName -> git -> Quests.

Now, right-click on the project name in the Package Explorer perspective, then go down to Configure >. If you see an option called Convert to Maven Project, click it! Otherwise, you're all set!

Right-click the project name in the Package Explorer perspective and click Properties. In the left pane, select Resource and select the Other bubble under Text file encoding. Set the drop-down option to "UTF-8".

In the left pane, select Java Build Path and then the Libraries tab. Highlight JRE System Library and click the Edit... button. Ensure that the Execution environment is using JavaSE-1.8. If you don't see that option, you will need to download JDK 8 and restart Eclipse. Older versions of Java will not suffice. Select Finish once done.

The last step is to resolve errors by linking to required libraries. For the most part, these are other plugins that link with Quests. Select Add External JARs and find all the appropriate plugin JARs that Quests needs, which you must download if needed. This includes (but is not limited to) the latest versions of:

  • CraftBukkit
  • CitizensBooks
  • mcMMO
  • PhatLoots

As of Quests 3.5.8, you will need the GPSAPI library jar for compiling against the premium GPS plugin (or you can just buy GPS). Download the free library here.

Sharing edits

Once you've made the changes you desire, you're ready to either package it or upload it to your forked repository.

To compile Quests into a jar for use in a CraftBukkit/Spigot server, right-click the Quests project in the Package Explorer perspective and select Run as -> Run Configurations. In the Run Configurations window, select the New launch configuration button as shown below:

config

Name the configuration something familiar like "compile quests" and click Browse Workspace... to select the base directory for Quests. For Goals: simply type "clean package" without the quotes. Finally, click Run. Any remaining dependencies will be downloaded and you will end up with a finished JAR file in C:\Users\YourAccountName\git\Quests\target.

To upload the changes for future use in a Pull request, right-click the project in the Git Repositories perspective, and select Commit.... Drag any items in the Unstaged Changes window down into the Staged Changes window, then enter a brief description of the changes you made in the Commit Message window. Once you're completely sure you're ready to share your changes with the world, select the Commit and Push... button. No turning back now!

Visit your forked repository on Github and select the New pull request button to ask that the new commit(s) be merged into the original Quests repository. Follow the directions on-screen. Thank you for contributing to Quests!