From c340f11666bb5b85b43196e5c35c164913bb95d7 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 15 Jan 2023 11:07:21 +0100 Subject: [PATCH] Move tick call responsibility to EntityServer owner --- SpigotCore_Main/src/de/steamwar/entity/REntityServer.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/entity/REntityServer.java b/SpigotCore_Main/src/de/steamwar/entity/REntityServer.java index 3a63b41..2ffdcab 100644 --- a/SpigotCore_Main/src/de/steamwar/entity/REntityServer.java +++ b/SpigotCore_Main/src/de/steamwar/entity/REntityServer.java @@ -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> players = new HashMap<>(); private final HashMap 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 entitiesInChunk : entities.values()) { for(REntity entity : entitiesInChunk) { entity.tick();