mirror of
https://github.com/Anime-Game-Servers/AGSLunarCore.git
synced 2024-12-02 09:16:24 +00:00
Kick and save connected players if the server crashes or shuts down
This commit is contained in:
parent
c43a86be70
commit
d2b08b00be
@ -1,6 +1,8 @@
|
||||
package emu.lunarcore.server.game;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import emu.lunarcore.Config.GameServerConfig;
|
||||
import emu.lunarcore.LunarRail;
|
||||
@ -94,5 +96,13 @@ public class GameServer extends KcpServer {
|
||||
// Set region info
|
||||
this.info.setUp(false);
|
||||
this.info.save();
|
||||
|
||||
// Kick and save all players
|
||||
List<Player> list = new ArrayList<>(players.size());
|
||||
list.addAll(players.values());
|
||||
|
||||
for (Player player : list) {
|
||||
player.getSession().close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user