forked from MagicBane/Server
MagicBot
8 months ago
5 changed files with 69 additions and 34 deletions
@ -0,0 +1,61 @@
@@ -0,0 +1,61 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
package engine.net.client.handlers; |
||||
|
||||
import engine.exception.MsgSendException; |
||||
import engine.job.JobContainer; |
||||
import engine.job.JobScheduler; |
||||
import engine.jobs.StuckJob; |
||||
import engine.net.client.ClientConnection; |
||||
import engine.net.client.msg.ClientNetMsg; |
||||
import engine.net.client.msg.StuckMsg; |
||||
import engine.objects.PlayerCharacter; |
||||
|
||||
import java.util.concurrent.ConcurrentHashMap; |
||||
|
||||
public class StuckMsgHandler extends AbstractClientMsgHandler { |
||||
|
||||
public StuckMsgHandler() { |
||||
super(StuckMsg.class); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { |
||||
|
||||
PlayerCharacter playerCharacter = origin.getPlayerCharacter(); |
||||
|
||||
// Member variable declaration
|
||||
|
||||
StuckMsg msg; |
||||
|
||||
// Member variable assignment
|
||||
|
||||
msg = (StuckMsg) baseMsg; |
||||
|
||||
if (playerCharacter == null) |
||||
return true; |
||||
|
||||
if (playerCharacter.getTimers().containsKey("Stuck")) |
||||
return true; |
||||
|
||||
StuckJob sj = new StuckJob(playerCharacter); |
||||
JobContainer jc = JobScheduler.getInstance().scheduleJob(sj, 10000); // Convert
|
||||
ConcurrentHashMap<String, JobContainer> timers = playerCharacter.getTimers(); |
||||
|
||||
if (timers != null) { |
||||
if (timers.containsKey("Stuck")) { |
||||
timers.get("Stuck").cancelJob(); |
||||
timers.remove("Stuck"); |
||||
} |
||||
timers.put("Stuck", jc); |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue