Skip to content

Commit

Permalink
player/handler.go: Pass player to HandleWorldChange.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandertv committed Dec 24, 2024
1 parent c6641ba commit 689724a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions server/player/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Handler interface {
// HandleTeleport handles the teleportation of a player. ctx.Cancel() may be called to cancel it.
HandleTeleport(ctx *Context, pos mgl64.Vec3)
// HandleChangeWorld handles when the player is added to a new world. before may be nil.
HandleChangeWorld(before, after *world.World)
HandleChangeWorld(p *Player, before, after *world.World)
// HandleToggleSprint handles when the player starts or stops sprinting.
// After is true if the player is sprinting after toggling (changing their sprinting state).
HandleToggleSprint(ctx *Context, after bool)
Expand Down Expand Up @@ -166,7 +166,7 @@ func (NopHandler) HandleHeldSlotChange(*Context, int, int)
func (NopHandler) HandleMove(*Context, mgl64.Vec3, cube.Rotation) {}
func (NopHandler) HandleJump(*Player) {}
func (NopHandler) HandleTeleport(*Context, mgl64.Vec3) {}
func (NopHandler) HandleChangeWorld(*world.World, *world.World) {}
func (NopHandler) HandleChangeWorld(*Player, *world.World, *world.World) {}
func (NopHandler) HandleToggleSprint(*Context, bool) {}
func (NopHandler) HandleToggleSneak(*Context, bool) {}
func (NopHandler) HandleCommandExecution(*Context, cmd.Command, []string) {}
Expand Down
2 changes: 1 addition & 1 deletion server/player/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -2355,7 +2355,7 @@ func (p *Player) Tick(tx *world.Tx, current int64) {
}

if p.prevWorld != tx.World() && p.prevWorld != nil {
p.Handler().HandleChangeWorld(p.prevWorld, tx.World())
p.Handler().HandleChangeWorld(p, p.prevWorld, tx.World())
p.prevWorld = tx.World()
}

Expand Down

0 comments on commit 689724a

Please sign in to comment.