Compare commits
3 commits
dependabot
...
master
Author | SHA1 | Date | |
---|---|---|---|
14a6c330d2 | |||
aaecbf447d | |||
e142050b7a |
7 changed files with 22 additions and 65 deletions
11
.github/dependabot.yml
vendored
11
.github/dependabot.yml
vendored
|
@ -1,11 +0,0 @@
|
|||
# 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
|
||||
schedule:
|
||||
interval: "daily"
|
26
.github/workflows/maven.yml
vendored
26
.github/workflows/maven.yml
vendored
|
@ -1,26 +0,0 @@
|
|||
name: Java CI
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 21
|
||||
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
|
||||
- run: mkdir -p target
|
||||
|
||||
- uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: MapReflectionAPI
|
||||
path: target
|
16
pom.xml
16
pom.xml
|
@ -24,7 +24,7 @@
|
|||
|
||||
<groupId>tech.sbdevelopment</groupId>
|
||||
<artifactId>MapReflectionAPI</artifactId>
|
||||
<version>1.6.4</version>
|
||||
<version>1.6.6</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>MapReflectionAPI</name>
|
||||
|
@ -48,7 +48,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.13.0</version>
|
||||
<version>3.14.0</version>
|
||||
<configuration>
|
||||
<release>11</release>
|
||||
<annotationProcessorPaths>
|
||||
|
@ -119,7 +119,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.11.1</version>
|
||||
<version>3.11.2</version>
|
||||
<configuration>
|
||||
<release>11</release>
|
||||
<sourcepath>${maven.lombok.delombok-target}</sourcepath>
|
||||
|
@ -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.5-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -190,7 +194,7 @@
|
|||
<dependency>
|
||||
<groupId>com.github.cryptomorin</groupId>
|
||||
<artifactId>XSeries</artifactId>
|
||||
<version>11.3.0</version>
|
||||
<version>13.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Libraries below are provided by CraftBukkit -->
|
||||
|
@ -203,7 +207,7 @@
|
|||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-transport</artifactId>
|
||||
<version>4.1.117.Final</version>
|
||||
<version>4.1.118.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
|
||||
|
|
|
@ -69,8 +69,6 @@ public class MapWrapper extends AbstractMapWrapper {
|
|||
private static final Class<?> entityMetadataPacketClass = getNMSClass("network.protocol.game", "PacketPlayOutEntityMetadata");
|
||||
private static final Class<?> entityItemFrameClass = getNMSClass("world.entity.decoration", "EntityItemFrame");
|
||||
private static final Class<?> dataWatcherItemClass = getNMSClass("network.syncher", "DataWatcher$Item");
|
||||
private static final Class<?> minecraftKeyClass = getNMSClass("resources", "MinecraftKey");
|
||||
private static final Class<?> builtInRegistriesClass = getNMSClass("core.registries", "BuiltInRegistries");
|
||||
|
||||
protected MapController controller = new MapController() {
|
||||
private final Map<UUID, Integer> viewers = new HashMap<>();
|
||||
|
@ -169,8 +167,8 @@ public class MapWrapper extends AbstractMapWrapper {
|
|||
|
||||
String inventoryMenuName;
|
||||
if (supports(21)) {
|
||||
//1.21 = cc
|
||||
inventoryMenuName = "cc";
|
||||
//1.21.5 = bQ, 1.21 - 1.21.4 = cc
|
||||
inventoryMenuName = supports(21, 4) ? "bQ" : "cc";
|
||||
} else if (supports(20)) {
|
||||
//1.20.5 = cb, 1.20.2 - 1.20.4 = bR, 1.20(.1) = bQ
|
||||
inventoryMenuName = supports(20, 4) ? "cb" : supports(20, 2) ? "bR" : "bQ";
|
||||
|
@ -295,7 +293,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, 4) ? "M" : 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 +328,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
|
||||
|
|
|
@ -64,10 +64,8 @@ public class MultiMapWrapper extends AbstractMapWrapper {
|
|||
* Creates a new {@link MultiMapWrapper} from the given image.
|
||||
*
|
||||
* @param imageMatrix The image matrix to wrap
|
||||
* @deprecated Use {@link #MultiMapWrapper(ArrayImage, int, int)} instead, this method is meant for internal use only.
|
||||
*/
|
||||
@Deprecated(since = "1.6", forRemoval = true)
|
||||
public MultiMapWrapper(ArrayImage[][] imageMatrix) {
|
||||
protected MultiMapWrapper(ArrayImage[][] imageMatrix) {
|
||||
wrapperMatrix = new MapWrapper[imageMatrix.length][imageMatrix[0].length];
|
||||
|
||||
for (int row = 0; row < imageMatrix.length; row++) {
|
||||
|
@ -85,10 +83,8 @@ public class MultiMapWrapper extends AbstractMapWrapper {
|
|||
* Creates a new {@link MultiMapWrapper} from the given image.
|
||||
*
|
||||
* @param imageMatrix The image matrix to wrap
|
||||
* @deprecated Use {@link #MultiMapWrapper(BufferedImage, int, int)} instead, this method is meant for internal use only.
|
||||
*/
|
||||
@Deprecated(since = "1.6", forRemoval = true)
|
||||
public MultiMapWrapper(BufferedImage[][] imageMatrix) {
|
||||
protected MultiMapWrapper(BufferedImage[][] imageMatrix) {
|
||||
wrapperMatrix = new MapWrapper[imageMatrix.length][imageMatrix[0].length];
|
||||
|
||||
for (int row = 0; row < imageMatrix.length; row++) {
|
||||
|
|
|
@ -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