Browse Source

Merge pull request #3 from Robotia/patch-1

Restart Command avoid ConcurrentModification
master
Yive 9 years ago
parent
commit
a23b9b5a27
  1. 11
      src/main/java/org/spigotmc/RestartCommand.java

11
src/main/java/org/spigotmc/RestartCommand.java

@ -41,10 +41,15 @@ public class RestartCommand extends Command
System.out.println( "Attempting to restart with " + SpigotConfig.restartScript ); System.out.println( "Attempting to restart with " + SpigotConfig.restartScript );
// Kick all players // Kick all players
for ( net.minecraft.entity.player.EntityPlayerMP p : (List< net.minecraft.entity.player.EntityPlayerMP>) net.minecraft.server.MinecraftServer.getServer().getConfigurationManager().playerEntityList ) for ( Object p : net.minecraft.server.MinecraftServer.getServer().getConfigurationManager().playerEntityList.toArray() )
{ {
p.playerNetServerHandler.kickPlayerFromServer(SpigotConfig.restartMessage); if(p instanceof net.minecraft.entity.player.EntityPlayerMP)
p.playerNetServerHandler.netManager.isChannelOpen(); {
net.minecraft.entity.player.EntityPlayerMP mp = ( net.minecraft.entity.player.EntityPlayerMP)p;
mp.playerNetServerHandler.kickPlayerFromServer(SpigotConfig.restartMessage);
mp.playerNetServerHandler.netManager.isChannelOpen();
}
} }
// Give the socket a chance to send the packets // Give the socket a chance to send the packets
try try

Loading…
Cancel
Save