Handler created for StuckMsg
This commit is contained in:
@@ -9,7 +9,10 @@
|
||||
|
||||
package engine.net.client;
|
||||
|
||||
import engine.gameManager.*;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.gameManager.TradeManager;
|
||||
import engine.net.NetMsgHandler;
|
||||
import engine.net.client.handlers.AbstractClientMsgHandler;
|
||||
import engine.net.client.msg.*;
|
||||
@@ -138,9 +141,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
case ARCTRACKINGLIST:
|
||||
PowersManager.trackWindow((TrackWindowMsg) msg, origin);
|
||||
break;
|
||||
case STUCK:
|
||||
MovementManager.stuck(origin);
|
||||
break;
|
||||
case CHANNELMUTE:
|
||||
break;
|
||||
case KEEPALIVESERVERCLIENT:
|
||||
|
||||
@@ -200,7 +200,7 @@ public enum Protocol {
|
||||
SHOWVAULTINVENTORY(0xD1FB4842, null, null), // Show Vault Inventory
|
||||
SOCIALCHANNEL(0x2BF58FA6, SocialMsg.class, SocialMsgHandler.class), // Socials
|
||||
STANDARDALERT(0xFA0A24BB, ErrorPopupMsg.class, null), //Popup messages
|
||||
STUCK(0x3D04AF3A, StuckCommandMsg.class, null), // /Stuck Command
|
||||
STUCK(0x3D04AF3A, StuckMsg.class, StuckMsgHandler.class), // /Stuck Command
|
||||
SWEARINGUILD(0x389B66B1, SwearInGuildMsg.class, SwearInGuildHandler.class),
|
||||
SYNC(0x49ec109f, null, null), //Client/Server loc sync
|
||||
SYSTEMBROADCASTCHANNEL(0x2FAD89D1, ChatSystemMsg.class, null), // Chat Channel: System Message
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -16,12 +16,12 @@ import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class StuckCommandMsg extends ClientNetMsg {
|
||||
public class StuckMsg extends ClientNetMsg {
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public StuckCommandMsg() {
|
||||
public StuckMsg() {
|
||||
super(Protocol.STUCK);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class StuckCommandMsg extends ClientNetMsg {
|
||||
* past the limit) then this constructor Throws that Exception to the
|
||||
* caller.
|
||||
*/
|
||||
public StuckCommandMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
public StuckMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.STUCK, origin, reader);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user