Faking "Sleep" Packet?

Discussion in 'Plugin Development' started by mattrick, Feb 4, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    mattrick

    I have been working on a plugin lately, and it requires that a person appears to be "laying" on the ground. Yes, I've Google'd it, and yes, I found...some sort of answer.
    Code:java
    1. public static void layDown(Player player, Block block) {
    2. player.setAllowFlight(true);
    3. player.setFlying(true);
    4. player.teleport(block.getLocation().add(0.5, 0.1, 0.5));
    5.  
    6. EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
    7. Packet17EntityLocationAction packet = new Packet17EntityLocationAction(entityPlayer, 0, block.getX(), block.getY(), block.getZ());
    8.  
    9. for(Player p : Bukkit.getServer().getOnlinePlayers()){
    10. if(!(p.getName() == player.getName())){
    11. ((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
    12. }
    13. }
    14.  
    15. Packet70Bed packet2 = new Packet70Bed(player.getEntityId(), 78);
    16.  
    17. for(Player p : Bukkit.getServer().getOnlinePlayers()){
    18. if(!(p.getName() == player.getName())){
    19. ((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet2);
    20. }
    21. }
    22.  
    23. }


    The problem with this code is that Packet70Bed and Packet17EntityLocation do not exist. Yes, I am building with CraftBukkit, so it should be there right? I'm sure a lot has changed from this code after updates. Is there any new way to do this?
     
  2. Offline

    xTrollxDudex

    mattrick
    The Protocol changed in 1.7, all the packet names just completely switched.

    Packet70Bed is now PacketPlayOutBed
    Packet17EntityLocation is now (Not sure about this one, must have been a really old packet)
     
  3. Offline

    mattrick

    xTrollxDudex
    That's what I figured, should I take a look at wiki.vg?
     
  4. Offline

    xTrollxDudex

    mattrick
    Then again, I don't see the need for the entity location packet?
     
  5. Offline

    mattrick

  6. Offline

    xTrollxDudex

  7. Offline

    mattrick

Thread Status:
Not open for further replies.

Share This Page