How to make /accept /decline command?

Discussion in 'Plugin Development' started by ImPhantom, Apr 7, 2014.

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

    ImPhantom

    So i am making a plugin that deals with economy and i dont want to have someone accidently set their balance to $0 or something. So i have 2 questions. how would i make an /accept or /decline command to follow the economy command. Also. If i want to have someone pay back the certain amount that they borrowed within a certain amount of time. how would i make a timer for that? (it would be an extended amount of time (couple of days) Can anyone help?
     
  2. Offline

    1Achmed1

    Code:java
    1. if(cmd.equalsIgnoreCase("accept") {
    2. // code here
    3. }
     
  3. Offline

    ImPhantom

    1Achmed1
    Maybe i wasn't clear. I want the commands to follow after another command confirming what the first command wanted to do.

    ie:
    Player types /deletebal
    Server returns: are you sure? type /accept or /deny
     
  4. Offline

    BillyBobJoe168

    I think he means after the player types in a command first, then it allows the player to type in the /accept or /decline command.
    EDIT: woops to late:p
     
    ImPhantom likes this.
  5. Offline

    1Achmed1

    Code:java
    1. if(command.getName().equalsIgnoreCase("hi")) {
    2. //code here
    3. if(command.getName().equalsIgnoreCase("accept")) {
    4. //code here
    5. }
    6.  
     
  6. Offline

    Minnymin3

  7. Code:Java
    1.  
    2. List<String> players = new ArrayList<String>();
    3. Player p = (Player) sender;
    4. if(commandLabel.equalsIgnoreCase("deletebal")){
    5. if(!players.contains(p.getName())){
    6. players.add(p.getName);
    7. //Added player in the list, now we check if he is in it
    8. }
    9. }
    10. if(commandLabel.equalsIgnoreCase("accept")){
    11. if(players.contains(p.getName())){
    12. players.remove(p.getName());
    13. p.sendMessage("You accepted");
    14. return true;
    15. }else{
    16. p.sendMessage("You didnt wrote /deletebal");
    17. return true;
    18. }
    19. }
    20. if(commandLabel.equalsIgnoreCase("deny")){
    21. if(players.contains(p.getName())){
    22. players.remove(p.getName());
    23. p.sendMessage("You denied");
    24. return true;
    25. }else{
    26. p.sendMessage("You didnt wrote /deletebal");
    27. return true;
    28. }
    29. }
    30. }
     
  8. Offline

    MordorKing78

    Return the command on deny. This code shoud work ^^
     
Thread Status:
Not open for further replies.

Share This Page