Skip to content

Commit

Permalink
api.lua: Fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
SmallJoker committed Jul 29, 2020
1 parent 1fcd3c4 commit b5ba66d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b5ba66d

Please sign in to comment.