3
0
Mirror von https://github.com/Moulberry/AxiomPaperPlugin.git synchronisiert 2024-11-08 09:30:04 +01:00

Port changes to 1.21

Dieser Commit ist enthalten in:
Moulberry 2024-10-11 19:37:10 +08:00
Ursprung 6959cf229e
Commit cdcece8f88
25 geänderte Dateien mit 64 neuen und 42 gelöschten Zeilen

Datei anzeigen

@ -237,12 +237,12 @@ public class PlotSquaredIntegrationImpl {
BlockVector3 minPoint = region.getMinimumPoint(); BlockVector3 minPoint = region.getMinimumPoint();
BlockVector3 maxPoint = region.getMaximumPoint(); BlockVector3 maxPoint = region.getMaximumPoint();
int minPlotX = Math.max(minPoint.x(), minX); int minPlotX = Math.max(minPoint.getBlockX(), minX);
int minPlotY = Math.max(minPoint.y(), minY); int minPlotY = Math.max(minPoint.getBlockY(), minY);
int minPlotZ = Math.max(minPoint.z(), minZ); int minPlotZ = Math.max(minPoint.getBlockZ(), minZ);
int maxPlotX = Math.min(maxPoint.x(), maxX); int maxPlotX = Math.min(maxPoint.getBlockX(), maxX);
int maxPlotY = Math.min(maxPoint.y(), maxY); int maxPlotY = Math.min(maxPoint.getBlockY(), maxY);
int maxPlotZ = Math.min(maxPoint.z(), maxZ); int maxPlotZ = Math.min(maxPoint.getBlockZ(), maxZ);
if (minPlotX > maxPlotX) continue; if (minPlotX > maxPlotX) continue;
if (minPlotY > maxPlotY) continue; if (minPlotY > maxPlotY) continue;

Datei anzeigen

@ -122,12 +122,12 @@ public class WorldGuardIntegrationImpl {
BlockVector3 regionMin = region.getMinimumPoint(); BlockVector3 regionMin = region.getMinimumPoint();
BlockVector3 regionMax = region.getMaximumPoint(); BlockVector3 regionMax = region.getMaximumPoint();
int regionMinX = Math.max(regionMin.x(), cx*16) - minX; int regionMinX = Math.max(regionMin.getBlockX(), cx*16) - minX;
int regionMinY = Math.max(regionMin.y(), cy*16) - minY; int regionMinY = Math.max(regionMin.getBlockY(), cy*16) - minY;
int regionMinZ = Math.max(regionMin.z(), cz*16) - minZ; int regionMinZ = Math.max(regionMin.getBlockZ(), cz*16) - minZ;
int regionMaxX = Math.min(regionMax.x(), cx*16+15) - minX; int regionMaxX = Math.min(regionMax.getBlockX(), cx*16+15) - minX;
int regionMaxY = Math.min(regionMax.y(), cy*16+15) - minY; int regionMaxY = Math.min(regionMax.getBlockY(), cy*16+15) - minY;
int regionMaxZ = Math.min(regionMax.z(), cz*16+15) - minZ; int regionMaxZ = Math.min(regionMax.getBlockZ(), cz*16+15) - minZ;
Box box = new Box(regionMinX, regionMinY, regionMinZ, regionMaxX, regionMaxY, regionMaxZ); Box box = new Box(regionMinX, regionMinY, regionMinZ, regionMaxX, regionMaxY, regionMaxZ);
if (value == StateFlag.State.DENY) { if (value == StateFlag.State.DENY) {

Datei anzeigen

@ -14,6 +14,7 @@ import io.papermc.paper.network.ConnectionEvent;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.minecraft.network.Connection; import net.minecraft.network.Connection;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -65,7 +66,7 @@ public class AxiomBigPayloadHandler extends MessageToMessageDecoder<ByteBuf> {
PacketHandler handler = this.packetHandlers.get(identifier); PacketHandler handler = this.packetHandlers.get(identifier);
if (handler != null) { if (handler != null) {
if (handler.handleAsync()) { if (handler.handleAsync()) {
handler.onReceive(player.getBukkitEntity(), buf); handler.onReceive(player.getBukkitEntity(), new RegistryFriendlyByteBuf(buf, player.registryAccess()));
success = true; success = true;
} else { } else {
byte[] bytes = new byte[buf.writerIndex() - buf.readerIndex()]; byte[] bytes = new byte[buf.writerIndex() - buf.readerIndex()];
@ -73,7 +74,7 @@ public class AxiomBigPayloadHandler extends MessageToMessageDecoder<ByteBuf> {
Player bukkitPlayer = player.getBukkitEntity(); Player bukkitPlayer = player.getBukkitEntity();
player.getServer().execute(() -> { player.getServer().execute(() -> {
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(Unpooled.wrappedBuffer(bytes)); RegistryFriendlyByteBuf friendlyByteBuf = new RegistryFriendlyByteBuf(Unpooled.wrappedBuffer(bytes), player.registryAccess());
try { try {
handler.onReceive(bukkitPlayer, friendlyByteBuf); handler.onReceive(bukkitPlayer, friendlyByteBuf);
} catch (Throwable t) { } catch (Throwable t) {

Datei anzeigen

@ -1,6 +1,7 @@
package com.moulberry.axiom.packet; package com.moulberry.axiom.packet;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -10,6 +11,6 @@ public interface PacketHandler {
return false; return false;
} }
void onReceive(Player player, FriendlyByteBuf friendlyByteBuf); void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf);
} }

Datei anzeigen

@ -3,6 +3,8 @@ package com.moulberry.axiom.packet;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener; import org.bukkit.plugin.messaging.PluginMessageListener;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -17,7 +19,7 @@ public class WrapperPacketListener implements PluginMessageListener {
@Override @Override
public void onPluginMessageReceived(@NotNull String s, @NotNull Player player, @NotNull byte[] bytes) { 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 { try {
this.packetHandler.onReceive(player, friendlyByteBuf); this.packetHandler.onReceive(player, friendlyByteBuf);
} catch (Throwable t) { } catch (Throwable t) {

Datei anzeigen

@ -10,6 +10,7 @@ import io.netty.buffer.Unpooled;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.minecraft.SharedConstants; import net.minecraft.SharedConstants;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Player; 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"); private static final ResourceLocation RESPONSE_PACKET_IDENTIFIER = VersionHelper.createResourceLocation("axiom:response_blueprint");
@Override @Override
public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) {
if (!this.plugin.canUseAxiom(player, "axiom.blueprint.request")) { if (!this.plugin.canUseAxiom(player, "axiom.blueprint.request")) {
return; return;
} }

Datei anzeigen

@ -6,6 +6,7 @@ import com.moulberry.axiom.packet.PacketHandler;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
@ -26,7 +27,7 @@ public class DeleteEntityPacketListener implements PacketHandler {
} }
@Override @Override
public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) {
if (!this.plugin.canUseAxiom(player, "axiom.entity.delete", true)) { if (!this.plugin.canUseAxiom(player, "axiom.entity.delete", true)) {
return; return;
} }

Datei anzeigen

@ -42,7 +42,7 @@ public class HelloPacketListener implements PacketHandler {
} }
@Override @Override
public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) {
if (!this.plugin.hasAxiomPermission(player)) { if (!this.plugin.hasAxiomPermission(player)) {
return; return;
} }

Datei anzeigen

@ -13,6 +13,7 @@ import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
@ -80,7 +81,7 @@ public class ManipulateEntityPacketListener implements PacketHandler {
private static final Rotation[] ROTATION_VALUES = Rotation.values(); private static final Rotation[] ROTATION_VALUES = Rotation.values();
@Override @Override
public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) {
if (!this.plugin.canUseAxiom(player, "axiom.entity.manipulate", true)) { if (!this.plugin.canUseAxiom(player, "axiom.entity.manipulate", true)) {
return; return;
} }

Datei anzeigen

@ -7,6 +7,7 @@ import io.netty.buffer.Unpooled;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.Marker; import net.minecraft.world.entity.Marker;
@ -25,7 +26,7 @@ public class MarkerNbtRequestPacketListener implements PacketHandler {
} }
@Override @Override
public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) {
if (!this.plugin.canUseAxiom(player, "axiom.entity.manipulate", true)) { if (!this.plugin.canUseAxiom(player, "axiom.entity.manipulate", true)) {
return; return;
} }

Datei anzeigen

@ -13,6 +13,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.registries.Registries; import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
@ -45,7 +46,7 @@ public class RequestChunkDataPacketListener implements PacketHandler {
} }
@Override @Override
public void onReceive(Player bukkitPlayer, FriendlyByteBuf friendlyByteBuf) { public void onReceive(Player bukkitPlayer, RegistryFriendlyByteBuf friendlyByteBuf) {
ServerPlayer player = ((CraftPlayer)bukkitPlayer).getHandle(); ServerPlayer player = ((CraftPlayer)bukkitPlayer).getHandle();
long id = friendlyByteBuf.readLong(); long id = friendlyByteBuf.readLong();

Datei anzeigen

@ -7,14 +7,14 @@ import com.moulberry.axiom.packet.PacketHandler;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf; 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.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
import java.util.*; import java.util.*;
@ -30,7 +30,7 @@ public class RequestEntityDataPacketListener implements PacketHandler {
} }
@Override @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(); ServerPlayer player = ((CraftPlayer)bukkitPlayer).getHandle();
long id = friendlyByteBuf.readLong(); long id = friendlyByteBuf.readLong();
@ -102,7 +102,9 @@ public class RequestEntityDataPacketListener implements PacketHandler {
friendlyByteBuf.writeBoolean(finished); friendlyByteBuf.writeBoolean(finished);
friendlyByteBuf.writeMap(map, (buf, uuid) -> buf.writeUUID(uuid), (buf, nbt) -> buf.writeNbt(nbt)); 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);
} }
} }

Datei anzeigen

@ -20,6 +20,7 @@ import net.minecraft.core.Registry;
import net.minecraft.core.SectionPos; import net.minecraft.core.SectionPos;
import net.minecraft.core.registries.Registries; import net.minecraft.core.registries.Registries;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.game.ClientboundChunksBiomesPacket; import net.minecraft.network.protocol.game.ClientboundChunksBiomesPacket;
import net.minecraft.resources.ResourceKey; 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.levelgen.Heightmap;
import net.minecraft.world.level.lighting.LightEngine; import net.minecraft.world.level.lighting.LightEngine;
import org.bukkit.Location; 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 org.bukkit.entity.Player;
import xyz.jpenilla.reflectionremapper.ReflectionRemapper; import xyz.jpenilla.reflectionremapper.ReflectionRemapper;
@ -76,7 +77,7 @@ public class SetBlockBufferPacketListener implements PacketHandler {
return true; return true;
} }
public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) {
ServerPlayer serverPlayer = ((CraftPlayer)player).getHandle(); ServerPlayer serverPlayer = ((CraftPlayer)player).getHandle();
MinecraftServer server = serverPlayer.getServer(); MinecraftServer server = serverPlayer.getServer();
if (server == null) return; if (server == null) return;

Datei anzeigen

@ -12,6 +12,7 @@ import net.minecraft.core.Holder;
import net.minecraft.core.IdMapper; import net.minecraft.core.IdMapper;
import net.minecraft.core.SectionPos; import net.minecraft.core.SectionPos;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
@ -82,7 +83,7 @@ public class SetBlockPacketListener implements PacketHandler {
} }
@Override @Override
public void onReceive(Player bukkitPlayer, FriendlyByteBuf friendlyByteBuf) { public void onReceive(Player bukkitPlayer, RegistryFriendlyByteBuf friendlyByteBuf) {
if (!this.plugin.canUseAxiom(bukkitPlayer, "axiom.build.place")) { if (!this.plugin.canUseAxiom(bukkitPlayer, "axiom.build.place")) {
return; return;
} }

Datei anzeigen

@ -9,6 +9,7 @@ import com.moulberry.axiom.persistence.UUIDDataType;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType; import org.bukkit.persistence.PersistentDataType;
@ -27,7 +28,7 @@ public class SetEditorViewsPacketListener implements PacketHandler {
} }
@Override @Override
public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) {
if (!this.plugin.canUseAxiom(player, "axiom.editor.views")) { if (!this.plugin.canUseAxiom(player, "axiom.editor.views")) {
return; return;
} }

Datei anzeigen

@ -6,6 +6,7 @@ import com.moulberry.axiom.packet.PacketHandler;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -20,7 +21,7 @@ public class SetFlySpeedPacketListener implements PacketHandler {
} }
@Override @Override
public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) {
if (!this.plugin.canUseAxiom(player, "axiom.player.speed")) { if (!this.plugin.canUseAxiom(player, "axiom.player.speed")) {
return; return;
} }

Datei anzeigen

@ -6,6 +6,7 @@ import com.moulberry.axiom.packet.PacketHandler;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.world.level.GameType; import net.minecraft.world.level.GameType;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -22,7 +23,7 @@ public class SetGamemodePacketListener implements PacketHandler {
} }
@Override @Override
public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) {
if (!this.plugin.canUseAxiom(player, "axiom.player.gamemode")) { if (!this.plugin.canUseAxiom(player, "axiom.player.gamemode")) {
return; return;
} }

Datei anzeigen

@ -26,7 +26,7 @@ public class SetHotbarSlotPacketListener implements PacketHandler {
} }
@Override @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())) { if (!this.plugin.canUseAxiom(player, "axiom.player.hotbar") || this.plugin.isMismatchedDataVersion(player.getUniqueId())) {
return; return;
} }

Datei anzeigen

@ -8,6 +8,7 @@ import io.netty.buffer.Unpooled;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.minecraft.core.registries.Registries; import net.minecraft.core.registries.Registries;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.GameRules; import net.minecraft.world.level.GameRules;
@ -26,7 +27,7 @@ public class SetTimePacketListener implements PacketHandler {
} }
@Override @Override
public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) {
if (!this.plugin.canUseAxiom(player, "axiom.world.time")) { if (!this.plugin.canUseAxiom(player, "axiom.world.time")) {
return; return;
} }

Datei anzeigen

@ -8,6 +8,7 @@ import com.moulberry.axiom.world_properties.server.ServerWorldPropertyHolder;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener; import org.bukkit.plugin.messaging.PluginMessageListener;
@ -21,7 +22,7 @@ public class SetWorldPropertyListener implements PacketHandler {
} }
@Override @Override
public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) {
if (!this.plugin.canUseAxiom(player, "axiom.world.property")) { if (!this.plugin.canUseAxiom(player, "axiom.world.property")) {
return; return;
} }

Datei anzeigen

@ -11,6 +11,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
@ -45,7 +46,7 @@ public class SpawnEntityPacketListener implements PacketHandler {
private static final Rotation[] ROTATION_VALUES = Rotation.values(); private static final Rotation[] ROTATION_VALUES = Rotation.values();
@Override @Override
public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) {
if (!this.plugin.canUseAxiom(player, "axiom.entity.spawn", true)) { if (!this.plugin.canUseAxiom(player, "axiom.entity.spawn", true)) {
return; return;
} }

Datei anzeigen

@ -28,7 +28,7 @@ public class SwitchActiveHotbarPacketListener implements PacketHandler {
} }
@Override @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())) { if (!this.plugin.canUseAxiom(player, "axiom.player.hotbar") || this.plugin.isMismatchedDataVersion(player.getUniqueId())) {
return; return;
} }

Datei anzeigen

@ -8,6 +8,7 @@ import io.netty.buffer.Unpooled;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.minecraft.core.registries.Registries; import net.minecraft.core.registries.Registries;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import org.bukkit.*; import org.bukkit.*;
@ -25,7 +26,7 @@ public class TeleportPacketListener implements PacketHandler {
} }
@Override @Override
public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) {
if (!this.plugin.canUseAxiom(player, "axiom.world.teleport")) { if (!this.plugin.canUseAxiom(player, "axiom.world.teleport")) {
return; return;
} }

Datei anzeigen

@ -5,8 +5,9 @@ import com.moulberry.axiom.annotations.AnnotationUpdateAction;
import com.moulberry.axiom.annotations.ServerAnnotations; import com.moulberry.axiom.annotations.ServerAnnotations;
import com.moulberry.axiom.packet.PacketHandler; import com.moulberry.axiom.packet.PacketHandler;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.server.level.ServerPlayer; 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 org.bukkit.entity.Player;
import java.util.ArrayList; import java.util.ArrayList;
@ -19,7 +20,7 @@ public class UpdateAnnotationPacketListener implements PacketHandler {
this.plugin = plugin; 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")) { if (!this.plugin.allowAnnotations || !this.plugin.canUseAxiom(player, "axiom.annotation.create")) {
friendlyByteBuf.writerIndex(friendlyByteBuf.readerIndex()); friendlyByteBuf.writerIndex(friendlyByteBuf.readerIndex());
return; return;

Datei anzeigen

@ -8,9 +8,10 @@ import com.moulberry.axiom.blueprint.ServerBlueprintRegistry;
import com.moulberry.axiom.packet.PacketHandler; import com.moulberry.axiom.packet.PacketHandler;
import net.minecraft.SharedConstants; import net.minecraft.SharedConstants;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer; 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 org.bukkit.entity.Player;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
@ -31,7 +32,7 @@ public class UploadBlueprintPacketListener implements PacketHandler {
return true; return true;
} }
public void onReceive(Player player, FriendlyByteBuf friendlyByteBuf) { public void onReceive(Player player, RegistryFriendlyByteBuf friendlyByteBuf) {
if (!this.plugin.canUseAxiom(player, "axiom.blueprint.upload")) { if (!this.plugin.canUseAxiom(player, "axiom.blueprint.upload")) {
friendlyByteBuf.writerIndex(friendlyByteBuf.readerIndex()); friendlyByteBuf.writerIndex(friendlyByteBuf.readerIndex());
return; return;