mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-05-24 10:39:50 +08:00
Call checkSpawns from World instead of from Player
This commit is contained in:
@@ -37,6 +37,7 @@ import emu.grasscutter.server.packet.send.PacketWorldPlayerInfoNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketWorldPlayerRTTNotify;
|
||||
import emu.grasscutter.utils.Position;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
public class World implements Iterable<GenshinPlayer> {
|
||||
@@ -58,11 +59,13 @@ public class World implements Iterable<GenshinPlayer> {
|
||||
public World(GenshinPlayer player, boolean isMultiplayer) {
|
||||
this.owner = player;
|
||||
this.players = Collections.synchronizedList(new ArrayList<>());
|
||||
this.scenes = new Int2ObjectOpenHashMap<>();
|
||||
this.scenes = Int2ObjectMaps.synchronize(new Int2ObjectOpenHashMap<>());
|
||||
|
||||
this.levelEntityId = getNextEntityId(EntityIdType.MPLEVEL);
|
||||
this.worldLevel = player.getWorldLevel();
|
||||
this.isMultiplayer = isMultiplayer;
|
||||
|
||||
this.owner.getServer().registerWorld(this);
|
||||
}
|
||||
|
||||
public GenshinPlayer getHost() {
|
||||
@@ -273,6 +276,12 @@ public class World implements Iterable<GenshinPlayer> {
|
||||
}
|
||||
}
|
||||
|
||||
public void onTick() {
|
||||
for (GenshinScene scene : this.getScenes().values()) {
|
||||
scene.onTick();
|
||||
}
|
||||
}
|
||||
|
||||
public void close() {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user