forked from MagicBane/Server
revert mob ai
This commit is contained in:
@@ -28,26 +28,25 @@ public class MobAIThread implements Runnable{
|
|||||||
AI_CAST_FREQUENCY = Float.parseFloat(ConfigManager.MB_AI_CAST_FREQUENCY.getValue());
|
AI_CAST_FREQUENCY = Float.parseFloat(ConfigManager.MB_AI_CAST_FREQUENCY.getValue());
|
||||||
AI_BASE_AGGRO_RANGE = (int)(60 * Float.parseFloat(ConfigManager.MB_AI_AGGRO_RANGE.getValue()));
|
AI_BASE_AGGRO_RANGE = (int)(60 * Float.parseFloat(ConfigManager.MB_AI_AGGRO_RANGE.getValue()));
|
||||||
while (true) {
|
while (true) {
|
||||||
for (Zone zone : ZoneManager.getAllZones()) {
|
try {
|
||||||
if (zone != null && zone.zoneMobSet != null) {
|
for (Zone zone : ZoneManager.getAllZones()) {
|
||||||
synchronized (zone.zoneMobSet) {
|
if (zone != null && zone.zoneMobSet != null) {
|
||||||
for (Mob mob : zone.zoneMobSet) {
|
synchronized (zone.zoneMobSet) {
|
||||||
try {
|
for (Mob mob : zone.zoneMobSet) {
|
||||||
if (mob != null) {
|
try {
|
||||||
MobAI.DetermineAction(mob);
|
if (mob != null) {
|
||||||
|
MobAI.DetermineAction(mob);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error("Error processing Mob [Name: {}, UUID: {}]", mob.getName(), mob.getObjectUUID(), e);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error("Error processing Mob [Name: {}, UUID: {}]", mob.getName(), mob.getObjectUUID(), e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
try {
|
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
} catch (InterruptedException e) {
|
}catch(Exception e){
|
||||||
Logger.error("AI Thread interrupted", e);
|
Logger.error(e.getMessage());
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class BaneThread implements Runnable {
|
|||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
BaneManager.pulse_banes();
|
BaneManager.pulse_banes();
|
||||||
Thread.sleep(100); // Pause for 100ms to reduce CPU usage
|
Thread.sleep(1000); // Pause for 100ms to reduce CPU usage
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Logger.error("Thread interrupted", e);
|
Logger.error("Thread interrupted", e);
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
|
|||||||
Reference in New Issue
Block a user