Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted


////////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.. :)?

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.