From cdcece8f883b9a55fdf0ec8707730c1d2ac00795 Mon Sep 17 00:00:00 2001 From: Moulberry Date: Fri, 11 Oct 2024 19:37:10 +0800 Subject: [PATCH] Port changes to 1.21 --- .../plotsquared/PlotSquaredIntegrationImpl.java | 12 ++++++------ .../worldguard/WorldGuardIntegrationImpl.java | 12 ++++++------ .../axiom/packet/AxiomBigPayloadHandler.java | 5 +++-- .../com/moulberry/axiom/packet/PacketHandler.java | 3 ++- .../axiom/packet/WrapperPacketListener.java | 4 +++- .../packet/impl/BlueprintRequestPacketListener.java | 3 ++- .../packet/impl/DeleteEntityPacketListener.java | 3 ++- .../axiom/packet/impl/HelloPacketListener.java | 2 +- .../packet/impl/ManipulateEntityPacketListener.java | 3 ++- .../packet/impl/MarkerNbtRequestPacketListener.java | 3 ++- .../packet/impl/RequestChunkDataPacketListener.java | 3 ++- .../packet/impl/RequestEntityDataPacketListener.java | 10 ++++++---- .../packet/impl/SetBlockBufferPacketListener.java | 5 +++-- .../axiom/packet/impl/SetBlockPacketListener.java | 3 ++- .../packet/impl/SetEditorViewsPacketListener.java | 3 ++- .../axiom/packet/impl/SetFlySpeedPacketListener.java | 3 ++- .../axiom/packet/impl/SetGamemodePacketListener.java | 3 ++- .../packet/impl/SetHotbarSlotPacketListener.java | 2 +- .../axiom/packet/impl/SetTimePacketListener.java | 3 ++- .../axiom/packet/impl/SetWorldPropertyListener.java | 3 ++- .../axiom/packet/impl/SpawnEntityPacketListener.java | 3 ++- .../impl/SwitchActiveHotbarPacketListener.java | 2 +- .../axiom/packet/impl/TeleportPacketListener.java | 3 ++- .../packet/impl/UpdateAnnotationPacketListener.java | 5 +++-- .../packet/impl/UploadBlueprintPacketListener.java | 5 +++-- 25 files changed, 64 insertions(+), 42 deletions(-) diff --git a/src/main/java/com/moulberry/axiom/integration/plotsquared/PlotSquaredIntegrationImpl.java b/src/main/java/com/moulberry/axiom/integration/plotsquared/PlotSquaredIntegrationImpl.java index b6b71d7..66cfa0b 100644 --- a/src/main/java/com/moulberry/axiom/integration/plotsquared/PlotSquaredIntegrationImpl.java +++ b/src/main/java/com/moulberry/axiom/integration/plotsquared/PlotSquaredIntegrationImpl.java @@ -237,12 +237,12 @@ public class PlotSquaredIntegrationImpl { BlockVector3 minPoint = region.getMinimumPoint(); BlockVector3 maxPoint = region.getMaximumPoint(); - int minPlotX = Math.max(minPoint.x(), minX); - int minPlotY = Math.max(minPoint.y(), minY); - int minPlotZ = Math.max(minPoint.z(), minZ); - int maxPlotX = Math.min(maxPoint.x(), maxX); - int maxPlotY = Math.min(maxPoint.y(), maxY); - int maxPlotZ = Math.min(maxPoint.z(), maxZ); + int minPlotX = Math.max(minPoint.getBlockX(), minX); + int minPlotY = Math.max(minPoint.getBlockY(), minY); + int minPlotZ = Math.max(minPoint.getBlockZ(), minZ); + int maxPlotX = Math.min(maxPoint.getBlockX(), maxX); + int maxPlotY = Math.min(maxPoint.getBlockY(), maxY); + int maxPlotZ = Math.min(maxPoint.getBlockZ(), maxZ); if (minPlotX > maxPlotX) continue; if (minPlotY > maxPlotY) continue; diff --git a/src/main/java/com/moulberry/axiom/integration/worldguard/WorldGuardIntegrationImpl.java b/src/main/java/com/moulberry/axiom/integration/worldguard/WorldGuardIntegrationImpl.java index 1eb3d07..297ccc2 100644 --- a/src/main/java/com/moulberry/axiom/integration/worldguard/WorldGuardIntegrationImpl.java +++ b/src/main/java/com/moulberry/axiom/integration/worldguard/WorldGuardIntegrationImpl.java @@ -122,12 +122,12 @@ public class WorldGuardIntegrationImpl { BlockVector3 regionMin = region.getMinimumPoint(); BlockVector3 regionMax = region.getMaximumPoint(); - int regionMinX = Math.max(regionMin.x(), cx*16) - minX; - int regionMinY = Math.max(regionMin.y(), cy*16) - minY; - int regionMinZ = Math.max(regionMin.z(), cz*16) - minZ; - int regionMaxX = Math.min(regionMax.x(), cx*16+15) - minX; - int regionMaxY = Math.min(regionMax.y(), cy*16+15) - minY; - int regionMaxZ = Math.min(regionMax.z(), cz*16+15) - minZ; + int regionMinX = Math.max(regionMin.getBlockX(), cx*16) - minX; + int regionMinY = Math.max(regionMin.getBlockY(), cy*16) - minY; + int regionMinZ = Math.max(regionMin.getBlockZ(), cz*16) - minZ; + int regionMaxX = Math.min(regionMax.getBlockX(), cx*16+15) - minX; + int regionMaxY = Math.min(regionMax.getBlockY(), cy*16+15) - minY; + int regionMaxZ = Math.min(regionMax.getBlockZ(), cz*16+15) - minZ; Box box = new Box(regionMinX, regionMinY, regionMinZ, regionMaxX, regionMaxY, regionMaxZ); if (value == StateFlag.State.DENY) { diff --git a/src/main/java/com/moulberry/axiom/packet/AxiomBigPayloadHandler.java b/src/main/java/com/moulberry/axiom/packet/AxiomBigPayloadHandler.java index bedf17b..22b841b 100644 --- a/src/main/java/com/moulberry/axiom/packet/AxiomBigPayloadHandler.java +++ b/src/main/java/com/moulberry/axiom/packet/AxiomBigPayloadHandler.java @@ -14,6 +14,7 @@ import io.papermc.paper.network.ConnectionEvent; import net.kyori.adventure.text.Component; import net.minecraft.network.Connection; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import org.bukkit.entity.Player; @@ -65,7 +66,7 @@ public class AxiomBigPayloadHandler extends MessageToMessageDecoder { PacketHandler handler = this.packetHandlers.get(identifier); if (handler != null) { if (handler.handleAsync()) { - handler.onReceive(player.getBukkitEntity(), buf); + handler.onReceive(player.getBukkitEntity(), new RegistryFriendlyByteBuf(buf, player.registryAccess())); success = true; } else { byte[] bytes = new byte[buf.writerIndex() - buf.readerIndex()]; @@ -73,7 +74,7 @@ public class AxiomBigPayloadHandler extends MessageToMessageDecoder { Player bukkitPlayer = player.getBukkitEntity(); player.getServer().execute(() -> { - FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(Unpooled.wrappedBuffer(bytes)); + RegistryFriendlyByteBuf friendlyByteBuf = new RegistryFriendlyByteBuf(Unpooled.wrappedBuffer(bytes), player.registryAccess()); try { handler.onReceive(bukkitPlayer, friendlyByteBuf); } catch (Throwable t) { diff --git a/src/main/java/com/moulberry/axiom/packet/PacketHandler.java b/src/main/java/com/moulberry/axiom/packet/PacketHandler.java index 9fe0bb6..e6510f6 100644 --- a/src/main/java/com/moulberry/axiom/packet/PacketHandler.java +++ b/src/main/java/com/moulberry/axiom/packet/PacketHandler.java @@ -1,6 +1,7 @@ package com.moulberry.axiom.packet; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; import org.bukkit.entity.Player; @@ -10,6 +11,6 @@ public interface PacketHandler { return false; } - void onReceive(Player player, FriendlyByteBuf friendlyByteBuf); + void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf); } diff --git a/src/main/java/com/moulberry/axiom/packet/WrapperPacketListener.java b/src/main/java/com/moulberry/axiom/packet/WrapperPacketListener.java index 9868826..da7dcb3 100644 --- a/src/main/java/com/moulberry/axiom/packet/WrapperPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/WrapperPacketListener.java @@ -3,6 +3,8 @@ package com.moulberry.axiom.packet; import io.netty.buffer.Unpooled; import net.kyori.adventure.text.Component; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; +import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.plugin.messaging.PluginMessageListener; import org.jetbrains.annotations.NotNull; @@ -17,7 +19,7 @@ public class WrapperPacketListener implements PluginMessageListener { @Override public void onPluginMessageReceived(@NotNull String s, @NotNull Player player, @NotNull byte[] bytes) { - FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(Unpooled.wrappedBuffer(bytes)); + RegistryFriendlyByteBuf friendlyByteBuf = new RegistryFriendlyByteBuf(Unpooled.wrappedBuffer(bytes), ((CraftPlayer)player).getHandle().registryAccess()); try { this.packetHandler.onReceive(player, friendlyByteBuf); } catch (Throwable t) { diff --git a/src/main/java/com/moulberry/axiom/packet/impl/BlueprintRequestPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/BlueprintRequestPacketListener.java index 1690edc..2345152 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/BlueprintRequestPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/BlueprintRequestPacketListener.java @@ -10,6 +10,7 @@ import io.netty.buffer.Unpooled; import net.kyori.adventure.text.Component; import net.minecraft.SharedConstants; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.entity.Player; @@ -26,7 +27,7 @@ public class BlueprintRequestPacketListener implements PacketHandler { private static final ResourceLocation RESPONSE_PACKET_IDENTIFIER = VersionHelper.createResourceLocation("axiom:response_blueprint"); @Override - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.canUseAxiom(player, "axiom.blueprint.request")) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/impl/DeleteEntityPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/DeleteEntityPacketListener.java index 9d2b59e..0231d5f 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/DeleteEntityPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/DeleteEntityPacketListener.java @@ -6,6 +6,7 @@ import com.moulberry.axiom.packet.PacketHandler; import io.netty.buffer.Unpooled; import net.kyori.adventure.text.Component; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -26,7 +27,7 @@ public class DeleteEntityPacketListener implements PacketHandler { } @Override - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.canUseAxiom(player, "axiom.entity.delete", true)) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/impl/HelloPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/HelloPacketListener.java index 8a9a6da..1c541c8 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/HelloPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/HelloPacketListener.java @@ -42,7 +42,7 @@ public class HelloPacketListener implements PacketHandler { } @Override - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.hasAxiomPermission(player)) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/impl/ManipulateEntityPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/ManipulateEntityPacketListener.java index 2446120..1fc650a 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/ManipulateEntityPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/ManipulateEntityPacketListener.java @@ -13,6 +13,7 @@ import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -80,7 +81,7 @@ public class ManipulateEntityPacketListener implements PacketHandler { private static final Rotation[] ROTATION_VALUES = Rotation.values(); @Override - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.canUseAxiom(player, "axiom.entity.manipulate", true)) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/impl/MarkerNbtRequestPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/MarkerNbtRequestPacketListener.java index 4b1fec3..5716c5a 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/MarkerNbtRequestPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/MarkerNbtRequestPacketListener.java @@ -7,6 +7,7 @@ import io.netty.buffer.Unpooled; import net.kyori.adventure.text.Component; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Marker; @@ -25,7 +26,7 @@ public class MarkerNbtRequestPacketListener implements PacketHandler { } @Override - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.canUseAxiom(player, "axiom.entity.manipulate", true)) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/impl/RequestChunkDataPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/RequestChunkDataPacketListener.java index cebff9b..aadc182 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/RequestChunkDataPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/RequestChunkDataPacketListener.java @@ -13,6 +13,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -45,7 +46,7 @@ public class RequestChunkDataPacketListener implements PacketHandler { } @Override - public void onReceive(Player bukkitPlayer, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player bukkitPlayer, RegistryFriendlyByteBuf friendlyByteBuf) { ServerPlayer player = ((CraftPlayer)bukkitPlayer).getHandle(); long id = friendlyByteBuf.readLong(); diff --git a/src/main/java/com/moulberry/axiom/packet/impl/RequestEntityDataPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/RequestEntityDataPacketListener.java index 989a425..1600cd9 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/RequestEntityDataPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/RequestEntityDataPacketListener.java @@ -7,14 +7,14 @@ import com.moulberry.axiom.packet.PacketHandler; import io.netty.buffer.Unpooled; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.entity.CraftPlayer; import java.util.*; @@ -30,7 +30,7 @@ public class RequestEntityDataPacketListener implements PacketHandler { } @Override - public void onReceive(org.bukkit.entity.Player bukkitPlayer, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(org.bukkit.entity.Player bukkitPlayer, RegistryFriendlyByteBuf friendlyByteBuf) { ServerPlayer player = ((CraftPlayer)bukkitPlayer).getHandle(); long id = friendlyByteBuf.readLong(); @@ -102,7 +102,9 @@ public class RequestEntityDataPacketListener implements PacketHandler { friendlyByteBuf.writeBoolean(finished); friendlyByteBuf.writeMap(map, (buf, uuid) -> buf.writeUUID(uuid), (buf, nbt) -> buf.writeNbt(nbt)); - player.connection.send(new ClientboundCustomPayloadPacket(RESPONSE_ID, friendlyByteBuf)); + byte[] bytes = new byte[friendlyByteBuf.writerIndex()]; + friendlyByteBuf.getBytes(0, bytes); + VersionHelper.sendCustomPayload(player, RESPONSE_ID, bytes); } } diff --git a/src/main/java/com/moulberry/axiom/packet/impl/SetBlockBufferPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/SetBlockBufferPacketListener.java index a26a43b..f668942 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/SetBlockBufferPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/SetBlockBufferPacketListener.java @@ -20,6 +20,7 @@ import net.minecraft.core.Registry; import net.minecraft.core.SectionPos; import net.minecraft.core.registries.Registries; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ClientboundChunksBiomesPacket; import net.minecraft.resources.ResourceKey; @@ -42,7 +43,7 @@ import net.minecraft.world.level.chunk.PalettedContainer; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.lighting.LightEngine; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.entity.Player; import xyz.jpenilla.reflectionremapper.ReflectionRemapper; @@ -76,7 +77,7 @@ public class SetBlockBufferPacketListener implements PacketHandler { return true; } - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { ServerPlayer serverPlayer = ((CraftPlayer)player).getHandle(); MinecraftServer server = serverPlayer.getServer(); if (server == null) return; diff --git a/src/main/java/com/moulberry/axiom/packet/impl/SetBlockPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/SetBlockPacketListener.java index 6adcc88..972b7e3 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/SetBlockPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/SetBlockPacketListener.java @@ -12,6 +12,7 @@ import net.minecraft.core.Holder; import net.minecraft.core.IdMapper; import net.minecraft.core.SectionPos; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; @@ -82,7 +83,7 @@ public class SetBlockPacketListener implements PacketHandler { } @Override - public void onReceive(Player bukkitPlayer, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player bukkitPlayer, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.canUseAxiom(bukkitPlayer, "axiom.build.place")) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/impl/SetEditorViewsPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/SetEditorViewsPacketListener.java index 01e1a56..ea472b1 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/SetEditorViewsPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/SetEditorViewsPacketListener.java @@ -9,6 +9,7 @@ import com.moulberry.axiom.persistence.UUIDDataType; import io.netty.buffer.Unpooled; import net.kyori.adventure.text.Component; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import org.bukkit.entity.Player; import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataType; @@ -27,7 +28,7 @@ public class SetEditorViewsPacketListener implements PacketHandler { } @Override - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.canUseAxiom(player, "axiom.editor.views")) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/impl/SetFlySpeedPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/SetFlySpeedPacketListener.java index 5d8683c..b161d9f 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/SetFlySpeedPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/SetFlySpeedPacketListener.java @@ -6,6 +6,7 @@ import com.moulberry.axiom.packet.PacketHandler; import io.netty.buffer.Unpooled; import net.kyori.adventure.text.Component; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.entity.Player; @@ -20,7 +21,7 @@ public class SetFlySpeedPacketListener implements PacketHandler { } @Override - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.canUseAxiom(player, "axiom.player.speed")) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/impl/SetGamemodePacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/SetGamemodePacketListener.java index 85025a8..632c140 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/SetGamemodePacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/SetGamemodePacketListener.java @@ -6,6 +6,7 @@ import com.moulberry.axiom.packet.PacketHandler; import io.netty.buffer.Unpooled; import net.kyori.adventure.text.Component; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.world.level.GameType; import org.bukkit.Bukkit; import org.bukkit.GameMode; @@ -22,7 +23,7 @@ public class SetGamemodePacketListener implements PacketHandler { } @Override - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.canUseAxiom(player, "axiom.player.gamemode")) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/impl/SetHotbarSlotPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/SetHotbarSlotPacketListener.java index 9a20d5c..510d277 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/SetHotbarSlotPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/SetHotbarSlotPacketListener.java @@ -26,7 +26,7 @@ public class SetHotbarSlotPacketListener implements PacketHandler { } @Override - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.canUseAxiom(player, "axiom.player.hotbar") || this.plugin.isMismatchedDataVersion(player.getUniqueId())) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/impl/SetTimePacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/SetTimePacketListener.java index fbc9eb4..5886922 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/SetTimePacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/SetTimePacketListener.java @@ -8,6 +8,7 @@ import io.netty.buffer.Unpooled; import net.kyori.adventure.text.Component; import net.minecraft.core.registries.Registries; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.GameRules; @@ -26,7 +27,7 @@ public class SetTimePacketListener implements PacketHandler { } @Override - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.canUseAxiom(player, "axiom.world.time")) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/impl/SetWorldPropertyListener.java b/src/main/java/com/moulberry/axiom/packet/impl/SetWorldPropertyListener.java index 6352ac6..c6f3cdd 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/SetWorldPropertyListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/SetWorldPropertyListener.java @@ -8,6 +8,7 @@ import com.moulberry.axiom.world_properties.server.ServerWorldPropertyHolder; import io.netty.buffer.Unpooled; import net.kyori.adventure.text.Component; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import org.bukkit.entity.Player; import org.bukkit.plugin.messaging.PluginMessageListener; @@ -21,7 +22,7 @@ public class SetWorldPropertyListener implements PacketHandler { } @Override - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.canUseAxiom(player, "axiom.world.property")) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/impl/SpawnEntityPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/SpawnEntityPacketListener.java index f00f578..38bd3f2 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/SpawnEntityPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/SpawnEntityPacketListener.java @@ -11,6 +11,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -45,7 +46,7 @@ public class SpawnEntityPacketListener implements PacketHandler { private static final Rotation[] ROTATION_VALUES = Rotation.values(); @Override - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.canUseAxiom(player, "axiom.entity.spawn", true)) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/impl/SwitchActiveHotbarPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/SwitchActiveHotbarPacketListener.java index b84e549..1b5978e 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/SwitchActiveHotbarPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/SwitchActiveHotbarPacketListener.java @@ -28,7 +28,7 @@ public class SwitchActiveHotbarPacketListener implements PacketHandler { } @Override - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.canUseAxiom(player, "axiom.player.hotbar") || this.plugin.isMismatchedDataVersion(player.getUniqueId())) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/impl/TeleportPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/TeleportPacketListener.java index 859b752..872c6da 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/TeleportPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/TeleportPacketListener.java @@ -8,6 +8,7 @@ import io.netty.buffer.Unpooled; import net.kyori.adventure.text.Component; import net.minecraft.core.registries.Registries; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.Level; import org.bukkit.*; @@ -25,7 +26,7 @@ public class TeleportPacketListener implements PacketHandler { } @Override - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.canUseAxiom(player, "axiom.world.teleport")) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/impl/UpdateAnnotationPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/UpdateAnnotationPacketListener.java index 3c12f56..94b25ea 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/UpdateAnnotationPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/UpdateAnnotationPacketListener.java @@ -5,8 +5,9 @@ import com.moulberry.axiom.annotations.AnnotationUpdateAction; import com.moulberry.axiom.annotations.ServerAnnotations; import com.moulberry.axiom.packet.PacketHandler; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; -import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.entity.Player; import java.util.ArrayList; @@ -19,7 +20,7 @@ public class UpdateAnnotationPacketListener implements PacketHandler { this.plugin = plugin; } - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.allowAnnotations || !this.plugin.canUseAxiom(player, "axiom.annotation.create")) { friendlyByteBuf.writerIndex(friendlyByteBuf.readerIndex()); return; diff --git a/src/main/java/com/moulberry/axiom/packet/impl/UploadBlueprintPacketListener.java b/src/main/java/com/moulberry/axiom/packet/impl/UploadBlueprintPacketListener.java index e667ab2..6d714c3 100644 --- a/src/main/java/com/moulberry/axiom/packet/impl/UploadBlueprintPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/impl/UploadBlueprintPacketListener.java @@ -8,9 +8,10 @@ import com.moulberry.axiom.blueprint.ServerBlueprintRegistry; import com.moulberry.axiom.packet.PacketHandler; import net.minecraft.SharedConstants; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; -import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.entity.Player; import java.io.BufferedOutputStream; @@ -31,7 +32,7 @@ public class UploadBlueprintPacketListener implements PacketHandler { return true; } - public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { + public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) { if (!this.plugin.canUseAxiom(player, "axiom.blueprint.upload")) { friendlyByteBuf.writerIndex(friendlyByteBuf.readerIndex()); return;