mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-23 02:55:45 +01:00
Try not hooking into viaversion for protocol version
This commit is contained in:
parent
1e50f47f92
commit
12f507f89c
@ -23,7 +23,6 @@ import com.comphenix.protocol.wrappers.WrappedSignedProperty;
|
|||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import com.viaversion.viaversion.api.Via;
|
|
||||||
|
|
||||||
import net.citizensnpcs.api.CitizensAPI;
|
import net.citizensnpcs.api.CitizensAPI;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
@ -45,16 +44,10 @@ public class ProtocolLibListener {
|
|||||||
flagsClass = MinecraftReflection.getMinecraftClass("EnumPlayerTeleportFlags",
|
flagsClass = MinecraftReflection.getMinecraftClass("EnumPlayerTeleportFlags",
|
||||||
"PacketPlayOutPosition$EnumPlayerTeleportFlags",
|
"PacketPlayOutPosition$EnumPlayerTeleportFlags",
|
||||||
"network.protocol.game.PacketPlayOutPosition$EnumPlayerTeleportFlags");
|
"network.protocol.game.PacketPlayOutPosition$EnumPlayerTeleportFlags");
|
||||||
try {
|
|
||||||
Via.getAPI();
|
|
||||||
} catch (Throwable t) {
|
|
||||||
VIA_ENABLED = false;
|
|
||||||
}
|
|
||||||
manager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.HIGHEST, Server.PLAYER_INFO) {
|
manager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.HIGHEST, Server.PLAYER_INFO) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent event) {
|
public void onPacketSending(PacketEvent event) {
|
||||||
int version = VIA_ENABLED ? Via.getAPI().getPlayerVersion(event.getPlayer())
|
int version = manager.getProtocolVersion(event.getPlayer());
|
||||||
: manager.getProtocolVersion(event.getPlayer());
|
|
||||||
if (version >= 761) {
|
if (version >= 761) {
|
||||||
NMS.onPlayerInfoAdd(event.getPlayer(), event.getPacket().getHandle());
|
NMS.onPlayerInfoAdd(event.getPlayer(), event.getPacket().getHandle());
|
||||||
return;
|
return;
|
||||||
@ -172,5 +165,4 @@ public class ProtocolLibListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean LOGGED_ERROR = false;
|
private static boolean LOGGED_ERROR = false;
|
||||||
private static boolean VIA_ENABLED = true;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user