diff options
author | Alexander Weber <web.alexander@web.de> | 2018-02-13 22:02:22 +0100 |
---|---|---|
committer | sofar <sofar+github@foo-projects.org> | 2018-02-19 11:18:18 -0800 |
commit | 51b6cf2e3a6d0c2fb054863714abdae9d69aadd1 (patch) | |
tree | cd67d745f453c1191f29d2e823c945c977d40c53 /api.lua | |
parent | d3fbe3b70f1afb06d72b3bede2bd4d5983223f01 (diff) |
/skinsdb chat command implemented
Diffstat (limited to 'api.lua')
-rw-r--r-- | api.lua | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -8,18 +8,25 @@ end function skins.assign_player_skin(player, skin) local skin_obj if type(skin) == "string" then - skin_obj = skins.get(skin) or skins.get(skins.default) + skin_obj = skins.get(skin) else skin_obj = skin end + if not skin_obj then + return false + end + 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) + else + return false end + return true end -- update visuals @@ -30,6 +37,9 @@ end -- Assign and update function skins.set_player_skin(player, skin) - skins.assign_player_skin(player, skin) - skins.update_player_skin(player) + local success = skins.assign_player_skin(player, skin) + if success then + skins.update_player_skin(player) + end + return success end |