Animation

Discussion in 'Plugin Development' started by Juancomaster1998, Jan 22, 2015.

Thread Status:
Not open for further replies.
  1. Hello!
    I want to open a chest when a player right click it, but only the animation, not the inventory, Like MinePlex.
    So, the problem is that I have no idea how to do this. Could you help me?
    I tried with playsound but it didn`t worked.
     
  2. Offline

    teej107

  3. @teej107
    Well, I`ve seen something like that on releated posts, but no1 seems to know about a good tutorial about packets or how to do this :/
    If any1 could please give me a tutorial or the code to do this I`ll be very grateful ^^
    I`ve like finished with my plugin, I only need to finish with an animation, but I`ve got stuck at this point :/
    Thanks ^^
     
  4. Offline

    Permeer

    @Juancomaster1998 When the player interact with a chest cancel the event and use this packet

    Code:
    PacketPlayOutBlockAction packet = new PacketPlayOutBlockAction(x, y, z, Blocks.CHEST, 1, 1);
    then you send the packets to the players
     
    Juancomaster1998 likes this.
  5. @Permeer
    Thanks!, I`ll try it
    I was trying with:
    Code:
    new BlockActionData(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), CraftMagicNumbers.getBlock(loc.getBlock()), 1, 0);
    but I didn`t get it to work.
    A dumb question: how do I send the packet to players?

    EDIT:
    Done!
    Thanks guy!
    Code (open)

    Code:
    public void changeChestState(Location loc, boolean open) {
            PacketPlayOutBlockAction packet = new PacketPlayOutBlockAction(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), Blocks.CHEST, 1, open ? 1 : 0);
            for (Player p : loc.getWorld().getPlayers()) ((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
        }
     
    Last edited: Jan 22, 2015
  6. Offline

    BladeXTD

    Warning: Sending packets can get players kicked on a server with NoCheatPlus
     
  7. Offline

    BlueCrafter12

    Can i get/(Share) that plugin after? i wanna try it :D
     
Thread Status:
Not open for further replies.

Share This Page