Advertisement
SamWilko

Untitled

Jun 28th, 2022
1,158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. public final class Packets extends PacketListener {
  2.  
  3.     public void load() {
  4.        
  5.  
  6.         // Checks if protocollib is installed
  7.         if (!HookManager.isProtocolLibLoaded()) {
  8.             Common.log("&cWarning: No ProtocolLib found, some features will not be available.");
  9.  
  10.             return;
  11.         }
  12.  
  13.         // Adding the filter to catch the packet
  14.         // two kinds of packets:
  15.         // (1) sent out to the server which we intercept before the server processes it
  16.         // client -> server
  17.         // (2) sent out to the player which we can intercept before it's sent out
  18.         // server -> client
  19.  
  20.         this.addSendingListener(PacketType.Status.Server.SERVER_INFO, event -> {
  21.             Object handle = event.getPacket().getHandle();
  22.  
  23.             System.out.println(handle);
  24.         });
  25.     }
  26.  
  27.     @Override
  28.     public void onRegister() {
  29.        
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement