Skip to content

Commit

Permalink
[+] 兼容版本
Browse files Browse the repository at this point in the history
  • Loading branch information
LovesAsuna committed Mar 23, 2020
1 parent 290d2d2 commit 783f53c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ dependencies {
compileOnly 'org.projectlombok:lombok:1.18.12'
compileOnly 'com.github.LovesAsuna:VaultAPI:-SNAPSHOT'
compileOnly 'com.github.LovesAsuna:PluginCore:-SNAPSHOT'
compileOnly files('E:/work/1.15.2test/cache/patched_1.15.2.jar')
annotationProcessor 'org.projectlombok:lombok:1.18.12'
}

Expand Down
8 changes: 7 additions & 1 deletion src/main/java/org/sct/lock/util/function/HoverTextAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.bukkit.Location;
import org.sct.plugincore.util.function.StackTrace;
import org.sct.plugincore.util.reflectutil.Reflections;
import org.sct.plugincore.util.reflectutil.VersionChecker;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
Expand Down Expand Up @@ -54,7 +55,12 @@ public HoverTextAPI() {
ChatComponentText = reflections.getMinecraftClass("ChatComponentText");
EnumHoverAction = getAnyMineCraftEnum();
getHandle = craftWorld.getDeclaredMethod("getHandle");
getTileEntity = worldServer.getDeclaredMethod("getTileEntity", BlockPosition, boolean.class);

if (VersionChecker.Version.getCurrent().isEqualOrHigher(VersionChecker.Version.v1_13_R3)) {
getTileEntity = worldServer.getDeclaredMethod("getTileEntity", BlockPosition, boolean.class);
} else {
getTileEntity = worldServer.getDeclaredMethod("getTileEntity", BlockPosition);
}
getTileEntity.setAccessible(true);
getChatModifier = IChatBaseComponent.getDeclaredMethod("getChatModifier");
getChatModifier.setAccessible(true);
Expand Down

0 comments on commit 783f53c

Please sign in to comment.