PacketPlayOutBlockBreakAnimation Packet in 1.12.2?

Discussion in 'Plugin Development' started by ByLogix, Jun 11, 2018.

  1. Offline

    ByLogix

    Hey Community,
    I just tried to use the PacketPlayOutBlockBreakAnimation Packet in my plugin for 1.12.2, but it doesn't seem to work... Hope you guys can tell me, where is my mistake (There is no stack trace in the console)

    (My Goal is it to seem the block like its been digged by a player)

    Method for sending:
    Code:
    public static Integer playAnimation(final List<Player> players, final Block block, Integer period) {
            BukkitTask task = new BukkitRunnable() {
    
                int current = 0;
    
                @Override
                public void run() {
                    PacketPlayOutBlockBreakAnimation packet = new PacketPlayOutBlockBreakAnimation(0, new BlockPosition(block.getX(), block.getY(), block.getZ()), current);
    
                    for(Player p : players){
                        Data.sendPacket(p, packet);
                    }
    
                    if(current == 8){
                        this.cancel();
                    }
    
                    current++;
                }
            }.runTaskTimer(Main.getInstance(), 0, period);
    
            return task.getTaskId();
        }
     
  2. Offline

    MightyOne

    Exception? Debug message where it stops running? Redt of the class? Anything?
     

Share This Page