RuneHive-Game
Loading...
Searching...
No Matches
NpcPreUpdateTask.java
Go to the documentation of this file.
1package com.runehive.game.engine.sync.task;
2
3import com.runehive.game.world.entity.mob.npc.Npc;
4import org.apache.logging.log4j.LogManager;
5import org.apache.logging.log4j.Logger;
6
7public final class NpcPreUpdateTask extends SynchronizationTask {
8
9 private static final Logger logger = LogManager.getLogger(NpcPreUpdateTask.class);
10
11 private final Npc npc;
12
14 this.npc = npc;
15 }
16
17 @Override
18 public void run() {
19 try {
20 if (npc.atomicPlayerCount.get() == 0) {
21 return;
22 }
23
24 if (npc.regionChange) {
25 npc.lastPosition = npc.getPosition();
26 }
27
28 npc.movement.processNextMovement();
29 } catch (Exception ex) {
30 logger.fatal(String.format("Error in %s. %s", NpcPreUpdateTask.class.getSimpleName(), npc), ex);
31 }
32 }
33
34}
Represents a non-player character in the in-game world.
Definition Npc.java:29