chatcommands: add most missing colors
parent
aa84ae9c8b
commit
160c600b49
|
@ -125,9 +125,9 @@ core.register_chatcommand("help", {
|
|||
end
|
||||
end
|
||||
table.sort(cmds)
|
||||
return true, "# Illuna: Available commands: " .. table.concat(cmds, " ") .. "\n"
|
||||
return true, core.colorize("#F6A10A", "# Illuna: Available commands: " .. table.concat(cmds, " ") .. "\n"
|
||||
.. "# Illuna: Use '/help <cmd>' to get more information,"
|
||||
.. " or '/help all' to list everything."
|
||||
.. " or '/help all' to list everything.")
|
||||
elseif param == "all" then
|
||||
local cmds = {}
|
||||
for cmd, def in pairs(core.chatcommands) do
|
||||
|
@ -136,14 +136,14 @@ core.register_chatcommand("help", {
|
|||
end
|
||||
end
|
||||
table.sort(cmds)
|
||||
return true, "# Illuna: Available commands:\n"..table.concat(cmds, "\n")
|
||||
return true, core.colorize("#F6A10A", "# Illuna: Available commands:\n")..table.concat(cmds, "\n")
|
||||
elseif param == "privs" then
|
||||
local privs = {}
|
||||
for priv, def in pairs(core.registered_privileges) do
|
||||
privs[#privs + 1] = priv .. ": " .. def.description
|
||||
end
|
||||
table.sort(privs)
|
||||
return true, "# Illuna: Available privileges:\n"..table.concat(privs, "\n")
|
||||
return true, core.colorize("#F6A10A", "# Illuna: Available privileges:\n")..table.concat(privs, "\n")
|
||||
else
|
||||
local cmd = param
|
||||
local def = core.chatcommands[cmd]
|
||||
|
@ -162,9 +162,9 @@ core.register_chatcommand("privs", {
|
|||
func = function(caller, param)
|
||||
param = param:trim()
|
||||
local name = (param ~= "" and param or caller)
|
||||
return true, "# Illuna: Privileges of " .. name .. ": "
|
||||
return true, core.colorize("#F6A10A", "# Illuna: Privileges of " .. name .. ": "
|
||||
.. core.privs_to_string(
|
||||
core.get_player_privs(name), ' ')
|
||||
core.get_player_privs(name), ' '))
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -204,9 +204,9 @@ local function handle_grant_command(caller, grantname, grantprivstr)
|
|||
.. " granted you privileges: "
|
||||
.. core.privs_to_string(grantprivs, ' ')))
|
||||
end
|
||||
return true, "# Illuna: Privileges of " .. grantname .. ": "
|
||||
return true, core.colorize("#F6A10A", "# Illuna: Privileges of " .. grantname .. ": "
|
||||
.. core.privs_to_string(
|
||||
core.get_player_privs(grantname), ' ')
|
||||
core.get_player_privs(grantname), ' '))
|
||||
end
|
||||
|
||||
core.register_chatcommand("grant", {
|
||||
|
@ -273,9 +273,9 @@ core.register_chatcommand("revoke", {
|
|||
.. core.colorize("#F35400", " revoked privileges from you: "
|
||||
.. core.privs_to_string(revoke_privs, ' ')))
|
||||
end
|
||||
return true, "Privileges of " .. revoke_name .. ": "
|
||||
return true, core.colorize("#F6A10A", "Privileges of " .. revoke_name .. ": "
|
||||
.. core.privs_to_string(
|
||||
core.get_player_privs(revoke_name), ' ')
|
||||
core.get_player_privs(revoke_name), ' '))
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -306,14 +306,14 @@ core.register_chatcommand("setpassword", {
|
|||
act_str_pres = "sets"
|
||||
end
|
||||
if toname ~= name then
|
||||
core.chat_send_player(toname, "Your password was "
|
||||
.. act_str_past .. " by " .. name)
|
||||
core.chat_send_player(toname, core.colorize("#37CA39", "Your password was "
|
||||
.. act_str_past .. " by " .. name))
|
||||
end
|
||||
|
||||
core.log("action", name .. " " .. act_str_pres
|
||||
.. " password of " .. toname .. ".")
|
||||
|
||||
return true, "Password of player \"" .. toname .. "\" " .. act_str_past
|
||||
return true, core.colorize("#F6A10A", "Password of player \"" .. toname .. "\" " .. act_str_past)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -330,7 +330,7 @@ core.register_chatcommand("clearpassword", {
|
|||
|
||||
core.log("action", name .. " clears password of " .. toname .. ".")
|
||||
|
||||
return true, "# Illuna: Aye, Aye! Password of player \"" .. toname .. "\" cleared"
|
||||
return true, core.colorize("#37CA39", "# Illuna: Aye, Aye! Password of player \"" .. toname .. "\" cleared")
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -340,7 +340,7 @@ core.register_chatcommand("auth_reload", {
|
|||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
local done = core.auth_reload()
|
||||
return done, (done and "Done." or "Failed.")
|
||||
return done, (done and core.colorize("#37CA39", "Done.") or core.colorize("#F35400", "Failed."))
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -442,9 +442,9 @@ core.register_chatcommand("teleport", {
|
|||
if teleportee and p then
|
||||
p = find_free_position_near(p)
|
||||
teleportee:setpos(p)
|
||||
return true, "Teleporting " .. teleportee_name
|
||||
return true, core.colorize("#37CA39", "Teleporting " .. teleportee_name
|
||||
.. " to " .. target_name
|
||||
.. " at " .. core.pos_to_string(p)
|
||||
.. " at " .. core.pos_to_string(p))
|
||||
end
|
||||
|
||||
return false, core.colorize("#F35400", '# Illuna: I am sorry but you entered invalid parameters ("' .. param
|
||||
|
@ -528,8 +528,8 @@ core.register_chatcommand("emergeblocks", {
|
|||
core.emerge_area(p1, p2, emergeblocks_callback, context)
|
||||
core.after(2, emergeblocks_progress_update, context)
|
||||
|
||||
return true, "# Illuna: Started emerge of area ranging from " ..
|
||||
core.pos_to_string(p1, 1) .. " to " .. core.pos_to_string(p2, 1)
|
||||
return true, core.colorize("#37CA39", "# Illuna: Started emerge of area ranging from " ..
|
||||
core.pos_to_string(p1, 1) .. " to " .. core.pos_to_string(p2, 1))
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -544,8 +544,8 @@ core.register_chatcommand("deleteblocks", {
|
|||
end
|
||||
|
||||
if core.delete_area(p1, p2) then
|
||||
return true, "Successfully cleared area ranging from " ..
|
||||
core.pos_to_string(p1, 1) .. " to " .. core.pos_to_string(p2, 1)
|
||||
return true, core.colorize("#37CA39", "Successfully cleared area ranging from " ..
|
||||
core.pos_to_string(p1, 1) .. " to " .. core.pos_to_string(p2, 1))
|
||||
else
|
||||
return false, core.colorize("#F35400", "# Illuna: Failed to clear one or more blocks in area")
|
||||
end
|
||||
|
@ -587,12 +587,12 @@ local function handle_give_command(cmd, giver, receiver, stackstring)
|
|||
-- entered (e.g. big numbers are always interpreted as 2^16-1).
|
||||
stackstring = itemstack:to_string()
|
||||
if giver == receiver then
|
||||
return true, ("# Illuna: %q %sadded to inventory.")
|
||||
return true, (core.colorize("#37CA39", "# Illuna: %q %sadded to inventory."))
|
||||
:format(stackstring, partiality)
|
||||
else
|
||||
core.chat_send_player(receiver, ("# Illuna: %q %sadded to inventory.")
|
||||
core.chat_send_player(receiver, (core.colorize("#37CA39", "# Illuna: %q %sadded to inventory."))
|
||||
:format(stackstring, partiality))
|
||||
return true, ("# Illuna: %q %sadded to %s's inventory.")
|
||||
return true, (core.colorize("#37CA39", "# Illuna: %q %sadded to %s's inventory."))
|
||||
:format(stackstring, partiality, receiver)
|
||||
end
|
||||
end
|
||||
|
@ -649,7 +649,7 @@ core.register_chatcommand("spawnentity", {
|
|||
end
|
||||
p.y = p.y + 1
|
||||
core.add_entity(p, entityname)
|
||||
return true, ("# Illuna: %q spawned."):format(entityname)
|
||||
return true, (core.colorize("#37CA39", "# Illuna: %q spawned.")):format(entityname)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -666,7 +666,7 @@ core.register_chatcommand("pulverize", {
|
|||
return false, core.colorize("#F35400", "# Illuna: Unable to pulverize, no item in hand.")
|
||||
end
|
||||
player:set_wielded_item(nil)
|
||||
return true, "# Illuna: An item was pulverized."
|
||||
return true, core.colorize("#37CA39", "# Illuna: An item was pulverized.")
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -804,7 +804,7 @@ core.register_chatcommand("time", {
|
|||
-- Backward compatibility.
|
||||
core.set_timeofday((new_time % 24000) / 24000)
|
||||
core.log("action", name .. " sets time to " .. new_time)
|
||||
return true, "# Illuna: Time of day changed. Please don't do this too often. :-)"
|
||||
return true, core.colorize("#37CA39", "# Illuna: Time of day changed. Please don't do this too often. :-)")
|
||||
end
|
||||
hour = tonumber(hour)
|
||||
minute = tonumber(minute)
|
||||
|
@ -815,7 +815,7 @@ core.register_chatcommand("time", {
|
|||
end
|
||||
core.set_timeofday((hour * 60 + minute) / 1440)
|
||||
core.log("action", ("%s sets time to %d:%02d"):format(name, hour, minute))
|
||||
return true, "# Illuna: Time of day changed. Please don't do this too often. :-)"
|
||||
return true, core.colorize("#37CA39", "# Illuna: Time of day changed. Please don't do this too often. :-)")
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -842,7 +842,7 @@ core.register_chatcommand("ban", {
|
|||
privs = {ban=true},
|
||||
func = function(name, param)
|
||||
if param == "" then
|
||||
return true, "# Illuna: Ban list: " .. core.get_ban_list()
|
||||
return true, core.colorize("#F6A10A", "# Illuna: Ban list: " .. core.get_ban_list())
|
||||
end
|
||||
if not core.get_player_by_name(param) then
|
||||
return false, core.colorize("#F35400", "# Illuna: No such player.")
|
||||
|
@ -852,7 +852,7 @@ core.register_chatcommand("ban", {
|
|||
end
|
||||
local desc = core.get_ban_description(param)
|
||||
core.log("action", name .. " bans " .. desc .. ".")
|
||||
return true, "Banned " .. desc .. "."
|
||||
return true, core.colorize("#37CA39", "Banned " .. desc .. ".")
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -865,7 +865,7 @@ core.register_chatcommand("unban", {
|
|||
return false, core.colorize("#F35400", "# Illuna: Failed to unban player/IP.")
|
||||
end
|
||||
core.log("action", name .. " unbans " .. param)
|
||||
return true, "# Illuna: Unbanned " .. param
|
||||
return true, core.colorize("#37CA39", "# Illuna: Unbanned " .. param)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -884,7 +884,7 @@ core.register_chatcommand("kick", {
|
|||
log_reason = " with reason \"" .. reason .. "\""
|
||||
end
|
||||
core.log("action", name .. " kicks " .. tokick .. log_reason)
|
||||
return true, "# Illuna: Kicked " .. tokick
|
||||
return true, core.colorize("#37CA39", "# Illuna: Kicked " .. tokick)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -944,8 +944,8 @@ core.register_chatcommand("last-login", {
|
|||
local pauth = core.get_auth_handler().get_auth(param)
|
||||
if pauth and pauth.last_login then
|
||||
-- Time in UTC, ISO 8601 format
|
||||
return true, "# Illuna: Last login time was " ..
|
||||
os.date("!%Y-%m-%dT%H:%M:%SZ", pauth.last_login)
|
||||
return true, core.colorize("#F6A10A", "# Illuna: Last login time was " ..
|
||||
os.date("!%Y-%m-%dT%H:%M:%SZ", pauth.last_login))
|
||||
end
|
||||
return false, core.colorize("#F35400", "# Illuna: Last login time is unknown")
|
||||
end,
|
||||
|
|
Loading…
Reference in New Issue