Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to 1.19.1 & Bump version #8

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,6 @@ gradle-app.setting
# gradle/wrapper/gradle-wrapper.properties

.idea/

# workload directory
tmp/
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
## patcher
## Arclight Plugin Patcher

**NOTE**: This repository only contains the WorldEdit-related patch.
You'll have to code it yourself, with looking through Arclight API & Spigot API,
if you want to patch other plugins not properly working on Arclight.

### Update Instructions

**WARN**: If you don't remove `{server-root}/.arclight/patcher` directory, the new patch won't apply!

1. You want to replace plugin file, so you *must* stop the server first.
2. Drop `patcher-loader-(version).jar` in `plugins`.
3. Head to `.arclight`. This will exist on the root of the server.
4. Remove `patcher` directory. If you don't remove it, the new patch won't be applied.
5. Now you can start the server.

### Build

The build uses Spigot-API, so you don't have to build it with buildtools.

1. You'll want to make your clone _(don't just download- the build will fail if you just download it)_ of this repo.
I'll recommend creating your own fork before cloning, and work on that fork.
2. If you want to customize it, you'll want to head up to two `build.gradle`, one at the root and the other in `patcher-loader`.
You can manage the build distributions with some uncommenting (removing `//`) and commenting (adding `//` at the very first of the very line).
> **WARN**: If two-or-more definition of Spigot-API or Java Version exists, the build can fail. Implement *only* one Spigot-API, and define *only* one JAVA version!
**Note**: If you want to customize it out of the code, you'll have to add your own version of Spigot-API. Further, you'll have to check the build number(like `R0.1`) to successfully configure it.
3. You'll want to grab some Java JDK, according to the setup on `build.gradle` of the root.
If you didn't, just install Java 17. That's the default.
Don't forget to add their `bin` directory to `PATH`!
> *Note: You don't have to configure this if you've set up the IDE.*
4. Do `gradlew build`. Note that you can also use `gradlew jar`.
> OS-specific:
> * Windows CMD: `gradlew.bat build`
> * Windows Powershell: `.\gradlew.bat build`
> * Bash: `./gradlew build`
5. Grab plugin in `patcher-loader/build/libs`.
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ plugins {

allprojects {
group 'io.izzel.arclight'
version '1.0.0'
version '1.0.1'

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
//sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8 //for up to 1.16
//sourceCompatibility = targetCompatibility = JavaVersion.VERSION_16 //for 1.17 & 1.17.1
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 //for 1.18+
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions patcher-definition/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {
}

dependencies {
implementation 'io.izzel.arclight:arclight-api:1.1.+'
implementation 'io.izzel.arclight:arclight-api:1.3.+'
implementation 'org.ow2.asm:asm:9.2'
implementation 'org.ow2.asm:asm-tree:9.2'
implementation 'org.ow2.asm:asm-commons:9.2'
Expand All @@ -25,4 +25,4 @@ def getGitHash = { ->

jar {
manifest.attributes 'Implementation-Version': getGitHash()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class DefinitionMain implements PluginPatcher {

static {
SPECIFIC.put("com/sk89q/worldedit/bukkit/BukkitAdapter", WorldEdit::handleBukkitAdapter);
SPECIFIC.put("com/sk89q/worldedit/bukkit/adapter/Refraction", WorldEdit::handlePickName);
GENERAL.add(WorldEdit::handleGetProperties);
GENERAL.add(WorldEdit::handleWatchdog);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ public static void handleBukkitAdapter(ClassNode node, PluginPatcher.ClassRepo r
}
}

public static void handlePickName(ClassNode node, PluginPatcher.ClassRepo repo) {
for (MethodNode method : node.methods) {
if (method.name.equals("pickName")) {
method.instructions.clear();
method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1));
method.instructions.add(new InsnNode(Opcodes.ARETURN));
return;
}
}
}

private static void handleAdapt(ClassNode node, MethodNode standardize, MethodNode method) {
switch (method.desc) {
case "(Lcom/sk89q/worldedit/world/item/ItemType;)Lorg/bukkit/Material;":
Expand Down
10 changes: 7 additions & 3 deletions patcher-loader/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ repositories {
}

dependencies {
implementation 'io.izzel.arclight:arclight-api:1.1.+'
implementation 'io.izzel.arclight:arclight-api:1.2.+'
implementation 'org.ow2.asm:asm:9.2'
implementation 'org.ow2.asm:asm-tree:9.2'
implementation 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
//implementation 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT' //for 1.16.5
//implementation 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' //for 1.17.1
//implementation 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT' //for 1.18.1
//implementation 'org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT' //for 1.18.2
implementation 'org.spigotmc:spigot-api:1.19.1-R0.1-SNAPSHOT' //for 1.19.1
}

jar {
Expand All @@ -32,4 +36,4 @@ processResources {
filesMatching('plugin.yml') {
expand props
}
}
}
2 changes: 1 addition & 1 deletion patcher-loader/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ArclightPatcher
main: io.izzel.arclight.patcher.PluginMain
version: ${version}
api-version: 1.16
api-version: 1.19
arclight:
patcher: io.izzel.arclight.patcher.PatcherMain