mirror of
https://github.com/RayzsYT/ProAntiTab.git
synced 2026-12-01 04:49:44 -05:00
Back
This commit is contained in:
1 parent
06c6123fbe
commit
8286d856fc
2 files changed
+41
-19
No files matched your search
@@ -35,7 +35,9 @@ public class PacketAnalyzer {
|
||||
return false;
|
||||
}
|
||||
|
||||
channel.pipeline().names().forEach(System.out::println);
|
||||
channel.pipeline().addBefore(PacketAnalyzer.HANDLER_NAME, PacketAnalyzer.PIPELINE_NAME, new PacketDecoder(player));
|
||||
channel.pipeline().addAfter("via-encoder", PacketAnalyzer.PIPELINE_NAME, new PacketDecoder(player));
|
||||
PacketAnalyzer.INJECTED_PLAYERS.put(player.getUniqueId(), channel);
|
||||
} catch (Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
@@ -101,4 +103,40 @@ public class PacketAnalyzer {
|
||||
} catch (Throwable exception) { exception.printStackTrace(); }
|
||||
}
|
||||
}
|
||||
|
||||
private static class ViaPacketEncoder extends ChannelDuplexHandler {
|
||||
|
||||
private final Player player;
|
||||
private ViaPacketEncoder(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext channel, Object packetObj) {
|
||||
try {
|
||||
if (!player.hasPermission("proantitab.bypass") && packetObj.getClass() != null) {
|
||||
String packetName = packetObj.getClass().getSimpleName();
|
||||
if (packetName.equals("PacketPlayInTabComplete")) {
|
||||
if(!PACKET_HANDLER.handleIncomingPacket(player, packetObj)) return;
|
||||
}
|
||||
}
|
||||
|
||||
super.channelRead(channel, packetObj);
|
||||
} catch (Throwable exception) { exception.printStackTrace(); }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ChannelHandlerContext channel, Object packetObj, ChannelPromise promise) {
|
||||
try {
|
||||
if (!player.hasPermission("proantitab.bypass") && packetObj.getClass() != null) {
|
||||
String packetName = packetObj.getClass().getSimpleName();
|
||||
if (packetName.equals("PacketPlayOutTabComplete")) {
|
||||
if(!PACKET_HANDLER.handleOutgoingPacket(player, packetObj)) return;
|
||||
}
|
||||
}
|
||||
|
||||
super.write(channel, packetObj, promise);
|
||||
} catch (Throwable exception) { exception.printStackTrace(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,14 +52,13 @@ public class ModernPacketHandler implements PacketHandler {
|
||||
input = split[0];
|
||||
}
|
||||
|
||||
cancelsBeforeHand = Storage.Blacklist.isListed(input, !Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED);
|
||||
cancelsBeforeHand = Storage.Blacklist.isBlocked(player, input, !Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED);
|
||||
}
|
||||
|
||||
Suggestions suggestions = (Suggestions) suggestionObj;
|
||||
if((input.length() < 1 || cancelsBeforeHand) && Reflection.isWeird())
|
||||
return false;
|
||||
if((input.length() < 1 || cancelsBeforeHand) && Reflection.isWeird()) return false;
|
||||
|
||||
if(spaces > 1 && cancelsBeforeHand || !BukkitLoader.isLoaded()) {
|
||||
if(spaces >= 1 && cancelsBeforeHand || !BukkitLoader.isLoaded()) {
|
||||
suggestions.getList().clear();
|
||||
return true;
|
||||
}
|
||||
@@ -72,21 +71,6 @@ public class ModernPacketHandler implements PacketHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
if(input.length() < 1 && Reflection.isWeird() || cancelsBeforeHand && Reflection.isWeird())
|
||||
return false;
|
||||
else if(cancelsBeforeHand)
|
||||
suggestions.getList().clear();
|
||||
else {
|
||||
if(Reflection.isWeird()) return true;
|
||||
|
||||
suggestions.getList().removeIf(suggestion -> {
|
||||
String command = suggestion.getText();
|
||||
return Storage.Blacklist.isBlocked(player, command);
|
||||
});
|
||||
}*/
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user