Que time

Discussion in 'Plugin Development' started by grasshopperMatt123, Mar 23, 2014.

Thread Status:
Not open for further replies.
  1. Hello! Today I was wondering if there is a way when someone types a command if a variable is true it adds them to a que if so thanks.
     
  2. Offline

    skyrimfan1

    Relatively simple, but I don't know what you're referring to by a 'question:'

    Code:java
    1. private List<String> playerNames = new ArrayList<String>();
    2.  
    3. public void addToQuestion(){
    4. if (!playerNames.contains(player.getName()))
    5. playerNames.add(player.getName());
    6. }
     
    grasshopperMatt123 likes this.
  3. Sorry Que this is from my phone

    I also need a way to choose 2 players at the top of the que

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

    skyrimfan1

    Oh, I was wondering what you meant by that. :p
     
  5. xD, thanks for Catching that, everyone who looked would've been like wtf?
     
  6. Offline

    skyrimfan1

    Code:java
    1. public Player getTopPlayer(){
    2. return playerNames.isEmpty() ? null : Bukkit.getPlayerExact(playerNames.get(0));
    3. }
    4.  
    5. public Player getSecondPlayer(){
    6. return playerNames.isEmpty() ? null : Bukkit.getPlayerExact(playerNames.get(1));
    7. }
     
  7. Any specific way to link this in with a command? xD

    Also should I do addToQue(Player player) {
    And is it possible you could give me a slight example of how to hook this onto a boolean, xD, quite new to Java and Methods and such.

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

Share This Page