SteamWar/SpigotCore
Archiviert
13
0

CoreEntity #220

Zusammengeführt
Lixfel hat 10 Commits von coreEntity nach master 2023-01-15 11:56:30 +01:00 zusammengeführt
Nur Änderungen aus Commit c340f11666 werden angezeigt - Alle Commits anzeigen

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();