title: "Cannot resolve constructor" I need help knowing where the program is going wrong
body: <p>I'm trying to update this Spigot plugin but am getting an error from the section that handles chat. I have updated the API and the same section of code works for previous versions so I'm guessing something new is required but I have no idea what.</p>
  <p>The relevant library is <code>craftbukkit-1.16.3-R0.1-SNAPSHOT</code></p>
  <blockquote>
  <p>Cannot resolve constructor 'PacketPlayOutChat(net.minecraft.server.v1_16_R2.IChatMutableComponent)'</p>
  </blockquote>
  <p>Here is the specefic segment of code throwing an error in Intellij:</p>
  <blockquote>
  <pre><code>public void sendJson(Player p) {
      ((CraftPlayer) p).getHandle().playerConnection.sendPacket(new PacketPlayOutChat(ChatSerializer.a(toString())));
  }
  </code></pre>
  </blockquote>
  <p>Here is the rest of the java class in case something in it is relevant to the problem.</p>
  <pre><code>package me.karasumori.applymc.utils.common;
  
  import net.minecraft.server.v1_16_R2.IChatBaseComponent.ChatSerializer;
  import net.minecraft.server.v1_16_R2.PacketPlayOutChat;
  
  import org.bukkit.Bukkit;
  import org.bukkit.ChatColor;
  import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer;
  import org.bukkit.entity.Player;
  
  import java.util.ArrayList;
  import java.util.List;
  import java.util.regex.Pattern;
  
  public class JsonBuilder {
  
      public enum ClickAction {
          RUN_COMMAND, SUGGEST_COMMAND, OPEN_URL
      }
  
      public enum HoverAction {
          SHOW_TEXT
      }
  
      private List&lt;String&gt; extras = new ArrayList&lt;&gt;();
  
      public JsonBuilder(String... text) {
          for (String extra : text)
              parse(extra);
      }
  
      public JsonBuilder parse(String text) {
          String regex = &quot;[&amp;�]{1}([a-fA-Fl-oL-O0-9]){1}&quot;;
          text = text.replaceAll(regex, &quot;�$1&quot;);
  
          if (!Pattern.compile(regex).matcher(text).find()) {
              withText(text);
              return this;
          }
          String[] words = text.split(regex);
          int index = words[0].length();
  
          for (String word : words) {
              try {
                  if (index != words[0].length())
                      withText(word).withColor(&quot;�&quot; + text.charAt(index - 1));
              } catch (Exception e) {
                  e.printStackTrace();
              }
              index += word.length() + 2;
          }
          return this;
      }
  
      public JsonBuilder withText(String text) {
          extras.add(&quot;{text:\&quot;&quot; + text + &quot;\&quot;}&quot;);
          return this;
      }
  
      public JsonBuilder withColor(ChatColor color) {
          String c = color.name().toLowerCase();
  
          addSegment(color.isColor() ? &quot;color:&quot; + c : c + &quot;:true&quot;);
          return this;
      }
  
      public JsonBuilder withColor(String color) {
          while (color.length() != 1)
              color = color.substring(1).trim();
          withColor(ChatColor.getByChar(color));
          return this;
      }
  
      public JsonBuilder withClickEvent(ClickAction action, String value) {
          addSegment(&quot;clickEvent:{action:&quot; + action.toString().toLowerCase() + &quot;,value:\&quot;&quot; + value + &quot;\&quot;}&quot;);
          return this;
      }
  
      public JsonBuilder withHoverEvent(HoverAction action, String value) {
          addSegment(&quot;hoverEvent:{action:&quot; + action.toString().toLowerCase() + &quot;,value:\&quot;&quot; + value + &quot;\&quot;}&quot;);
          return this;
      }
  
      private void addSegment(String segment) {
          String lastText = extras.get(extras.size() - 1);
  
          lastText = lastText.substring(0, lastText.length() - 1) + &quot;,&quot; + segment + &quot;}&quot;;
          extras.remove(extras.size() - 1);
          extras.add(lastText);
      }
  
      public String toString() {
          if (extras.size() &lt;= 1)
              return extras.size() == 0 ? &quot;{text:\&quot;\&quot;}&quot; : extras.get(0);
          String text = extras.get(0).substring(0, extras.get(0).length() - 1) + &quot;,extra:[&quot;;
          extras.remove(0);
          ;
          for (String extra : extras)
              text = text + extra + &quot;,&quot;;
          text = text.substring(0, text.length() - 1) + &quot;]}&quot;;
          return text;
      }
  
      public void sendJson(Player p) {
          ((CraftPlayer) p).getHandle().playerConnection.sendPacket(new PacketPlayOutChat(ChatSerializer.a(toString())));
      }
  
      public void sendAllJson() {
          for (Player p : Bukkit.getOnlinePlayers())
              sendJson(p);
      }
  }
  </code></pre>
  <p>I don't know much about java yet, sorry if my question is vague,</p>