From b5ba66deca68a33bd7df26bd840932e35335d148 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Wed, 29 Jul 2020 20:27:09 +0200 Subject: [PATCH] api.lua: Fix deprecation warnings --- api.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api.lua b/api.lua index add2fa8..87765d1 100644 --- a/api.lua +++ b/api.lua @@ -2,9 +2,11 @@ local storage = minetest.get_mod_storage() function skins.get_player_skin(player) - if player:get_attribute("skinsdb:skin_key") then - storage:set_string(player:get_player_name(), player:get_attribute("skinsdb:skin_key")) - player:set_attribute("skinsdb:skin_key", nil) + local meta = player:get_meta() + if meta:get("skinsdb:skin_key") then + -- Move player data prior July 2018 to mod storage + storage:set_string(player:get_player_name(), player:get_string("skinsdb:skin_key")) + meta:set_string("skinsdb:skin_key", "") end local skin = storage:get_string(player:get_player_name()) return skins.get(skin) or skins.get(skins.default)