forked from MagicBane/Server
Handler created for WhoRequestMsg
This commit is contained in:
@@ -52,27 +52,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
this.server = server;
|
this.server = server;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Incoming client protocol message are processed here
|
|
||||||
*/
|
|
||||||
|
|
||||||
private static void WhoRequest(WhoRequestMsg msg, ClientConnection origin) {
|
|
||||||
|
|
||||||
// Handle /who request
|
|
||||||
PlayerCharacter pc = origin.getPlayerCharacter();
|
|
||||||
|
|
||||||
if (pc == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (pc.getTimeStamp("WHO") > System.currentTimeMillis()) {
|
|
||||||
ErrorPopupMsg.sendErrorMsg(pc, "Who too fast! Please wait 3 seconds.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
WhoResponseMsg.HandleResponse(msg.getSet(), msg.getFilterType(), msg.getFilter(), origin);
|
|
||||||
pc.getTimestamps().put("WHO", System.currentTimeMillis() + 3000);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void toggleLfgRecruiting(ToggleLfgRecruitingMsg msg, ClientConnection origin) throws MsgSendException {
|
private static void toggleLfgRecruiting(ToggleLfgRecruitingMsg msg, ClientConnection origin) throws MsgSendException {
|
||||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||||
if (pc == null)
|
if (pc == null)
|
||||||
@@ -844,9 +823,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
break;
|
break;
|
||||||
case OPENVAULT:
|
case OPENVAULT:
|
||||||
break;
|
break;
|
||||||
case WHOREQUEST:
|
|
||||||
WhoRequest((WhoRequestMsg) msg, origin);
|
|
||||||
break;
|
|
||||||
case CLIENTADMINCOMMAND:
|
case CLIENTADMINCOMMAND:
|
||||||
ChatManager.HandleClientAdminCmd((ClientAdminCommandMsg) msg, origin);
|
ChatManager.HandleClientAdminCmd((ClientAdminCommandMsg) msg, origin);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ public enum Protocol {
|
|||||||
VIEWRESOURCES(0xCEFD0346, ViewResourcesMessage.class, null),
|
VIEWRESOURCES(0xCEFD0346, ViewResourcesMessage.class, null),
|
||||||
VISUALUPDATE(0x33402fd2, null, null),
|
VISUALUPDATE(0x33402fd2, null, null),
|
||||||
WEIGHTINVENTORY(0xF1B6A85C, LootWindowResponseMsg.class, null), // MoveObjectToContainer Window Response
|
WEIGHTINVENTORY(0xF1B6A85C, LootWindowResponseMsg.class, null), // MoveObjectToContainer Window Response
|
||||||
WHOREQUEST(0xF431CCE9, WhoRequestMsg.class, null), // Request /who
|
WHOREQUEST(0xF431CCE9, WhoRequestMsg.class, WhoRequestMsgHandler.class), // Request /who
|
||||||
WHORESPONSE(0xD7C36568, WhoResponseMsg.class, null), // Response /who
|
WHORESPONSE(0xD7C36568, WhoResponseMsg.class, null), // Response /who
|
||||||
REQUESTBALLLIST(0xE366FF64, RequestBallListMessage.class, RequestBallListHandler.class),
|
REQUESTBALLLIST(0xE366FF64, RequestBallListMessage.class, RequestBallListHandler.class),
|
||||||
SENDBALLENTRY(0xAC2B5EDC, SendBallEntryMessage.class, SendBallEntryHandler.class),
|
SENDBALLENTRY(0xAC2B5EDC, SendBallEntryMessage.class, SendBallEntryHandler.class),
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.net.client.handlers;
|
||||||
|
|
||||||
|
import engine.exception.MsgSendException;
|
||||||
|
import engine.net.client.ClientConnection;
|
||||||
|
import engine.net.client.msg.ClientNetMsg;
|
||||||
|
import engine.net.client.msg.ErrorPopupMsg;
|
||||||
|
import engine.net.client.msg.WhoRequestMsg;
|
||||||
|
import engine.net.client.msg.WhoResponseMsg;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
|
public class WhoRequestMsgHandler extends AbstractClientMsgHandler {
|
||||||
|
|
||||||
|
public WhoRequestMsgHandler() {
|
||||||
|
super(WhoRequestMsg.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||||
|
|
||||||
|
|
||||||
|
WhoRequestMsg msg = (WhoRequestMsg) baseMsg;
|
||||||
|
|
||||||
|
// Handle /who request
|
||||||
|
PlayerCharacter player = origin.getPlayerCharacter();
|
||||||
|
|
||||||
|
if (player == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (player.getTimeStamp("WHO") > System.currentTimeMillis()) {
|
||||||
|
ErrorPopupMsg.sendErrorMsg(player, "Who too fast! Please wait 3 seconds.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
WhoResponseMsg.HandleResponse(msg.getSet(), msg.getFilterType(), msg.getFilter(), origin);
|
||||||
|
player.getTimestamps().put("WHO", System.currentTimeMillis() + 3000);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user