Solved packet205ClientCommand......

Discussion in 'Plugin Development' started by ASHninja1997, Sep 20, 2013.

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

    ASHninja1997

    I tried doing this before but I couldn't get it to work at all. I rely need to know how to do this so my plugin can work more efficiently packet205 or Auto-Re-spawn. I am asking for help/explain it not for you to spoon feed it. But any message's will be accepted for i am thankful you replied. Thanks for reading me post.
     
  2. Offline

    chasechocolate

    Have you searched it? There's a whole thread in the resources section.
    Code:java
    1. Packet205ClientCommand packet = new Packet205ClientCommand();
    2.  
    3. packet.a = 1;
    4.  
    5. ((CraftPlayer) player).getHandle().playerConnection.a(packet);
     
    ASHninja1997 likes this.
  3. Offline

    CaptainBern Retired Staff

    ASHninja1997 likes this.
  4. Offline

    ASHninja1997

    chasechocolate CaptainBern
    Isn't there a class. Don't i have to make a class called. packet205ClientCommand? Then import it

    CaptainBern
    OK i read your method more closely and got it with no error in code. I am going to try it out now.

    CaptainBern
    I got a error that kicks me from server on death.
    "Bad packet id 205."

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  5. Offline

    chasechocolate

    ASHninja1997 sending the respawn packet has to be done through the a(packet) method rather than the sendPacket(packet) method. Change the "sendPacket" to "a".
     
  6. Offline

    ASHninja1997

    chasechocolate
    THanks i will try this out

    chasechocolate
    Wait so what do i have to do to the code?
    Code:java
    1. Packet packet = new Packet("Packet205ClientCommand");
    2. packet.send(p);


    I am useing CaptainBern Method

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  7. Offline

    chasechocolate

  8. Offline

    CaptainBern Retired Staff

    ASHninja1997 You have to do:
    Code:java
    1.  
    2. Packet packet = new Packet("Packet205ClientCommand");
    3. packet.setPublicValue("a", 1);
    4. packet.send(player);
    5.  

    Also I'm suposing you will run it once a player dies? If so run it 10 ticks after the player dies, else it won't run.
     
    ASHninja1997 likes this.
  9. Offline

    ASHninja1997

    CaptainBern chasechocolate
    So putting it in like this should work? won't it go into a loop every 10 ticks?
    Code:java
    1. this.getServer().getScheduler()
    2. .scheduleAsyncRepeatingTask(this, new Runnable() {
    3. public void run() {
    4. Packet packet = new Packet("Packet205ClientCommand");
    5. packet.setPublicValue("a", 1);
    6. packet.send(p);
    7. }
    8. }, 0L, 10L);

    This is in my PlayerDeathEvent

    Also Do you guys know how to do the
    Packet63WorldParticles
    ?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  10. Offline

    CaptainBern Retired Staff

    ASHninja1997 Go take a look at my animationlib, in there take a look at the WorldAnimation class

    ASHninja1997 Use scheduledasyncdelayedtask.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  11. Offline

    ASHninja1997

    CaptainBern
    How do i Implement that into my regular code.
    Is it the same thing?
    Code:
    Packet packet = new Packet("Packet63WorldParticles");
    packet.setPublicValue("a", 1);
    packet.send(player);
     
  12. Offline

    CaptainBern Retired Staff

  13. Offline

    ASHninja1997

    CaptainBern
    ahhh i think I see it. I will check this out then come back to you with results. Also Thanks a ton for all the help your giving me :D/

    CaptainBern
    So i put everything in a separate class and i want to implement it into the main.
    How would I do this.
    I tried just putting
    Code:java
    1. WorldAnimation.ENCHANTMENT_TABLE;

    But i need Assessment Operators.

    EDIT: I have to go mow the yard I should be back in an hour.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  14. Offline

    CaptainBern Retired Staff

    ASHninja1997 No, you use it like this: WorldAnimation.ENCHANTMENT_TABLE.play(location, speed, amount, offsetX, offsetY, offsetZ);
     
    ASHninja1997 likes this.
  15. Offline

    ASHninja1997

    CaptainBern
    Sorry if i am asking to much but what are the offset's for?
     
  16. Offline

    CaptainBern Retired Staff

    ASHninja1997 Well I think it's where the effect goes to. To be honest I'm not entirely sure myself, and the fact I didn't sleep two days also has something to do with it :p , if anyone with non-dead brains can tell?
     
  17. Offline

    ASHninja1997

    CaptainBern
    I understand :D. Just wondering but what do you use for the offset's. Also not to bring more work but i still get the error in packet205ClientCommand("Bad Packet").
     
  18. Offline

    CaptainBern Retired Staff

    ASHninja1997 Hmm let me take a look at the protocol again...

    Edit: Weird, it really should work tho, It's kinda late here so tomorrow I will do some tests and let you know if I got it to work.

    ASHninja1997 Oh I remember the offset again! It's the value that is added to the x, y or z after blx, y or z being multiplied by Randim.nextGhaussian(); :D

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  19. Offline

    ASHninja1997

    CaptainBern
    Did you figure out why it wasn't respawning the player?
     
  20. Offline

    CaptainBern Retired Staff

    ASHninja1997 Nope, tested it and didn't work,...

    Edit: Ah I know what is wrong, you need to invoke "a" in the player connection, so a fix would be:
    First add this to the packet class:
    Code:java
    1.  
    2. public Object getPacketObject(){
    3. return this.crafted_packet;
    4. }
    5.  


    Then the code in the delayed task would be:
    Code:java
    1.  
    2. final Packet packet = new Packet("Packet205ClientCommand");
    3. packet.setPublicValue("a", (int) 1);
    4.  
    5. try{
    6. Object entityPlayer = ReflectionUtil.getMethod("getHandle", player.getClass(), 0).invoke(player);
    7. Object playerConnection = entityPlayer.getClass().getField("playerConnection").get(entityPlayer);
    8.  
    9. Method toInvoke = ReflectionUtil.getMethod("a", playerConnection.getClass(), 0);
    10.  
    11. //and then send the packet
    12. toInvoke.invoke(playerConnection, packet.getPacketObject());
    13. }catch(Exception e){ e.printStacktrace(); }
    14.  
    15.  


    This should fix it.
     
  21. Offline

    ASHninja1997

    CaptainBern
    Code:java
    1. toInvoke.invoke(playerConnection, packet.getPacketObject());

    toInvoke and playerConnection are red
     
  22. Offline

    CaptainBern Retired Staff

  23. Offline

    ASHninja1997

    CaptainBern
    It asks me to make a veriable, method, class, etc.

    CaptainBern
    wait nvm i think I see why

    EDIT: I forgot to put it inside the bracket xD

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  24. Offline

    CaptainBern Retired Staff

    ASHninja1997 Oh nope, here is some fresh working code:
    Code:java
    1.  
    2. final Packet packet = new Packet("Packet205ClientCommand");
    3. packet.setPublicValue("a", (int) 1);
    4.  
    5. try{
    6. Object entityPlayer = ReflectionUtil.getMethod("getHandle", player.getClass(), 0).invoke(player);
    7. Object playerConnection = entityPlayer.getClass().getField("playerConnection").get(entityPlayer);
    8.  
    9. Method toInvoke = playerConnection.getClass().getMethod("a", ReflectionUtil.getNMSClassExact("Packet205ClientCommand"));
    10. //and then send the packet
    11. toInvoke.invoke(playerConnection, packet.getPacketObject());
    12. }catch(Exception e){ e.printStackTrace(); }
    13.  


    (sorry for the non-working code :p )
     
  25. Offline

    ASHninja1997

    I can't test this out atm because minecraft is having those authentication errors. Hopefully they will be fixed after church
     
  26. Offline

    CaptainBern Retired Staff

    ASHninja1997 Well my test server is always on offline mode since there are much server trouble lately, the second code I gave you works.
     
  27. Offline

    ASHninja1997

    CaptainBern
    I trust you. You're very good at what you do :D.
     
    CaptainBern likes this.
  28. Offline

    CaptainBern Retired Staff

  29. Offline

    ASHninja1997

    CaptainBern
    I got back home and tried the Auto re-spawn and it said i had "wrong number of arguments." When ever a person died.

    CaptainBern
    Nvm i fixed it. small typo

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
Thread Status:
Not open for further replies.

Share This Page