df-mc / dragonfly

Minecraft Bedrock Edition server software written in Go
https://discord.gg/U4kFWHhTNR
MIT License
679 stars 140 forks source link

Keep Inventory #684

Closed uramnoil closed 2 years ago

uramnoil commented 2 years ago

I would like to control dropContent in Player#kill() when a player dies. I think it is appropriate to add the flag to HandleDeath() like:

func (h *MyHandler) HandleDeath(drop *bool, src world.DamageSource) {}
Endermanbugzjfc commented 2 years ago

I would like to control dropContent in Player#kill() when a player dies. I think it is appropriate to add the flag to HandleDeath() like:

func (h *MyHandler) HandleDeath(drop *bool, src world.DamageSource) {}

Would it work if you updated the inventory during this event?

Sandertv commented 2 years ago

I think a bool like this would make sense. Would probably put it after the src parameter and call it keepInventory or so.

uramnoil commented 2 years ago

I would like to control dropContent in Player#kill() when a player dies. I think it is appropriate to add the flag to HandleDeath() like:

func (h *MyHandler) HandleDeath(drop *bool, src world.DamageSource) {}

Would it work if you updated the inventory during this event?

The inventory change was not a problem. I will push my code soon.

uramnoil commented 2 years ago

I think a bool like this would make sense. Would probably put it after the src parameter and call it keepInventory or so.

Could keepInventory be abbreviated to keepInv or something?

Sandertv commented 2 years ago

Sure, that works.