Solved request system

Discussion in 'Plugin Development' started by MrHatz2, Sep 2, 2014.

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

    MrHatz2

    How to make request system like tpa and tpaccept?
     
  2. Offline

    Deleted user

    -
     
    Last edited by a moderator: Jan 23, 2015
    IvanTheForth and Jaaakee224 like this.
  3. Offline

    MrHatz2

    SmooshCakez
    Example plz

    I dont know what metadata is
     
  4. Offline

    maxiz22

  5. Offline

    SmooshCakez

  6. Offline

    Deleted user

    -
     
    Last edited by a moderator: Jan 23, 2015
  7. Offline

    MrHatz2

  8. Offline

    Skionz

    MrHatz2 read the java docs
    All you would do is when someone enters /tpa player2 you add player 1 and 2 to a hashmap and send player 2 a message. Then when player 2 does /tpaccept you check if that players name is in the hashmap and if it is remove them from the hashmap and teleport the player.
     
  9. Offline

    maxiz22

    You can also learn by looking at the source code of other plugins, sometimes it is very useful to see how other programing.
     
  10. Offline

    SmooshCakez

    If you don't know what Metadata is, use HashMaps.
     
  11. Offline

    MrHatz2

    Skionz
    I dont know what to do in a javadocs

    SmooshCakez
    k but how do you use hashmap for requests?
     
  12. Offline

    Skionz

    I explained the basics above and if you know java already just read the javadocs and try and memorize every class and method and what it does.
     
  13. Offline

    MrHatz2

    Skionz
    can you write example code?
     
  14. Offline

    MCMastery

    MrHatz2 is just trying to be spoonfed. If he did what he says he did, he would know a lot more.
     
  15. Offline

    Deleted user

    -
     
    Last edited by a moderator: Jan 23, 2015
    MCMastery likes this.
  16. Offline

    Skionz

    MrHatz2
    I would prefer not too spoonfeed. TheBCBroz has a few excellent bukkit tutorials on youtube. I would start with those.
     
  17. Offline

    Jaaakee224

    MrHatz2
    <Edit by Moderator: Redacted bit url>
     
    Last edited by a moderator: Feb 11, 2017
  18. Offline

    MrHatz2

    Skionz
    yea but people here say bcbroz teach bad stuff so I dont want to see his tutorials.
     
  19. Offline

    Jaaakee224

     
  20. Offline

    Skionz

    MrHatz2
    Code:
    HashMap<Player, Player> map = new HashMap<Player, Player>();
    map.put(player1.getName(), player2.getName());
    The hashmap ^

    Whats wrong with his tutorials?
     
  21. Offline

    MrHatz2

    Skionz
    k where do I put that?
     
  22. Offline

    Deleted user

    -
     
    Last edited by a moderator: Jan 23, 2015
  23. Offline

    Skionz

    When the player uses /tpa [player] you would add the player to that hashmap
     
  24. Offline

    MrHatz2

    zombiekiller753
    can you atleast help instead of posting useless post?

    Skionz

    Ok I put it in my onCommand but what is player1 and player2?
     
  25. Offline

    Deleted user

    -
     
    Last edited by a moderator: Jan 23, 2015
  26. Offline

    Skionz

    MrHatz2
    they were an example. In theory player1 would be the sender and player2 would be args[0] or the other way around.

    EDIT: Sorry change the hashmap to String, use player.getName() in the hashmap not player.
     
  27. Offline

    xTigerRebornx

    MrHatz2 That was an example. If you can't figure it out from that, then you may want to spend some time learning Java
     
  28. Offline

    Deleted user

    -
     
    Last edited by a moderator: Jan 23, 2015
  29. Offline

    Skionz

    MrHatz2 this is what I am starting to believe :oops:
    Code:
    I ALRESDY KNOW JAVA == false;
     
    leon3001 likes this.
  30. Offline

    BillyGalbreath

    No. No no no no no! God no!

    Store the Player object in the HashMap. This will prevent you from having to Bukkit.getServer().getPlayer() later, which is a S L O W method. Just be sure you add a listener for PlayerQuitEvent to remove the Player object if they log out. Viola! No problems what-so-ever! \o/
     
Thread Status:
Not open for further replies.

Share This Page