#Method that checks if next player in array is null or no

8 messages · Page 1 of 1 (latest)

shell ore
#

Help doing it I cant figure it out

woven brookBOT
#

This post has been reserved for your question.

Hey @shell ore! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

shell ore
#

for(int i = currentplayer; i < this.players.length + 1; i++){
if(this.players[i+1] != null){
currentplayer = (currentplayer + 1) % this.players.length;
}
i = i % this.players.length;
}

uncut iron
#

@shell ore Try

#

for (int i = currentplayer; i < this.players.length; i++) {
if (this.players[i + 1] != null) {
currentplayer = (currentplayer + 1) % this.players.length;
}
}

#

you didn't need the +1 next to this.players.length

#

i++ already increments it for you