Certain command to send a command

Discussion in 'Plugin Development' started by Laxer21117, Nov 26, 2014.

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

    Laxer21117

    Hey guys I have a question. How do I make it so that people can't send a command I have in the code until they type in the other command. For example they can't type /bye if they haven't typed /hi. If this is possible please help me. Thanks!
     
  2. Laxer21117 Make a list, when they do command1 add them, if they try command2 then check if they are in the list if so allow them if not don't.
     
  3. Offline

    Laxer21117

    bwfcwalshy Can I have a bit of a better explanation? Sorry I didn't really understand that.
     
  4. Offline

    Laxer21117

    bwfcwalshy how to do what you said. I need a more in depth explanation.
     
  5. Laxer21117 Make a List. On the command, if they do /hi then add them to the list which was made earlier, if they do /bye then check the list and if it contains the player who sent it then do what it does, if it doesn't contain them then you can send them a message saying something like "You have to do /hi first!".
     
  6. Offline

    Laxer21117

    Ohh okay.

    Can't figure out how to do this... I sound like an idiot but it's true :(

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

    Skionz

    Laxer21117 What don't you understand? Do you know how to make a list? Do you know how to check if they do /hi? Do you know how to add an Object to that list? We need more information.
     
  8. Offline

    Walruski

  9. Offline

    Laxer21117

    Skionz I don't know how to make a list or check to see if they typed the command.

    Skionz I have made arraylists just don't know how to do this certain thing in it. Please help if you can.

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

    Skionz

    Laxer21117 Check if they do /hi and add them to the ArrayList with ArrayList#add(Object)
     
  11. Offline

    Laxer21117

    Skionz Can I have a more in depth explanation of how to do that? Sorry if I am annoying...
     
  12. Offline

    Skionz

  13. Offline

    Totom3

    Skionz You evil, stop torturing him! He doesn't even know how to create a List..

    Laxer21117 That's a very basic thing, you should know that if you're making Bukkit plugins. It's as basic as new ArrayList<>(); And how come you don't know how to check if they entered a command? You already did that in the plugins you uploaded to BukkitDev ;)
     
    Laxer21117 likes this.
  14. Offline

    Skionz

    Totom3 There is a point where all I can do is repeat myself without writing the code for him :oops:
     
    Totom3 and Laxer21117 like this.
  15. Offline

    CullanP


    After reading this thread I really want to just write the code out to make an arraylist xD
     
    Skionz likes this.
  16. Offline

    teej107

    xTrollxDudex likes this.
  17. Offline

    xTrollxDudex

  18. Offline

    Laxer21117

    Totom3 Would I put
    Code:java
    1. ArrayList<String> command = new ArrayList<String>();
    2.  
    3. if(command.contains(What do I put here)){

    Is that would I do and if it is how do I make it see if they put in /bye?

    xTrollxDudex Please next time don't respond with a billion links. It overwhelms me and doesn't help.

    <Edit by mrCookieSlime: Merged Posts. Please do not double post. There is an Edit-Button right next to the Date.>
     
  19. Offline

    xTrollxDudex

    Click on 1 or 2 of them and you'll know exactly what you need. There's a special concept called "researching" that is require to program applications.
     
    teej107 likes this.
  20. Offline

    mrCookieSlime

    Laxer21117
    Please do not abuse the report button for reporting people because they "spammed and not contributed to the Thread" when they actually just sent you links to tutorials which help you out.
    Spoonfeeding is not as good as Java Tutorials. I highly suggest you to read them.

    and to answer your question: you probably want to store the players uuid/name in the list and check if it contains this uuid/name. Take a look at the posted links to see how this is done.
     
    ferrybig likes this.
Thread Status:
Not open for further replies.

Share This Page