Methods moved out of message pump
This commit is contained in:
@@ -8,10 +8,15 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.ItemFromVaultMsg;
|
||||
import engine.net.client.msg.ItemToVaultMsg;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class ItemFromVaultMsgHandler extends AbstractClientMsgHandler {
|
||||
@@ -20,6 +25,22 @@ public class ItemFromVaultMsgHandler extends AbstractClientMsgHandler {
|
||||
super(ItemFromVaultMsg.class);
|
||||
}
|
||||
|
||||
//call this if the transfer fails server side to kick the item back to inventory from vault
|
||||
public static void forceTransferFromInventoryToVault(ItemFromVaultMsg msg, ClientConnection origin, String reason) {
|
||||
|
||||
PlayerCharacter player = origin.getPlayerCharacter();
|
||||
Dispatch dispatch;
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
ItemToVaultMsg back = new ItemToVaultMsg(msg);
|
||||
dispatch = Dispatch.borrow(player, back);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
|
||||
ChatManager.chatInfoError(player, "Can't transfer to inventory: " + reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user