Java index out of bounds error -


i writing code in java plugin minecraft server, logical principles general in nature.

public void doreviewmember(commandsender playersent) {     if (!reviewsmember.isempty()) {         review dothis = null;          arraylist<review> players = new arraylist<review>();         arraylist<review> playersvip = new arraylist<review>();         arraylist<review> playersvipplus = new arraylist<review>();          (int c1 = 0; c1 < reviewsmember.size(); c1++) {             if  (bukkit.getplayer(reviewsmember.get(c1).getname()).haspermission("reviewplugin.vipplus"))                 playersvipplus.add(reviewsmember.get(c1));             else if (bukkit.getplayer(reviewsmember.get(c1).getname()).haspermission("reviewplugin.vip"))                 playersvip.add(reviewsmember.get(c1));             else players.add(reviewsmember.get(c1));         }          if (playersvipplus.size() > 0)             dothis = playersvipplus.get(0);         else if (playersvip.size() > 0)             dothis = playersvip.get(0);         else dothis = players.get(0);          bukkit.getplayer(playersent.getname()).sendmessage("§4[§6reviewplugin§4] §ethis review §b" + dothis.getname());         bukkit.getplayer(playersent.getname()).teleport(dothis.getlocation());         reviewsmember.remove(dothis);         if (reviewsmember.size() > 1)             bukkit.getplayer(playersent.getname()).sendmessage("§4[§6reviewplugin§4] §ethere " + reviewsmember.size() + " member reviews left do.");         else if (reviewsmember.size() == 1)             bukkit.getplayer(playersent.getname()).sendmessage("§4[§6reviewplugin§4] §ethere " + reviewsmember.size() + " member review left do.");         else             bukkit.getplayer(playersent.getname()).sendmessage("§4[§6reviewplugin§4] §ethere no more member reviews @ time!");     }     else {         bukkit.getplayer(playersent.getname()).sendmessage("§4[§6reviewplugin§4] §ethere no more member reviews @ time!");     } } 

the index out of bounds error occurring in loop, have no idea going wrong. tested w/o error on windows 8 machine when implemented linux failed every time index out of bounds error.

the above code cannot fail unless background thread modifies array in middle of loop. reason problem.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -