|
1 |
| - Rusherhack Example Plugin |
| 1 | +# RusherHack Example Plugin |
2 | 2 |
|
3 |
| -This is an example plugin that shows how to use Rusherhack's plugin API. |
| 3 | +An example implementation of a RusherHack plugin. |
4 | 4 |
|
5 |
| -## Building: |
| 5 | +RusherHack plugins are custom add-ons written by developers to add new features to RusherHack. |
6 | 6 |
|
7 |
| -### Option 1: Intelij IDEA |
8 |
| -1. Download [intelij idea community edition](https://www.jetbrains.com/idea/download). Make sure to scroll down to community edition - pro costs money |
9 |
| -2. Install idea using whatever method you downloaded and run it |
10 |
| -3. It should look like this. Click "clone repository" and type in `https://github.com/john200410/example-plugin` |
| 7 | +## Setting up the Development Environment |
11 | 8 |
|
12 |
| - |
| 9 | +### Installing Java Development Kit (JDK) |
13 | 10 |
|
14 |
| -4. Once it is done cloning (downloading) click on "trust project" and it should up the ide window |
| 11 | +For Minecraft versions 1.20.1-1.20.4, you will need to have JDK 17 installed. You can download it [here](https://www.azul.com/downloads/?version=java-17-lts&package=jdk#zulu). |
15 | 12 |
|
16 |
| - |
| 13 | +For Minecraft versions 1.20.5 and newer, you will need to have JDK 21 installed. You can download it [here](https://www.azul.com/downloads/?version=java-21-lts&package=jdk#zulu). |
17 | 14 |
|
18 |
| -5. Click on the little elephant in the corner (Gradle) |
| 15 | +### Installing IntelliJ IDEA |
19 | 16 |
|
20 |
| - |
| 17 | +IntelliJ IDEA is the preferred Java IDE for rusherhack plugin development. |
21 | 18 |
|
22 |
| -6. Click on the button that a box with a play button and then type "build" in the text box that pops up |
| 19 | +IntelliJ IDEA can be downloaded from [the official website](https://www.jetbrains.com/idea/download). |
23 | 20 |
|
24 |
| - |
| 21 | +The Community edition is recommended because it is free and open-source. |
25 | 22 |
|
26 |
| -7. Press enter. A window should pop up in the bottom with a bunch of text info. |
| 23 | +## Clone the repository |
27 | 24 |
|
28 |
| - |
| 25 | +In IntelliJ, when creating a new project there is an option to clone a repository: |
29 | 26 |
|
30 |
| -8. Once this is done (it should finish successfully, if it is unsuccessful, please ask in #plugins-dev) your compiled jar should be in the build/libs folder of the project folder. |
| 27 | +<img src="https://rusherhack.org/i/zsa4nyb3v3m5ifk8gkyoywak.png" alt="cloning" width="600"/> |
31 | 28 |
|
32 |
| -9. You can open up the project folder using file explorer, and use that jar as you would with any other plugin (see [Rusherhack Plugins](https://github.com/RusherDevelopment/rusherhack-plugins/blob/main/README.md)) |
| 29 | +In the URL, write the text `https://github.com/RusherDevelopment/example-plugin.git` and press `Clone` |
33 | 30 |
|
34 |
| - |
35 |
| -### Option 2: Linux command line |
| 31 | +<img src="https://rusherhack.org/i/2rdwc40q98ihb93lt1yykyw8.png" alt="cloning2" width="600"/> |
36 | 32 |
|
37 |
| -1. This method only works on Linux, WSL, and probably git bash. NOT POWERSHELL |
38 |
| -2. Open up terminal and run these commands in order |
39 |
| -``` |
40 |
| -git clone https://github.com/john200410/example-plugin |
41 |
| -cd example-plugin |
42 |
| -chmod +x gradlew |
43 |
| -./gradlew build |
44 |
| -``` |
45 |
| -3. If something goes wrong in any of these steps, you may not have java installed. Install something around the lines of `jdk21-openjdk` from your package manager. If more goes wrong, please ask in #plugins-dev |
46 |
| -4. Your compiled jar file should be in the build/libs subdirectory of the project folder. |
47 |
| -5. You can use that jar as you would with any other plugin (see [Rusherhack Plugins](https://github.com/RusherDevelopment/rusherhack-plugins/blob/main/README.md)) |
48 |
| - |
| 33 | +IntelliJ may prompt you asking if you trust the project. Click `Trust Project` to continue. |
| 34 | + |
| 35 | +You should now have a window that looks like this: |
| 36 | + |
| 37 | +<img src="https://rusherhack.org/i/vwvie6ljusi2tfunyrmvty7j.png" alt="project" width="800"/> |
| 38 | + |
| 39 | +## Modifying the template |
| 40 | + |
| 41 | +- Open the `gradle.properties` file and modify it to your preferences. |
| 42 | +- Open the `src/main/resources/rusherhack-plugin.json` file and modify it to your preferences. |
| 43 | + - The `Plugin-Class` property must match the main class of your plugin. |
| 44 | + - The `Name`, `Version`, and `Minecraft-Versions` properties get automatically filled by the values in the `gradle.properties` file. You can add more Minecraft versions if you wish but compatibility between multiple versions is not guaranteed. |
| 45 | + |
| 46 | +## Building the plugin |
| 47 | + |
| 48 | +To build the plugin .jar file, you can run the `gradle build` task. |
| 49 | + |
| 50 | +1. Click on the elephant icon on the right of the screen (Gradle) |
| 51 | +2. Navigate to `Tasks` -> `build` -> `build` and double-click it: |
| 52 | + |
| 53 | +<img src="https://rusherhack.org/i/jkdw12a3wtsz9vvwpvujo9px.png" alt="gradle" width="400"/> |
| 54 | + |
| 55 | +3. The compiled plugin .jar file will be located in the `build/libs` directory: |
| 56 | + |
| 57 | +<img src="https://rusherhack.org/i/lfwho6o6vrqc4c3znl3pm60v.png" alt="build" width="400"/> |
| 58 | + |
| 59 | +To install the plugin into RusherHack, you can follow the instructions on the [RusherHack plugins repository](https://github.com/RusherDevelopment/rusherhack-plugins?tab=readme-ov-file#installation) |
0 commit comments