Adjustments based on SmallJoker feedback

This commit is contained in:
Alexander Weber 2018-02-15 06:54:12 +01:00 committed by sofar
parent 14288a1ff0
commit e619bc8d83
1 changed files with 14 additions and 21 deletions

View File

@ -19,26 +19,18 @@ minetest.register_chatcommand("skinsdb", {
-- parse command line -- parse command line
local command, parameter local command, parameter
for word in param:gmatch("([^ ]+)") do local words = param:split(" ")
if not command then local word = words[1]
-- first word if word == 'set' or word == 'list' or word == 'show' or word == 'ui' then
if word == 'set' or word == 'list' or word == 'show' or word == 'ui' then command = word
command = word parameter = words[2]
elseif skins.get(word) then elseif skins.get(word) then
command = 'set' command = 'set'
parameter = word parameter = word
break elseif not word then
else command = 'ui'
return false, "unknown command "..word.." see /help skinsdb for supported parameters" else
end return false, "unknown command "..word.." see /help skinsdb for supported parameters"
else
-- second word
parameter = word
break
end
end
if not command then
command = "ui"
end end
if command == "set" then if command == "set" then
@ -62,7 +54,8 @@ minetest.register_chatcommand("skinsdb", {
local current_skin_key = skins.get_player_skin(player):get_key() local current_skin_key = skins.get_player_skin(player):get_key()
for _, skin in ipairs(list) do for _, skin in ipairs(list) do
local info = skin:get_key()..": name="..skin:get_meta_string("name").." author="..skin:get_meta_string("author").." license="..skin:get_meta_string("license") local info = skin:get_key()..": name="..skin:get_meta_string("name").." author="
..skin:get_meta_string("author").." license="..skin:get_meta_string("license")
if skin:get_key() == current_skin_key then if skin:get_key() == current_skin_key then
info = minetest.colorize("#00FFFF", info) info = minetest.colorize("#00FFFF", info)
end end