forked from MagicBane/Server
Respawn thread configured
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user