mt-mods / pipeworks

Pipeworks is a mod for Minetest allowing the crafting and usage of pipes and tubes
Other
14 stars 17 forks source link

prevent MCL awards mod crash when player is nil #90

Closed nonfreegithub closed 9 months ago

nonfreegithub commented 9 months ago

In MCL when player is nil (maybe when is a fake player) MCL awards crash the server

S-S-X commented 9 months ago

It might also fail in some other cases with fake player depending on configuration if it attempts to do this (from awards):

        local player = minetest.get_player_by_name(name)
        local one = player:hud_add({

This might fail if it is fake player, not nil, has a name but player who owns node isn't online when unlock is executed by fake player and awards.show_mode is not set to chat or formspec.

Maybe awards should be skipped for fake player? If that's the case then for complete real player check could change and player to and type(player) == "userdata" which makes sure that player is actually real player and is not nil. But it depends if awards should or shouldn't work on fake player.

nonfreegithub commented 9 months ago

Maybe awards should be skipped for fake player?

yes I think so

But it depends if awards should or shouldn't work on fake player.

I think awards should not work with fake players

wsor4035 commented 9 months ago

tbh this should be fixed in MCL awards, not here

corarona commented 9 months ago

I can confirm this does not happen with mcl using up-to-date awards from upstream ( e.g. on https://codeberg.org/mineclonia/mineclonia/pulls/640 )

For any testers, this setup recreates the bug (mcla / mcl2 with pipeworks):

tl;dr yes this can and should be fixed in mcl

wsor4035 commented 9 months ago

quick gander, seems https://codeberg.org/mineclonia/mineclonia/commit/7e3064ef934173b420c97106692c108d5d4047e6 is what fixed it

wsor4035 commented 9 months ago

with confirmation of a mcl* person, closing this

nonfreegithub commented 6 months ago

It seems that now someone is fixing the problem with fakeplayers in #98 that I reported a long time ago here