forked from MagicBane/Server
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.5 KiB
45 lines
1.5 KiB
1 year ago
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||
|
// Magicbane Emulator Project © 2013 - 2022
|
||
|
// www.magicbane.com
|
||
|
|
||
|
|
||
|
package engine.mobileAI.Threads;
|
||
|
import engine.objects.Mob;
|
||
|
import org.pmw.tinylog.Logger;
|
||
|
|
||
|
import java.util.concurrent.BlockingQueue;
|
||
|
import java.util.concurrent.DelayQueue;
|
||
|
|
||
|
public enum Respawner implements Runnable {
|
||
|
Respawner;
|
||
|
|
||
|
public static BlockingQueue<Mob> respawnQueue = new DelayQueue();
|
||
|
|
||
|
@Override
|
||
|
public void run() {
|
||
|
|
||
|
while (true) {
|
||
|
|
||
|
try {
|
||
|
Mob mobile = respawnQueue.take();
|
||
|
mobile.respawn();
|
||
|
} catch (InterruptedException e) {
|
||
|
Logger.error(e.toString());
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
public static void startRespawnThread() {
|
||
|
Thread respawnThread;
|
||
|
respawnThread = new Thread(Respawner);
|
||
|
respawnThread.setName("respawnThread");
|
||
|
respawnThread.start();
|
||
|
}
|
||
|
}
|