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
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: "maven" # See documentation for possible values
|
- package-ecosystem: "maven"
|
||||||
directory: "/" # Location of package manifests
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
|
target-branch: "development"
|
||||||
|
commit-message:
|
||||||
|
prefix: "chore(deps): "
|
14
pom.xml
14
pom.xml
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
<groupId>tech.sbdevelopment</groupId>
|
<groupId>tech.sbdevelopment</groupId>
|
||||||
<artifactId>MapReflectionAPI</artifactId>
|
<artifactId>MapReflectionAPI</artifactId>
|
||||||
<version>1.6.4</version>
|
<version>1.6.5</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>MapReflectionAPI</name>
|
<name>MapReflectionAPI</name>
|
||||||
|
@ -166,13 +166,17 @@
|
||||||
<id>dmulloy2-repo</id>
|
<id>dmulloy2-repo</id>
|
||||||
<url>https://repo.dmulloy2.net/repository/public/</url>
|
<url>https://repo.dmulloy2.net/repository/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>jitpack.io</id>
|
||||||
|
<url>https://jitpack.io</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.21-R0.1-SNAPSHOT</version>
|
<version>1.21.3-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -188,9 +192,9 @@
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.cryptomorin</groupId>
|
<groupId>com.github.stijnb1234</groupId>
|
||||||
<artifactId>XSeries</artifactId>
|
<artifactId>XSeries</artifactId>
|
||||||
<version>11.3.0</version>
|
<version>5a4bf81a2c</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Libraries below are provided by CraftBukkit -->
|
<!-- Libraries below are provided by CraftBukkit -->
|
||||||
|
@ -203,7 +207,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.netty</groupId>
|
<groupId>io.netty</groupId>
|
||||||
<artifactId>netty-transport</artifactId>
|
<artifactId>netty-transport</artifactId>
|
||||||
<version>4.1.114.Final</version>
|
<version>4.1.97.Final</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -86,8 +86,8 @@ public class MapSender {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> packetPlayOutMapClass = getNMSClass("network.protocol.game", "PacketPlayOutMap");
|
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<?> 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<?> mapId = supports(21) ? getNMSClass("world.level.saveddata.maps", "MapId") : null;
|
private static final Class<?> mapIdClazz = supports(21) ? getNMSClass("world.level.saveddata.maps", "MapId") : null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a map to a player
|
* Send a map to a player
|
||||||
|
@ -124,7 +124,7 @@ public class MapSender {
|
||||||
content.array //Data
|
content.array //Data
|
||||||
);
|
);
|
||||||
|
|
||||||
Object mapId = ReflectionUtil.callConstructor(getNMSClass("world.level.saveddata.maps", "MapId"), id);
|
Object mapId = ReflectionUtil.callConstructor(mapIdClazz, id);
|
||||||
|
|
||||||
packet = ReflectionUtil.callConstructor(packetPlayOutMapClass,
|
packet = ReflectionUtil.callConstructor(packetPlayOutMapClass,
|
||||||
mapId, //ID
|
mapId, //ID
|
||||||
|
|
|
@ -295,7 +295,7 @@ public class MapWrapper extends AbstractMapWrapper {
|
||||||
|
|
||||||
//1.20.5 uses new NBT compound system
|
//1.20.5 uses new NBT compound system
|
||||||
if (supports(20, 4)) {
|
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);
|
Object mapId1 = ReflectionUtil.callConstructor(getNMSClass("world.level.saveddata.maps", "MapId"), mapId);
|
||||||
|
|
||||||
// Use generic reflection because of generics
|
// Use generic reflection because of generics
|
||||||
|
@ -330,7 +330,7 @@ public class MapWrapper extends AbstractMapWrapper {
|
||||||
|
|
||||||
String dataWatcherObjectName;
|
String dataWatcherObjectName;
|
||||||
if (supports(21)) { //1.21
|
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)
|
} else if (supports(19, 3)) { //1.19.3 and 1.20(.1)
|
||||||
dataWatcherObjectName = "g";
|
dataWatcherObjectName = "g";
|
||||||
} else if (supports(19)) { //1.19-1.19.2
|
} 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.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import sun.misc.Unsafe;
|
|
||||||
import tech.sbdevelopment.mapreflectionapi.MapReflectionAPI;
|
import tech.sbdevelopment.mapreflectionapi.MapReflectionAPI;
|
||||||
import tech.sbdevelopment.mapreflectionapi.api.events.CreativeInventoryMapUpdateEvent;
|
import tech.sbdevelopment.mapreflectionapi.api.events.CreativeInventoryMapUpdateEvent;
|
||||||
import tech.sbdevelopment.mapreflectionapi.api.events.MapCancelEvent;
|
import tech.sbdevelopment.mapreflectionapi.api.events.MapCancelEvent;
|
||||||
import tech.sbdevelopment.mapreflectionapi.api.events.MapInteractEvent;
|
import tech.sbdevelopment.mapreflectionapi.api.events.MapInteractEvent;
|
||||||
import tech.sbdevelopment.mapreflectionapi.utils.ReflectionUtil;
|
import tech.sbdevelopment.mapreflectionapi.utils.ReflectionUtil;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static com.cryptomorin.xseries.reflection.minecraft.MinecraftConnection.getConnection;
|
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 tech.sbdevelopment.mapreflectionapi.utils.ReflectionUtil.*;
|
||||||
import static com.cryptomorin.xseries.reflection.XReflection.*;
|
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);
|
if (!(vec3d.getClass().isAssignableFrom(vec3DClass))) return new Vector(0, 0, 0);
|
||||||
|
|
||||||
Object vec3dNMS = vec3DClass.cast(vec3d);
|
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 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(19) ? "d" : supports(17) ? "c" : "y"); //1.19 = d, 1.18 = c, 1.16 = y
|
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(19) ? "e" : supports(17) ? "d" : "z"); //1.19 = e, 1.18 = d, 1.16 = z
|
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);
|
return new Vector(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue