Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Held Slot handler #430

Closed
wants to merge 2 commits into from
Closed

Conversation

CiviledCode
Copy link
Contributor

  • Removed session.UpdateHeldSlot
  • Added player.SetHeldSlot
  • Added HeldSlotChange to handler

- Removed session.UpdateHeldSlot
- Added player.SetHeldSlot
- Added HeldSlotChange to handler
// is the correct item.
// This invokes the HandleHeldSlotChange handler.
func (p *Player) SetHeldSlot(slot int, expected item.Stack) error {
if slot > 8 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why'd you remove all the documentation for this method?

actual, _ := p.inv.Item(slot)

if !clientSideItem.Equal(actual) {
return fmt.Errorf("client side item isn't equal to expected slot item")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code no longer belongs here now that it's a player method, should be moved to packet handling (check a0bb8dd).

return nil
}

p.ReleaseItem()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just set (Player).usingItem to false here.

// SetHeldSlot updates the held slot of the player with the slot passed. It also verifies that the item within the spot
// is the correct item.
// This invokes the HandleHeldSlotChange handler.
func (p *Player) SetHeldSlot(slot int, expected item.Stack) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing an expected item stack no longer makes sense here, should be removed.

@@ -367,6 +368,37 @@ func (p *Player) Transfer(address string) (err error) {
return
}

// SetHeldSlot updates the held slot of the player with the slot passed. It also verifies that the item within the spot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should remove the middle sentence in this doc.

@JustTalDevelops JustTalDevelops added feature New feature or request awaiting response More information is required to resolve and/or close the issue labels Jul 14, 2022
@JustTalDevelops
Copy link
Member

Any update on this?

@CiviledCode CiviledCode deleted the slot_handler branch July 20, 2022 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting response More information is required to resolve and/or close the issue feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants