Skip to content

Commit f8ab21a

Browse files
committed
Fixing item swapping and moving functionality
1 parent 88d1798 commit f8ab21a

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/game-engine/world/action/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export class ActionPipeline {
143143
}
144144

145145
private async runActionHandler(actionHandler: any, ...args: any[]): Promise<void> {
146-
const runnableHooks: RunnableHooks | null | undefined = actionHandler(...args);
146+
const runnableHooks: RunnableHooks | null | undefined = await actionHandler(...args);
147147

148148
if(!runnableHooks?.hooks || runnableHooks.hooks.length === 0) {
149149
return;

src/game-engine/world/action/item-swap.action.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ export interface ItemSwapAction {
4343
* @param toSlot
4444
* @param widget
4545
*/
46-
const itemSwapActionPipe = async (player: Player, fromSlot: number, toSlot: number, widget: {
47-
widgetId: number; containerId: number; }): Promise<RunnableHooks<ItemSwapAction>> => {
46+
const itemSwapActionPipe = (player: Player, fromSlot: number, toSlot: number,
47+
widget: { widgetId: number; containerId: number; }): RunnableHooks<ItemSwapAction> => {
4848
const matchingHooks = getActionHooks<ItemSwapActionHook>('item_swap')
4949
.filter(plugin => numberHookFilter(plugin.widgetId || plugin.widgetIds, widget.widgetId));
5050

5151
if(!matchingHooks || matchingHooks.length === 0) {
52-
await player.sendMessage(`Unhandled Swap Items action: widget[${widget.widgetId}] container[${widget.containerId}] fromSlot[${fromSlot} toSlot${toSlot}`);
52+
player.sendMessage(`Unhandled Swap Items action: widget[${widget.widgetId}] container[${widget.containerId}] fromSlot[${fromSlot} toSlot${toSlot}`);
5353
return null;
5454
}
5555

src/game-engine/world/action/move-item.action.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ export interface MoveItemAction {
4444
* @param toSlot
4545
* @param widget
4646
*/
47-
const moveItemActionPipe = async (player: Player, fromSlot: number, toSlot: number,
48-
widget: { widgetId: number, containerId: number }): Promise<RunnableHooks<MoveItemAction>> => {
47+
const moveItemActionPipe = (player: Player, fromSlot: number, toSlot: number,
48+
widget: { widgetId: number, containerId: number }): RunnableHooks<MoveItemAction> => {
4949
const matchingHooks = getActionHooks<MoveItemActionHook>('move_item')
5050
.filter(plugin => numberHookFilter(plugin.widgetId || plugin.widgetIds, widget.widgetId));
5151

5252
if(!matchingHooks || matchingHooks.length === 0) {
53-
await player.sendMessage(`Unhandled Move Item action: widget[${widget.widgetId}] container[${widget.containerId}] fromSlot[${fromSlot} toSlot${toSlot}`);
53+
player.sendMessage(`Unhandled Move Item action: widget[${widget.widgetId}] container[${widget.containerId}] fromSlot[${fromSlot} toSlot${toSlot}`);
5454
return null;
5555
}
5656

0 commit comments

Comments
 (0)