mirror of
https://github.com/NEZNAMY/TAB.git
synced 2026-11-26 10:29:49 -05:00
another fix
This commit is contained in:
1 parent
87a49d9881
commit
072e822b21
3 files changed
+25
-16
No files matched your search
@@ -26,6 +26,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.*;
|
||||
import net.md_5.bungee.api.plugin.*;
|
||||
import net.md_5.bungee.event.*;
|
||||
import net.md_5.bungee.protocol.DefinedPacket;
|
||||
import net.md_5.bungee.protocol.packet.*;
|
||||
|
||||
public class Main extends Plugin implements Listener, MainClass{
|
||||
@@ -129,15 +130,17 @@ public class Main extends Plugin implements Listener, MainClass{
|
||||
super.write(context, packet, channelPromise);
|
||||
return;
|
||||
}
|
||||
UniversalPacketPlayOut customPacket = null;
|
||||
customPacket = PacketPlayOutPlayerInfo.fromBungee(packet);
|
||||
if (customPacket != null) {
|
||||
for (CustomPacketFeature f : Shared.packetfeatures.values()) {
|
||||
long time = System.nanoTime();
|
||||
if (customPacket != null) customPacket = f.onPacketSend(player, customPacket);
|
||||
Shared.cpu.addFeatureTime(f.getCPUName(), System.nanoTime()-time);
|
||||
if (packet instanceof DefinedPacket) {
|
||||
UniversalPacketPlayOut customPacket = null;
|
||||
customPacket = PacketPlayOutPlayerInfo.fromBungee(packet);
|
||||
if (customPacket != null) {
|
||||
for (CustomPacketFeature f : Shared.packetfeatures.values()) {
|
||||
long time = System.nanoTime();
|
||||
if (customPacket != null) customPacket = f.onPacketSend(player, customPacket);
|
||||
Shared.cpu.addFeatureTime(f.getCPUName(), System.nanoTime()-time);
|
||||
}
|
||||
packet = customPacket.toBungee(player.getVersion());
|
||||
}
|
||||
packet = customPacket.toBungee(player.getVersion());
|
||||
}
|
||||
if (packet instanceof Team && Shared.features.containsKey("nametag16")) {
|
||||
Team team = (Team) packet;
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.plugin.Plugin;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
||||
import com.velocitypowered.proxy.protocol.StateRegistry;
|
||||
import com.velocitypowered.proxy.protocol.StateRegistry.PacketMapping;
|
||||
import com.velocitypowered.proxy.protocol.StateRegistry.PacketRegistry;
|
||||
@@ -148,15 +149,17 @@ public class Main implements MainClass{
|
||||
super.write(context, packet, channelPromise);
|
||||
return;
|
||||
}
|
||||
UniversalPacketPlayOut customPacket = null;
|
||||
customPacket = PacketPlayOutPlayerInfo.fromVelocity(packet);
|
||||
if (customPacket != null) {
|
||||
for (CustomPacketFeature f : Shared.packetfeatures.values()) {
|
||||
long time = System.nanoTime();
|
||||
if (customPacket != null) customPacket = f.onPacketSend(player, customPacket);
|
||||
Shared.cpu.addFeatureTime(f.getCPUName(), System.nanoTime()-time);
|
||||
if (packet instanceof MinecraftPacket) {
|
||||
UniversalPacketPlayOut customPacket = null;
|
||||
customPacket = PacketPlayOutPlayerInfo.fromVelocity(packet);
|
||||
if (customPacket != null) {
|
||||
for (CustomPacketFeature f : Shared.packetfeatures.values()) {
|
||||
long time = System.nanoTime();
|
||||
if (customPacket != null) customPacket = f.onPacketSend(player, customPacket);
|
||||
Shared.cpu.addFeatureTime(f.getCPUName(), System.nanoTime()-time);
|
||||
}
|
||||
packet = customPacket.toVelocity(player.getVersion());
|
||||
}
|
||||
packet = customPacket.toVelocity(player.getVersion());
|
||||
}
|
||||
if (packet instanceof Team && Shared.features.containsKey("nametag16")) {
|
||||
if (killPacket((Team)packet)) return;
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.json.simple.parser.ParseException;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
||||
|
||||
import me.neznamy.tab.platforms.bukkit.packets.method.MethodAPI;
|
||||
import me.neznamy.tab.shared.ProtocolVersion;
|
||||
@@ -217,6 +218,7 @@ public class PacketPlayOutPlayerInfo extends UniversalPacketPlayOut{
|
||||
return new PacketPlayOutPlayerInfo(action, listData);
|
||||
}
|
||||
public static PacketPlayOutPlayerInfo fromBungee(Object bungeePacket){
|
||||
if (!(bungeePacket instanceof PlayerListItem)) return null;
|
||||
PlayerListItem item = (PlayerListItem) bungeePacket;
|
||||
EnumPlayerInfoAction action = EnumPlayerInfoAction.fromBungee(item.getAction().toString());
|
||||
List<PlayerInfoData> listData = new ArrayList<PlayerInfoData>();
|
||||
@@ -226,6 +228,7 @@ public class PacketPlayOutPlayerInfo extends UniversalPacketPlayOut{
|
||||
return new PacketPlayOutPlayerInfo(action, listData);
|
||||
}
|
||||
public static PacketPlayOutPlayerInfo fromVelocity(Object velocityPacket){
|
||||
if (!(velocityPacket instanceof MinecraftPacket)) return null;
|
||||
com.velocitypowered.proxy.protocol.packet.PlayerListItem item = (com.velocitypowered.proxy.protocol.packet.PlayerListItem) velocityPacket;
|
||||
EnumPlayerInfoAction action = EnumPlayerInfoAction.fromId(item.getAction());
|
||||
List<PlayerInfoData> listData = new ArrayList<PlayerInfoData>();
|
||||
|
||||
Reference in new issue
Block a user