Merge bb4ef78a3f
into cc59b911a5
This commit is contained in:
commit
84daf5fd38
5 changed files with 23 additions and 25 deletions
12
.github/dependabot.yml
vendored
12
.github/dependabot.yml
vendored
|
@ -1,11 +1,9 @@
|
|||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "maven" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
- package-ecosystem: "maven"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
target-branch: "development"
|
||||
commit-message:
|
||||
prefix: "chore(deps): "
|
14
pom.xml
14
pom.xml
|
@ -24,7 +24,7 @@
|
|||
|
||||
<groupId>tech.sbdevelopment</groupId>
|
||||
<artifactId>MapReflectionAPI</artifactId>
|
||||
<version>1.6.4</version>
|
||||
<version>1.6.5</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>MapReflectionAPI</name>
|
||||
|
@ -166,13 +166,17 @@
|
|||
<id>dmulloy2-repo</id>
|
||||
<url>https://repo.dmulloy2.net/repository/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.21-R0.1-SNAPSHOT</version>
|
||||
<version>1.21.3-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -188,9 +192,9 @@
|
|||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.cryptomorin</groupId>
|
||||
<groupId>com.github.stijnb1234</groupId>
|
||||
<artifactId>XSeries</artifactId>
|
||||
<version>11.3.0</version>
|
||||
<version>5a4bf81a2c</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Libraries below are provided by CraftBukkit -->
|
||||
|
@ -203,7 +207,7 @@
|
|||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-transport</artifactId>
|
||||
<version>4.1.114.Final</version>
|
||||
<version>4.1.97.Final</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -86,8 +86,8 @@ public class MapSender {
|
|||
}
|
||||
|
||||
private static final Class<?> packetPlayOutMapClass = getNMSClass("network.protocol.game", "PacketPlayOutMap");
|
||||
private static final Class<?> worldMapData = supports(17) ? getNMSClass("world.level.saveddata.maps", "WorldMap$b") : null;
|
||||
private static final Class<?> mapId = supports(21) ? getNMSClass("world.level.saveddata.maps", "MapId") : null;
|
||||
private static final Class<?> worldMapData = supports(17) ? getNMSClass("world.level.saveddata.maps", supports(21, 2) ? "WorldMap$c" : "WorldMap$b") : null; //1.21.2+ uses WorldMap$c, 1.17+ uses WorldMap$b
|
||||
private static final Class<?> mapIdClazz = supports(21) ? getNMSClass("world.level.saveddata.maps", "MapId") : null;
|
||||
|
||||
/**
|
||||
* Send a map to a player
|
||||
|
@ -124,7 +124,7 @@ public class MapSender {
|
|||
content.array //Data
|
||||
);
|
||||
|
||||
Object mapId = ReflectionUtil.callConstructor(getNMSClass("world.level.saveddata.maps", "MapId"), id);
|
||||
Object mapId = ReflectionUtil.callConstructor(mapIdClazz, id);
|
||||
|
||||
packet = ReflectionUtil.callConstructor(packetPlayOutMapClass,
|
||||
mapId, //ID
|
||||
|
|
|
@ -295,7 +295,7 @@ public class MapWrapper extends AbstractMapWrapper {
|
|||
|
||||
//1.20.5 uses new NBT compound system
|
||||
if (supports(20, 4)) {
|
||||
Object mapIdComponent = ReflectionUtil.getDeclaredField(getNMSClass("core.component", "DataComponents"), "B");
|
||||
Object mapIdComponent = ReflectionUtil.getDeclaredField(getNMSClass("core.component", "DataComponents"), supports(21, 2) ? "L" : "B"); //1.21.2+ uses L, otherwise B
|
||||
Object mapId1 = ReflectionUtil.callConstructor(getNMSClass("world.level.saveddata.maps", "MapId"), mapId);
|
||||
|
||||
// Use generic reflection because of generics
|
||||
|
@ -330,7 +330,7 @@ public class MapWrapper extends AbstractMapWrapper {
|
|||
|
||||
String dataWatcherObjectName;
|
||||
if (supports(21)) { //1.21
|
||||
dataWatcherObjectName = "f";
|
||||
dataWatcherObjectName = supports(21, 2) ? "e" : "f"; //1.21.2+ = e, 1.21(.1) = f
|
||||
} else if (supports(19, 3)) { //1.19.3 and 1.20(.1)
|
||||
dataWatcherObjectName = "g";
|
||||
} else if (supports(19)) { //1.19-1.19.2
|
||||
|
|
|
@ -30,19 +30,15 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
import sun.misc.Unsafe;
|
||||
import tech.sbdevelopment.mapreflectionapi.MapReflectionAPI;
|
||||
import tech.sbdevelopment.mapreflectionapi.api.events.CreativeInventoryMapUpdateEvent;
|
||||
import tech.sbdevelopment.mapreflectionapi.api.events.MapCancelEvent;
|
||||
import tech.sbdevelopment.mapreflectionapi.api.events.MapInteractEvent;
|
||||
import tech.sbdevelopment.mapreflectionapi.utils.ReflectionUtil;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.cryptomorin.xseries.reflection.minecraft.MinecraftConnection.getConnection;
|
||||
import static com.cryptomorin.xseries.reflection.minecraft.MinecraftConnection.getHandle;
|
||||
import static tech.sbdevelopment.mapreflectionapi.utils.ReflectionUtil.*;
|
||||
import static com.cryptomorin.xseries.reflection.XReflection.*;
|
||||
|
||||
|
@ -207,9 +203,9 @@ public class PacketListener implements Listener {
|
|||
if (!(vec3d.getClass().isAssignableFrom(vec3DClass))) return new Vector(0, 0, 0);
|
||||
|
||||
Object vec3dNMS = vec3DClass.cast(vec3d);
|
||||
double x = (double) getDeclaredField(vec3dNMS, supports(19) ? "c" : supports(17) ? "b" : "x"); //1.19 = c, 1.18 = b, 1.16 = x
|
||||
double y = (double) getDeclaredField(vec3dNMS, supports(19) ? "d" : supports(17) ? "c" : "y"); //1.19 = d, 1.18 = c, 1.16 = y
|
||||
double z = (double) getDeclaredField(vec3dNMS, supports(19) ? "e" : supports(17) ? "d" : "z"); //1.19 = e, 1.18 = d, 1.16 = z
|
||||
double x = (double) getDeclaredField(vec3dNMS, supports(21, 2) ? "d" : supports(19) ? "c" : supports(17) ? "b" : "x"); //1.21.2+ = d, 1.19 = c, 1.18 = b, 1.16 = x
|
||||
double y = (double) getDeclaredField(vec3dNMS, supports(21, 2) ? "e" : supports(19) ? "d" : supports(17) ? "c" : "y"); //1.21.2+ = e, 1.19 = d, 1.18 = c, 1.16 = y
|
||||
double z = (double) getDeclaredField(vec3dNMS, supports(21, 2) ? "f" : supports(19) ? "e" : supports(17) ? "d" : "z"); //1.21.2+ = f, 1.19 = e, 1.18 = d, 1.16 = z
|
||||
|
||||
return new Vector(x, y, z);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue