SteamWar/SpigotCore
Archiviert
13
0

Move tick call responsibility to EntityServer owner
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
Lixfel 2023-01-15 11:07:21 +01:00
Ursprung 81a77fd1de
Commit c340f11666

Datei anzeigen

@ -29,7 +29,6 @@ import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.scheduler.BukkitTask;
import java.util.HashMap;
import java.util.HashSet;
@ -46,11 +45,8 @@ public class REntityServer implements Listener {
private final HashMap<Long, HashSet<Player>> players = new HashMap<>();
private final HashMap<Player, Location> lastLocation = new HashMap<>();
private final BukkitTask tickTask;
public REntityServer() {
Core.getInstance().getServer().getPluginManager().registerEvents(this, Core.getInstance());
tickTask = Core.getInstance().getServer().getScheduler().runTaskTimer(Core.getInstance(), this::tick, 1, 1);
}
public void addPlayer(Player player) {
@ -68,7 +64,6 @@ public class REntityServer implements Listener {
for(Player player : lastLocation.keySet().toArray(new Player[0])) {
removePlayer(player);
}
tickTask.cancel();
HandlerList.unregisterAll(this);
}
@ -186,7 +181,7 @@ public class REntityServer implements Listener {
}
}
private void tick() {
public void tick() {
for(HashSet<REntity> entitiesInChunk : entities.values()) {
for(REntity entity : entitiesInChunk) {
entity.tick();