From 689724ae7ffcbeba5150c1d75ad77d2ca0c9dbba Mon Sep 17 00:00:00 2001 From: Sandertv Date: Tue, 24 Dec 2024 13:29:54 +0100 Subject: [PATCH] player/handler.go: Pass player to HandleWorldChange. --- server/player/handler.go | 4 ++-- server/player/player.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/player/handler.go b/server/player/handler.go index c0abc94e3..6631c6cc1 100644 --- a/server/player/handler.go +++ b/server/player/handler.go @@ -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) @@ -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) {} diff --git a/server/player/player.go b/server/player/player.go index 398a3927f..d93f846a5 100644 --- a/server/player/player.go +++ b/server/player/player.go @@ -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() }