You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the HandlePlace event is cancelled, and the item in the slot is set to air, the client still has the item in their inventory, but on server side it is still there.
Code:
func (i *InventoryHandler) HandlePlace(ctx *event.Context, slot int, it item.Stack) {
_, err := i.p.Inventory().Item(slot)
if err != nil {
return
}
ctx.Cancel()
fmt.Println("hello")
i.p.Inventory().SetItem(slot, item.Stack{})
}
If the HandlePlace event is cancelled, and the item in the slot is set to air, the client still has the item in their inventory, but on server side it is still there.
Code:
func (i *InventoryHandler) HandlePlace(ctx *event.Context, slot int, it item.Stack) {
_, err := i.p.Inventory().Item(slot)
if err != nil {
return
}
ctx.Cancel()
fmt.Println("hello")
i.p.Inventory().SetItem(slot, item.Stack{})
}
Video example: https://streamable.com/x62xwv
The text was updated successfully, but these errors were encountered: