3
0
Mirror von https://github.com/Moulberry/AxiomPaperPlugin.git synchronisiert 2024-11-17 05:40:06 +01:00

Bump ViaVersion and clean up imports

Dieser Commit ist enthalten in:
Moulberry 2024-05-04 22:00:28 +08:00
Ursprung b52638f444
Commit 1962e877c6
3 geänderte Dateien mit 5 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -34,7 +34,7 @@ dependencies {
implementation("com.github.luben:zstd-jni:1.5.5-4") implementation("com.github.luben:zstd-jni:1.5.5-4")
// ViaVersion support // ViaVersion support
compileOnly("com.viaversion:viaversion-api:4.9.4-SNAPSHOT") compileOnly("com.viaversion:viaversion-api:4.10.1-SNAPSHOT")
// WorldGuard support // WorldGuard support
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.1.0-SNAPSHOT") compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.1.0-SNAPSHOT")

Datei anzeigen

@ -56,7 +56,7 @@ public class HelloPacketListener implements PluginMessageListener {
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(Unpooled.wrappedBuffer(message)); FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(Unpooled.wrappedBuffer(message));
int apiVersion = friendlyByteBuf.readVarInt(); int apiVersion = friendlyByteBuf.readVarInt();
int dataVersion = friendlyByteBuf.readVarInt(); int dataVersion = friendlyByteBuf.readVarInt();
ViaVersionHelper.skipTagUnknown(friendlyByteBuf, player); // note - skipping NBT here. friendlyByteBuf.readNBT();
int serverDataVersion = SharedConstants.getCurrentVersion().getDataVersion().getVersion(); int serverDataVersion = SharedConstants.getCurrentVersion().getDataVersion().getVersion();
if (dataVersion != serverDataVersion) { if (dataVersion != serverDataVersion) {

Datei anzeigen

@ -1,8 +1,8 @@
package com.moulberry.axiom.viaversion; package com.moulberry.axiom.viaversion;
import com.moulberry.axiom.AxiomPaper;
import com.moulberry.axiom.buffer.BlockBuffer; import com.moulberry.axiom.buffer.BlockBuffer;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.data.BiMappings;
import com.viaversion.viaversion.api.data.MappingData; import com.viaversion.viaversion.api.data.MappingData;
import com.viaversion.viaversion.api.data.Mappings; import com.viaversion.viaversion.api.data.Mappings;
import com.viaversion.viaversion.api.protocol.ProtocolPathEntry; import com.viaversion.viaversion.api.protocol.ProtocolPathEntry;
@ -11,18 +11,12 @@ import com.viaversion.viaversion.api.type.Type;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.minecraft.SharedConstants; import net.minecraft.SharedConstants;
import net.minecraft.core.IdMapper; import net.minecraft.core.IdMapper;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;
import java.util.List; import java.util.List;
@ -104,7 +98,7 @@ public class ViaVersionHelper {
private static final int UNNAMED_COMPOUND_TAG_CHANGE_VERSION = ProtocolVersion.v1_20_2.getVersion(); private static final int UNNAMED_COMPOUND_TAG_CHANGE_VERSION = ProtocolVersion.v1_20_2.getVersion();
public static void skipTagUnknown(FriendlyByteBuf friendlyByteBuf, Player player) { public static void skipTagUnknown(FriendlyByteBuf friendlyByteBuf, Player player) {
if (Bukkit.getPluginManager().isPluginEnabled("ViaVersion")) { if (AxiomPaper.PLUGIN.isMismatchedDataVersion(player.getUniqueId())) {
int playerVersion = Via.getAPI().getPlayerVersion(player.getUniqueId()); int playerVersion = Via.getAPI().getPlayerVersion(player.getUniqueId());
try { try {
ViaVersionHelper.skipTagViaVersion(friendlyByteBuf, playerVersion); ViaVersionHelper.skipTagViaVersion(friendlyByteBuf, playerVersion);
@ -117,7 +111,7 @@ public class ViaVersionHelper {
} }
public static CompoundTag readTagUnknown(FriendlyByteBuf friendlyByteBuf, Player player) { public static CompoundTag readTagUnknown(FriendlyByteBuf friendlyByteBuf, Player player) {
if (Bukkit.getPluginManager().isPluginEnabled("ViaVersion")) { if (AxiomPaper.PLUGIN.isMismatchedDataVersion(player.getUniqueId())) {
int playerVersion = Via.getAPI().getPlayerVersion(player.getUniqueId()); int playerVersion = Via.getAPI().getPlayerVersion(player.getUniqueId());
try { try {
return ViaVersionHelper.readTagViaVersion(friendlyByteBuf, playerVersion); return ViaVersionHelper.readTagViaVersion(friendlyByteBuf, playerVersion);