From 7df6363aa0247068205a09815721164813849b19 Mon Sep 17 00:00:00 2001 From: Alexander Weber Date: Sun, 7 Jan 2018 14:50:22 +0100 Subject: Rework private skins handling -add skin:is_applicable_for_player(playername) method - hide private skins in unified_inventory since not supported - check player assignment in skins.assign_player_skin() + inherited to skins.set_player_skin() --- api.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'api.lua') diff --git a/api.lua b/api.lua index 549e79e..d822005 100644 --- a/api.lua +++ b/api.lua @@ -7,18 +7,19 @@ end -- Assign skin to player function skins.assign_player_skin(player, skin) local skin_obj - local skin_key if type(skin) == "string" then skin_obj = skins.get(skin) or skins.get(skins.default) else skin_obj = skin end - skin_key = skin_obj:get_key() - if skin_key == skins.default then - skin_key = "" + if skin_obj:is_applicable_for_player(player:get_player_name()) then + local skin_key = skin_obj:get_key() + if skin_key == skins.default then + skin_key = "" + end + player:set_attribute("skinsdb:skin_key", skin_key) end - player:set_attribute("skinsdb:skin_key", skin_key) end -- update visuals -- cgit v1.2.3