forked from MagicBane/Server
MagicBot
8 months ago
3 changed files with 60 additions and 30 deletions
@ -0,0 +1,59 @@ |
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.net.client.handlers; |
||||||
|
|
||||||
|
import engine.Enum.DispatchChannel; |
||||||
|
import engine.exception.MsgSendException; |
||||||
|
import engine.gameManager.BuildingManager; |
||||||
|
import engine.gameManager.SessionManager; |
||||||
|
import engine.net.Dispatch; |
||||||
|
import engine.net.DispatchMessage; |
||||||
|
import engine.net.client.ClientConnection; |
||||||
|
import engine.net.client.msg.ClientNetMsg; |
||||||
|
import engine.net.client.msg.GuildTreeStatusMsg; |
||||||
|
import engine.objects.Building; |
||||||
|
import engine.objects.PlayerCharacter; |
||||||
|
|
||||||
|
public class GuildTreeStatusMsgHandler extends AbstractClientMsgHandler { |
||||||
|
|
||||||
|
public GuildTreeStatusMsgHandler() { |
||||||
|
super(GuildTreeStatusMsg.class); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { |
||||||
|
|
||||||
|
GuildTreeStatusMsg msg = (GuildTreeStatusMsg) baseMsg; |
||||||
|
|
||||||
|
PlayerCharacter player = SessionManager.getPlayerCharacter(origin); |
||||||
|
|
||||||
|
Dispatch dispatch; |
||||||
|
|
||||||
|
if (player == null) |
||||||
|
return true; |
||||||
|
|
||||||
|
if (origin.guildtreespam > System.currentTimeMillis()) |
||||||
|
return true; |
||||||
|
|
||||||
|
origin.guildtreespam = System.currentTimeMillis() + 5000; |
||||||
|
|
||||||
|
Building building = BuildingManager.getBuildingFromCache(msg.getTargetID()); |
||||||
|
|
||||||
|
if (building == null) |
||||||
|
return true; |
||||||
|
|
||||||
|
GuildTreeStatusMsg guildTreeStatusMsg = new GuildTreeStatusMsg(building, player); |
||||||
|
guildTreeStatusMsg.configure(); |
||||||
|
|
||||||
|
dispatch = Dispatch.borrow(player, guildTreeStatusMsg); |
||||||
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue