-
Notifications
You must be signed in to change notification settings - Fork 0
How to set up the Source Code in Your Editor and Build
I use Linux and Eclipse. You might use the Mac OS, or Windows; obviously, you'll have to adjust my instructions for the file paths you use on your OS - as well as knowing how to do the things I do in Eclipse in your IDE (where it be IntelliJ or whatever).
git clone https://github.com/toydotgame/Thisway.git
git clone git@github.com:toydotgame/Thisway.git
- Open your IDE. These instructions will be exactly for Eclipse; other IDEs shouldn't be too different.
- Right-click in the navigation pane and select Import.
- Select Projects from Folder or Archive.
- Press Next.
- Select the folder you just cloned.
- Press Open.
- Press Finish.
spigot.jar
is in the lib/
directory of this repo.
- Right-click on your project and select Properties (At the bottom!).
- In the left pane, select Java Build Path.
- Go over to the Libraries tab.
- Select Modulepath:
- Press Add JARS (on the right).
- Go to the
lib/
folder in the repo. and selectspigot.jar
from that list. - Select Apply and Close.
- Open
src/io.github.toydotgame
in the navigation pane. - Open
Thisway.java
. That's your source code, ready for you to edit!
Thisway uses Ant mainly for API and other JARs in it's code. Ant also has a feature to auto-build on file saves, nice!
So, to start you'll need to create a build.ant
file to tell the Ant compiler what to do instead of manually doing this with JDK's compiler in Eclipse or your preferred IDE. (build.ant
needs to be in the root of the repository)
In build.ant
, paste the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<project name="SimpleProject" default="CreateJar" basedir = ".">
<basename file="${basedir}" property="project.projectname"/>
<property name="project.pluginsLocation" location="/path/to/your/export/location"/>
<target name="clean" description="Cleans project">
<delete file="${project.pluginsLocation}/${project.projectname}.jar"/>
</target>
<target name="CreateJar" description="Create a jar for the project" depends="clean">
<jar destfile="${project.pluginsLocation}/${project.projectname}.jar">
<!-- <zipfileset src="${basedir}/lib/<API>.jar" includes="**/*.java **/*.class" /> -->
<fileset dir="${basedir}">
<include name="**.yml"/> <!-- This is where you can add other filetypes, in this <fileset> tag. Currently it's just `.yml`. -->
</fileset>
<fileset dir="${basedir}\bin">
<include name="**"/>
</fileset>
</jar>
</target>
</project>
All you'll need to change here is the location
attribute of the <property>
tag on line 4. Change /path/to/your/export/location/
to wherever you want to export the JAR (Keep in mid that this is a folder, and not a JAR filename). e.g: C:\Users\H4X0R\Code\Thatway\builds
or /home/foo/minecraft_server/plugins
, etc.
- Now, right-click your project; click Properties; then choose Builders in the left pane. Press New (on the right); select Ant Builder; then press OK: (Make sure Ant is checked)
- Select Ant, click Edit on the right, then go to the Refresh tab.
- Check Refresh resources upon completion. and select the The project containing the selected resource radio button:
- Go to the Targets tab; select Set Targets... next to After a "Clean":, and make sure the option that starts with
CreateJar
is checked. Press OK to close that window.
- Select the Set Targets... button next to Auto Build:, and check the box next to the
CreateJar
-related entry. - That's just about it! Press OK to close the Ant properties window; then press Apply and Close to close the properties window for your project. Whenever you save a file, Ant will build it.
- If you have auto-building on, you're done!
- If not, right click
build.ant
in the Package Explorer pane, right-click it, and select Run As - then choose 1 Ant Build.
- If your server is already running, type
reload
into the console to reload all plugins. - If your server is not already running, launch it, and the plugin will be loaded automatically.
This documentation is property of Thisway's creators and collaborators; if you see it anywhere outside of the official GitHub wiki or Spigot page, please report it via GitHub or SpigotMC.
Here is where you can find out how Thisway works and how to use Thisway.