Help - use command only once

Discussion in 'Plugin Development' started by RodrigoWalker, Jul 18, 2015.

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

    RodrigoWalker

    Hello, I come to you for help because I'm having a problem with the plugin I'm developing for my server, I wanted a player using the following command / 151SD5F1SD no one else will be able to use this idea or send a message that has been used by that player, I was wondering if this is possible or another method that can talk to you ... sorry for bad English.
     
  2. Offline

    _Filip

    Or /claim (Id)
     
  3. Offline

    RodrigoWalker

    Sorry not Intendi.
     
  4. Offline

    Zombie_Striker

    Since there is a space between the / and the 151SD..., the command it self would be nothing (""), if you intended that that whole line would be a command without arguments, then there should not have been a space there.

    By this, do you mean that whatever the play types gets stored somewhere and if anyone says that exact same thing it will delete that players message? If so, then what does the second part of your sentence mean? I don't know how a method can "talk to you"
     
  5. Offline

    RodrigoWalker

    I was wondering if it is possible if a player enter the following command /example and another player try to use this command, will speak that such a player already used this command, then I wanted to know if it is possible to enter a command only once

    the command with / 151SD ... was a google translator error
     
  6. Offline

    Zombie_Striker

    @RodrigoWalker

    Then here is some basic code for what you want.
    Code:
    boolean commandSentOnce = false;
    String playername = null;
    
    void onCommand(CommandSender sender, Command cmd.....){
    if(cmd.getLabel.equalsIgnoreCase("example")){
    
    if(commandSentOnce){
    sender.sendMessage(playername+" has already sent this command");
    }else{
    commandSentOnce = true;
    playername = sender.getName();
    sender.sendCommand("You have sent the command");
    }
    
    }
    }
     
  7. Offline

    RodrigoWalker

    @Zombie_Striker
    Sorry about the delay to answer was having some problems here, the code worked for me I can not until you pass the code of the plugin you put the code that you gave me to right, can it?

    Sorry for the bad English, google translator is an even dung.
     
Thread Status:
Not open for further replies.

Share This Page