mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-19 02:15:45 +01:00
Refactoring (#1660)
* Refactor a couple of iterators * Use side-effect instead of second iterator * Make World::onTick return shouldDelete instead of success * Replace Shop iterator with side effects * Scene * Clean up Expeditions * Refactor Expeditions * Clean up Expeditions, Player * Limit Expeditions by AR * Lombokify props Co-authored-by: AnimeGitB <AnimeGitB@bigblueball.in>
This commit is contained in:
@@ -218,21 +218,10 @@ public final class GameServer extends KcpServer {
|
||||
var tickStart = Instant.now();
|
||||
|
||||
// Tick worlds.
|
||||
Iterator<World> it = this.getWorlds().iterator();
|
||||
while (it.hasNext()) {
|
||||
World world = it.next();
|
||||
|
||||
if (world.getPlayerCount() == 0) {
|
||||
it.remove();
|
||||
}
|
||||
|
||||
world.onTick();
|
||||
}
|
||||
this.worlds.removeIf(World::onTick);
|
||||
|
||||
// Tick players.
|
||||
for (Player player : this.getPlayers().values()) {
|
||||
player.onTick();
|
||||
}
|
||||
this.players.values().forEach(Player::onTick);
|
||||
|
||||
// Tick scheduler.
|
||||
this.getScheduler().runTasks();
|
||||
|
||||
Reference in New Issue
Block a user