summaryrefslogtreecommitdiff
path: root/api.lua
diff options
context:
space:
mode:
authorAlexander Weber <web.alexander@web.de>2018-01-07 14:50:22 +0100
committerAlexander Weber <web.alexander@web.de>2018-01-07 14:50:22 +0100
commit7df6363aa0247068205a09815721164813849b19 (patch)
tree838b88f355c0c50aacea7fc7e00589a9eb9f9886 /api.lua
parent71e05bbd6863ca91db16c386c671da77e8f9e9eb (diff)
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()
Diffstat (limited to 'api.lua')
-rw-r--r--api.lua11
1 files changed, 6 insertions, 5 deletions
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