1

Bukkit Plugin Help

Hydrian's Avatar Hydrian7/31/13 2:21 am
1 emeralds 254 6
7/31/2013 2:41 am
Hydrian's Avatar Hydrian
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's Avatar
Hydrian
Level 44 : Master Gent
112

Create an account or sign in to comment.

6

1
07/31/2013 2:41 am
Level 44 : Master Gent
Hydrian
Hydrian's Avatar
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
07/31/2013 2:39 am
Level 54 : Grandmaster Programmer
nickfromgreece
nickfromgreece's Avatar
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
07/31/2013 2:33 am
Level 44 : Master Gent
Hydrian
Hydrian's Avatar
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
07/31/2013 2:28 am
Level 44 : Master Gent
Hydrian
Hydrian's Avatar
where dose theres come into play?
1
07/31/2013 2:30 am
Level 54 : Grandmaster Programmer
nickfromgreece
nickfromgreece's Avatar
it was the others array mispelled that oops
1
07/31/2013 2:23 am
Level 54 : Grandmaster Programmer
nickfromgreece
nickfromgreece's Avatar
Player chosen = array[getThePlayer];
Player[] others = new Player[maxPlayersHere];
int lengh = 0;
for(Player player : array){
if(!player.equals(chosen){
others[lengh] = player;
lengh++;
}
}
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome