EnumClientCommand.PERFORM_RESPAWN causing lag in 1.9

    • Type: Bug
    • Resolution: Invalid
    • Priority: Minor
    • None
    • Affects Version/s: None

      Ever since 1.9, I've noticed that forcing a player to respawn in a BukkitRunnable is using a lot more than it used to in 1.8.

      When its in a runnable:
      http://puu.sh/nCUz0.png or http://timings.aikar.co/?url=15349284 (see Clans v2.0, Task: WorldListener$2(Single))

      Code for above:

      new BukkitRunnable(){
      
      			@Override
      			public void run() {
      				
      				PacketPlayInClientCommand packet = new                    PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN);
      				((CraftPlayer) p).getHandle().playerConnection.a(packet);
      			}
      
      		}.runTaskLater(instance, 2);
      

      However, when you change it to an async runnable, it throws an error, but it still works and uses an unnoticeable amount of usage.

      http://timings.aikar.co/?url=15349395 Quite the difference compared to a regular runnable

      The error I get is what I assume to be just from executing a packet async, but ill post it anyway:

      org.apache.commons.lang.UnhandledException: Plugin Clans v2.0 generated an exception while executing task 274
      	at org.bukkit.craftbukkit.v1_9_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: net.minecraft.server.v1_9_R1.CancelledPacketHandleException
      
      

            Assignee:
            Unassigned
            Reporter:
            Tom Hoogstra
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: