Skip to content

Commit

Permalink
Use the UnsafeValues class to transform the AutoDisenchanter at runtime
Browse files Browse the repository at this point in the history
One step closer towards #111. However no man should ever have use ASM, UnsafeValues
AND sun.misc.Unsafe just to provide compatibility with a plugin. Oh whatever,
I like writing transformers either way even if it takes ages to do.
  • Loading branch information
Geolykt committed Aug 11, 2022
1 parent 44827c8 commit 3c55cdf
Show file tree
Hide file tree
Showing 8 changed files with 665 additions and 1 deletion.
34 changes: 33 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jetbrains/annotations -->
Expand Down Expand Up @@ -186,6 +186,20 @@
</exclusions>
</dependency>

<!-- Slimefun, for the slimefun compatibility integration -->
<dependency>
<groupId>com.github.Slimefun</groupId>
<artifactId>Slimefun4</artifactId>
<version>RC-32</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Mobstacker plugins to integrate with -->
<dependency>
<groupId>uk.antiperson.stackmob</groupId>
Expand Down Expand Up @@ -238,6 +252,20 @@
</exclusions>
</dependency>

<!-- Time to go nuclear -->
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-tree</artifactId>
<version>9.3</version>
<scope>compile</scope>
</dependency>

<!-- TODO Anti-cheat APIs for Anti-cheat integrations-->
</dependencies>

Expand Down Expand Up @@ -290,6 +318,10 @@
<pattern>org.bstats</pattern>
<shadedPattern>de.geolykt.enchantments_plus.bstats</shadedPattern>
</relocation>
<relocation>
<pattern>org.objectweb.asm</pattern>
<shadedPattern>de.geolykt.enchantments_plus.compatibility.hackloader.asm</shadedPattern>
</relocation>
</relocations>
</configuration>
</plugin>
Expand Down
1 change: 1 addition & 0 deletions resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ main: de.geolykt.enchantments_plus.Enchantments_plus
api-version: 1.16
version: ${project.version}
softdepend: [Towny, WorldGuard, StackMob, GriefPrevention, ClaimChunk, RoseStacker, LogBlock, CoreProtect, ClaimedCubes]
load-before: [Slimefun]
commands:
ench:
description: Gives basic access; /ench help.
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/de/geolykt/enchantments_plus/Enchantments_plus.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import org.bukkit.plugin.java.JavaPlugin;

import de.geolykt.enchantments_plus.arrows.EnchantedArrow;
import de.geolykt.enchantments_plus.compatibility.hackloader.Hackloader;
import de.geolykt.enchantments_plus.compatibility.hackloader.HackloaderInjectionException;
import de.geolykt.enchantments_plus.compatibility.nativeperm.WGHook;
import de.geolykt.enchantments_plus.enchantments.*;
import de.geolykt.enchantments_plus.evt.AnvilMerge;
Expand Down Expand Up @@ -210,4 +212,12 @@ private void setupAnvilMerger() {
return;
}
}

static {
try {
Hackloader.injectHackloader();
} catch (HackloaderInjectionException e) {
e.printStackTrace();
}
}
}
Loading

0 comments on commit 3c55cdf

Please sign in to comment.