Commit Graph

7 Commits

Author SHA1 Message Date
SmallJoker 32f68f35cf
Avoid packets getting sent to disconnected players (#14444)
Many functions expect RemotePlayer to have a valid peer ID,
this however is not the case immediately after disconnecting
where the object is still alive and pending for removal.

ServerEnvironment::getPlayer(const char *, bool) now only
returns players that are connected unless forced to.
2024-03-10 13:24:35 +01:00
Desour 1b51ff333a Use unique_ptr for ServerInventoryManager::DetachedInventory::inventory 2023-06-05 20:43:33 +02:00
Jude Melton-Houghton 7701e70dc9 Make MapEditEvent more complete
SetBlocksNotSent is no longer used.
2022-12-24 08:24:59 -05:00
SmallJoker d33ab97434 Inventory: Add ServerEnv checks for calls during script init
This fixes 'minetest.get_inventory' calls to players or nodes during the load phase.
2022-01-04 18:39:27 +01:00
SmallJoker b93bbfde2c Script API: Fix segfault in remove_detached_inventory
when minetest.remove_detached_inventory is called on script init, the environment is yet not set up,
hence m_env is still nullptr until all scripts are loaded
2021-07-10 14:34:36 +02:00
SmallJoker fc864029b9 Protect per-player detached inventory actions 2021-03-07 17:18:02 +01:00
Loïc Blot 454dbf83a9
Server class code cleanups (#9769)
* Server::overrideDayNightRatio doesn't require to return bool
There is no sense to sending null player, the caller should send a valid object

* Server::init: make private & cleanup
This function is always called before start() and loads some variables which can be loaded in constructor directly.
Make it private and call it directly in start

* Split Server inventory responsibility to a dedicated object

This splits permit to found various historical issues:
* duplicate lookups on player connection
* sending inventory to non related player when a player connects
* non friendly lookups on detached inventories ownership

This reduce the detached inventory complexity and also increased the
lookup performance in a quite interesting way for servers with thousands
of inventories.
2020-05-07 22:38:41 +02:00