@Override
 public void handle(AbstractPacketHandler handler) throws Exception {
   if (handler instanceof DownstreamBridge) {
     getPlayerField(DownstreamBridge.class);
     if (playerField != null) {
       ProxiedPlayer player;
       try {
         playerField.setAccessible(true);
         player = (ProxiedPlayer) playerField.get(handler);
       } catch (IllegalAccessException ex) {
         BungeeTabListPlus.getInstance()
             .getLogger()
             .warning("Failed to access player object in TeamPacketHandler for " + handler);
         return;
       }
       if (BungeeTabListPlus.getTabList(player) instanceof TabList18v3) {
         Server server = player.getServer();
         if (server != null) {
           BungeeTabListPlus.getInstance()
               .getLogger()
               .warning(
                   "Server "
                       + server.getInfo().getName()
                       + " uses Scoreboard teams. This feature is not compatible with BungeeTabListPlus.");
         } else {
           BungeeTabListPlus.getInstance()
               .getLogger()
               .warning(
                   "Player "
                       + player.getName()
                       + " received a Scoreboard team packet. This feature is not compatible with BungeeTabListPlus.");
         }
         throw CancelSendSignal.INSTANCE;
       }
     } else {
       BungeeTabListPlus.getInstance().getLogger().severe("Could not get player for " + handler);
     }
   }
   super.handle(handler);
 }
Пример #2
0
  public static void sendMessage(Server server, String... message) {
    ByteArrayOutputStream b = new ByteArrayOutputStream();
    DataOutputStream o = new DataOutputStream(b);

    try {
      for (String m : message) {
        o.writeUTF(m);
      }
    } catch (IOException ignored) {
    }

    server.sendData("BSBungee", b.toByteArray());
  }