1

Bukkit Plugin Help

Hydrian 7/31/13 2:21 am
288
7/31/2013 2:41 am
Hey, I have a array for my bukkit plugin im working on, I also have a array holding a random user, and how can I get the other users from that array to a variable?

so

variable = <array>[rand(getsrandomplayer)]
others = the rest of the array?


How could I do that?
Posted by
Hydrian
Level 44 : Master Gent
112

  Have something to say?

JoinSign in

6

Hydrian
07/31/2013 2:41 am
Level 44 : Master Gent
Ok thanks so much, if you want, I may need further help with my plugin if you wish to help me you may, cmedia.studios add me skype???

Thanks

~Hydri
1
nickfromgreece
07/31/2013 2:39 am
Level 54 : Grandmaster Programmer
Corrected code:

int random = new Random().nextInt(Bukkit.getOnlinePlayers().length);//random select player
Player[] players = Bukkit.getOnlinePlayers();
Player player = players[random];//make a array with the chosen user in it
Player[] theNotChosen = new Player[PutTheMaxAmountOfPlayersHere];
public void onGameStart(CommandSender sender){
int lengh = 0;
for(Player player : players){
if(!player.equals(player)){
theNotChosen [lengh] = player;
lengh++;
}
}
player.sendMessage("Your It!");
}
1
Hydrian
07/31/2013 2:33 am
Level 44 : Master Gent
I got

int random = new Random().nextInt(Bukkit.getOnlinePlayers().length);//random select player
Player player = Bukkit.getOnlinePlayers()[random];//make a array with the chosen user in it

public void onGameStart(CommandSender sender){
int lenght = 0;
for(Player player : array){
if(!player.equals(player)){
(theres?)[lenght] = player;
lenght++;
}
}
player.sendMessage("Your It!");
}


Correct Yes?
1
Hydrian
07/31/2013 2:28 am
Level 44 : Master Gent
where dose theres come into play?
1
nickfromgreece
07/31/2013 2:30 am
Level 54 : Grandmaster Programmer
it was the others array mispelled that oops
1
nickfromgreece
07/31/2013 2:23 am
Level 54 : Grandmaster Programmer
Player chosen = array[getThePlayer];
Player[] others = new Player[maxPlayersHere];
int lengh = 0;
for(Player player : array){
if(!player.equals(chosen){
others[lengh] = player;
lengh++;
}
}
1

Welcome