Advertisement
Rukes

Untitled

Dec 29th, 2018
137
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   public void send(Player paramPlayer, String paramString1, String paramString2)
  2.   {
  3.     if (!paramPlayer.isOnline()) {
  4.       return;
  5.     }
  6.     if (paramString1 == null) {
  7.       paramString1 = "";
  8.     }
  9.     if (paramString2 == null) {
  10.       paramString2 = "";
  11.     }
  12.     paramString1 = paramString1.replace("\\n", "%&n&%");
  13.     paramString2 = paramString2.replace("\\n", "%&n&%");
  14.     paramString1 = paramString1.replace("\\", "\\\\");
  15.     paramString2 = paramString2.replace("\\", "\\\\");
  16.     paramString1 = paramString1.replace("%&n&%", "\\n");
  17.     paramString2 = paramString2.replace("%&n&%", "\\n");
  18.     try
  19.     {
  20.       if ((!VersionChecker.Version.getCurrent().isHigher(VersionChecker.Version.v1_7_R4)) || (this.nmsChatSerializer == null)) {
  21.         return;
  22.       }
  23.       Object localObject1 = this.packetType.newInstance();
  24.      
  25.       Object localObject2 = this.nmsChatSerializer.getMethod("a", new Class[] { String.class }).invoke(null, new Object[] { "{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', paramString1) + "\"}" });
  26.       Field localField1 = null;
  27.       if (VersionChecker.Version.isCurrentEqualOrHigher(VersionChecker.Version.v1_13_R2)) {
  28.         localField1 = localObject1.getClass().getDeclaredField("header");
  29.       } else {
  30.         localField1 = localObject1.getClass().getDeclaredField("a");
  31.       }
  32.       localField1.setAccessible(true);
  33.       localField1.set(localObject1, localObject2);
  34.       localField1.setAccessible(!localField1.isAccessible());
  35.      
  36.       Object localObject3 = this.nmsChatSerializer.getMethod("a", new Class[] { String.class }).invoke(null, new Object[] { "{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', paramString2) + "\"}" });
  37.      
  38.       Field localField2 = null;
  39.       if (VersionChecker.Version.isCurrentEqualOrHigher(VersionChecker.Version.v1_13_R2)) {
  40.         localField2 = localObject1.getClass().getDeclaredField("footer");
  41.       } else {
  42.         localField2 = localObject1.getClass().getDeclaredField("b");
  43.       }
  44.       localField2.setAccessible(true);
  45.       localField2.set(localObject1, localObject3);
  46.       localField2.setAccessible(!localField2.isAccessible());
  47.      
  48.       sendPacket(paramPlayer, localObject1);
  49.     }
  50.     catch (Exception localException)
  51.     {
  52.       Bukkit.getLogger().log(Level.SEVERE, "Error ", localException);
  53.     }
  54.   }
  55.  
  56.   private void sendPacket(Player paramPlayer, Object paramObject)
  57.   {
  58.     Object localObject1 = this.getHandle.invoke(paramPlayer, new Object[0]);
  59.     Object localObject2 = this.playerConnection.get(localObject1);
  60.     this.sendPacket.invoke(localObject2, new Object[] { paramObject });
  61.   }
Advertisement
RAW Paste Data Copied
Advertisement