Posted March 1, 20169 yr ////////Getting All Player ////////////// ArrayList<EntityPlayerMP> AllPlayer = new ArrayList<EntityPlayerMP>(); ListIterator itl; for(int i = 0; i<MinecraftServer.getServer().worldServers.length; i++) { itl = MinecraftServer.getServer().worldServers[i].playerEntities.listIterator(); while(itl.hasNext()) AllPlayer.add((EntityPlayerMP)itl.next()); } ////////////////////////////////////////// //// IgameInfo.Player is Custom EntityPlayerMP Array List. /////// IGameInfo.Player.clear(); // Cleary for(int i=0; i<AllPlayer.size(); i++) { //↓This code Error.. CustomPlayer player = new CustomPlayer(MinecraftServer.getServer().worldServers[i], AllPlayer.get(i).getGameProfile()); IGameInfo.Player.add(player); } CustomPlayer Code. public class CustomPlayer extends EntityPlayerMP { public enum JOB { Detective,JoblessPerson,Police,Cleaner,Army,Programmer,secretary } //직업을 설정한다. public JOB job; // 살인마인지 아닌지를 체크한다. public boolean isKiller; public CustomPlayer(WorldServer world, GameProfile name) { super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new ItemInWorldManager(world)); } } Error message at IGame.Command.IGameStart.SetIGamePlayerList(IGameStart.java:103) ~[iGameStart.class:?] at IGame.Command.IGameStart.processCommand(IGameStart.java:124) ~[iGameStart.class:?] at net.minecraft.command.CommandHandler.executeCommand(CommandHandler.java:96) [CommandHandler.class:?] at net.minecraft.network.NetHandlerPlayServer.handleSlashCommand(NetHandlerPlayServer.java:788) [NetHandlerPlayServer.class:?] at net.minecraft.network.NetHandlerPlayServer.processChatMessage(NetHandlerPlayServer.java:764) [NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C01PacketChatMessage.processPacket(C01PacketChatMessage.java:47) [C01PacketChatMessage.class:?] at net.minecraft.network.play.client.C01PacketChatMessage.processPacket(C01PacketChatMessage.java:68) [C01PacketChatMessage.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] sorry i can't english very well.. This code working 3 or less player... but, If my server players 4 or more player than print error message what problem.. ?
March 1, 20169 yr You're using the index in the AllPlayers list as the index for the worldServers array. worldServers contains the WorldServer instance for each dimension. Vanilla only has three dimensions, so once you try to create more than three CustomPlayer s you're using an invalid index. I'd suggest using for-each/enhanced for loops instead of for / while loops here. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.