Skip to content

Commit 1bc79fc

Browse files
authored
Initial commit
0 parents  commit 1bc79fc

20 files changed

Lines changed: 911 additions & 0 deletions

.gitattributes

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Auto detect text files and perform LF normalization
2+
*.java text=auto eol=lf
3+
*.xml text=auto eol=lf
4+
*.json text=auto eol=lf
5+
*.md text=auto eol=lf
6+
*.yml text=auto eol=lf
7+
*.template text=auto eol=lf
8+
*.txt text=auto eol=lf
9+
*.bat text=auto eol=lf
10+
*.gradle text=auto eol=lf
11+
*.sh text=auto eol=lf
12+
*.html text=auto eol=lf
13+
*.settings text=auto eol=lf
14+
Jenkinsfile text=auto eol=lf
15+
gradlew test=auto eol=lf
16+
*.py text=auto eol=lf

.github/workflows/build.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Plugin Build
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- "1.21.0"
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out repository
14+
uses: actions/checkout@v4
15+
with:
16+
persist-credentials: false
17+
18+
- name: Setup JDK
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: '21'
22+
distribution: 'temurin'
23+
24+
- name: Elevate wrapper permissions
25+
run: chmod +x ./gradlew
26+
27+
- name: Setup Gradle
28+
uses: gradle/actions/setup-gradle@v4
29+
with:
30+
dependency-graph: generate-and-submit
31+
32+
- name: Build Plugin
33+
run: ./gradlew build
34+
35+
- name: Upload Plugin Artifact
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: plugin
39+
path: build/libs/*.jar

.github/workflows/publish.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish Plugin
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Check out repository
11+
uses: actions/checkout@v4
12+
with:
13+
persist-credentials: false
14+
15+
- name: Setup JDK
16+
uses: actions/setup-java@v4
17+
with:
18+
java-version: '21'
19+
distribution: 'temurin'
20+
21+
- name: Elevate wrapper permissions
22+
run: chmod +x ./gradlew
23+
24+
- name: Setup Gradle
25+
uses: gradle/actions/setup-gradle@v4
26+
with:
27+
dependency-graph: generate-and-submit
28+
29+
- name: Build Plugin
30+
run: ./gradlew build
31+
32+
- name: Upload Plugin Artifact
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: plugin
36+
path: build/libs/*.jar
37+
38+
- name: Get Plugin Version
39+
run: echo "PLUGIN_VERSION=$(grep '^plugin_version=' gradle.properties | cut -d'=' -f2)" >> $GITHUB_ENV
40+
41+
- name: Publish Plugin Github Release
42+
uses: ncipollo/release-action@v1
43+
with:
44+
tag: ${{ env.PLUGIN_VERSION }}
45+
artifacts: build/libs/*.jar
46+
generateReleaseNotes: true

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/.idea/*
2+
!/.idea/runConfigurations
3+
*.iml
4+
/run/
5+
/log/
6+
/build/
7+
/.gradle/
8+
*.class
9+
*.ipr
10+
/out/
11+
.DS_Store
12+
# any json-like file in top directory, including configs, auth cache, etc.
13+
/*.json*
14+
*.tmp
15+
/.vscode
16+
/launcher
17+
/ViaLoader/
18+
dist/
19+
/*.spec
20+
__pycache__/
21+
*.exe
22+
*.zip
23+
/launcher-python*
24+
maps/
25+
replays/
26+
plugins/
27+
28+
dataGenerator/run
29+
/dataGenerator/.gradle
30+
31+
/dataGenerator/build
32+
/dataGenerator/.idea
33+
34+
# Ignore Gradle project-specific cache directory
35+
.gradle
36+
37+
# Ignore Gradle build output directory
38+
build

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 rfresh2
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# ZenithProxy Example Plugin
2+
3+
[ZenithProxy](https://github.com/rfresh2/ZenithProxy) is a Minecraft proxy and bot.
4+
5+
This repository is an example core plugin for ZenithProxy, allowing you to add custom modules and commands.
6+
7+
## Installing Plugins
8+
9+
Plugins are only supported on the `java` ZenithProxy release channel (i.e. not `linux`).
10+
11+
Place plugin jars in the `plugins` folder inside the same folder as the ZenithProxy launcher.
12+
13+
Restart ZenithProxy to load plugins. Loading plugins after launch or hot reloading is not supported.
14+
15+
## Creating Plugins
16+
17+
Use this repository as a template to create your own plugin repository.
18+
19+
### Plugin Structure
20+
21+
Each plugin needs a main class that implements `ZenithProxyPlugin` and is annotated with `@Plugin`.
22+
23+
Plugin metadata like its unique id, version, and supported MC versions is defined in the `@Plugin` annotation.
24+
25+
[See example](https://github.com/rfresh2/ZenithProxyExamplePlugin/blob/1.21.0/src/main/java/org/example/ExamplePlugin.java)
26+
27+
### Plugin API
28+
29+
The `ZenithProxyPlugin` interface requires you to implement an `onLoad` method.
30+
31+
This method provides a `PluginAPI` object that you can use to register modules, commands, and config files.
32+
33+
`Module` and `Command` classes are implemented the same as in the ZenithProxy source code.
34+
35+
I recommend looking at existing modules and commands for examples.
36+
37+
* [Module](https://github.com/rfresh2/ZenithProxy/tree/1.21.0/src/main/java/com/zenith/module)
38+
* [Command](https://github.com/rfresh2/ZenithProxy/tree/1.21.0/src/main/java/com/zenith/command)
39+
40+
### Building Plugins
41+
42+
Execute the Gradle `build` task: `./gradlew build` - or double-click the task in Intellij
43+
44+
The built plugin jar will be in the `build/libs` directory.
45+
46+
### Testing Plugins
47+
48+
Execute the `run` task: `./gradlew run` - or double-click the task in Intellij
49+
50+
This will run ZenithProxy with your plugin loaded in the `run` directory.
51+
52+
### New Plugin Checklist
53+
54+
1. Edit `gradle.properties`:
55+
- `plugin_name` - Name of your plugin, used in the plugin jar name (e.g. `ExamplePlugin`)
56+
- `maven_group` - Java package for your project (e.g. `com.github.rfresh2`)
57+
1. Move files to your new corresponding package / maven group:
58+
- Example: `src/main/java/org/example` -> `src/main/java/com/github/rfresh2`
59+
- First create the new package in `src/main/java`. Then click and drag original subpackages/classes to your new one
60+
- Do this with Intellij to avoid manually editing all the source files
61+
- You must also move folders/package for the `src/main/templates` folder
62+
- Also make sure to update the package import at the very top of `BuiltConstants.java`, it will not be done automatically
63+
1. Edit `ExamplePlugin.java`, or remove it and create a new main class
64+
- Make sure to update the `@Plugin` annotation

build.gradle.kts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
plugins {
2+
id("zenithproxy.plugin.dev") version "1.0.0-SNAPSHOT"
3+
}
4+
5+
group = properties["maven_group"] as String
6+
version = properties["plugin_version"] as String
7+
val mc = properties["mc"] as String
8+
9+
java { toolchain { languageVersion = JavaLanguageVersion.of(21) } }
10+
11+
zenithProxyPlugin {
12+
templateProperties = mapOf(
13+
"version" to project.version
14+
)
15+
}
16+
17+
repositories {
18+
maven("https://maven.2b2t.vc/releases") {
19+
description = "ZenithProxy Releases and Dependencies"
20+
}
21+
maven("https://maven.2b2t.vc/remote") {
22+
description = "Dependencies used by ZenithProxy"
23+
}
24+
}
25+
26+
dependencies {
27+
zenithProxy("com.zenith:ZenithProxy:$mc-SNAPSHOT")
28+
}

gradle.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
plugin_version=1.0.0
2+
plugin_name=ZenithProxyExamplePlugin
3+
mc=1.21.0
4+
maven_group=org.example
5+
6+
org.gradle.configuration-cache=true
7+
org.gradle.parallel=true
8+
org.gradle.caching=true
9+

gradle/wrapper/gradle-wrapper.jar

42.7 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)