Code tweaks

This commit is contained in:
ShadowNinja 2013-11-08 15:11:11 -05:00
parent ad3aaad8a8
commit 7bfe20661d

View File

@ -3,8 +3,10 @@ minetest.register_chatcommand("protect", {
description = "Protect your own area",
privs = {[areas.self_protection_privilege]=true},
func = function(name, param)
if param ~= "" then
if param == "" then
minetest.chat_send_player(name, 'Invalid usage, see /help protect')
return
end
local pos1, pos2 = {}, {}
if areas:getPos1(name) and areas:getPos2(name) then
pos1 = areas:getPos1(name)
@ -32,9 +34,6 @@ minetest.register_chatcommand("protect", {
areas:save()
minetest.chat_send_player(name, "Area protected")
else
minetest.chat_send_player(name, 'Invalid usage, see /help protect')
end
end})
@ -58,17 +57,17 @@ minetest.register_chatcommand("set_owner", {
pos2 = areas:getPos2(name)
pos1, pos2 = areas:sortPos(pos1, pos2)
else
minetest.chat_send_player(name, 'You need to select an area first')
minetest.chat_send_player(name, "You need to select an area first")
return
end
if not areas:player_exists(ownername) then
minetest.chat_send_player(name, 'The player "'
..ownername..'" does not exist')
minetest.chat_send_player(name, "The player \""
..ownername.."\" does not exist")
return
end
minetest.log("action", "/set_owner invoked, Owner="..ownername..
minetest.log("action", name.." runs /set_owner. Owner="..ownername..
" AreaName="..areaname..
" StartPos="..minetest.pos_to_string(pos1)..
" EndPos=" ..minetest.pos_to_string(pos2))
@ -114,7 +113,7 @@ minetest.register_chatcommand("add_owner", {
return
end
minetest.log("action", "add_owner invoked, Owner = "..ownername..
minetest.log("action", name.." runs /add_owner. Owner = "..ownername..
" AreaName = "..areaname.." ParentID = "..pid..
" StartPos = "..pos1.x..","..pos1.y..","..pos1.z..
" EndPos = " ..pos2.x..","..pos2.y..","..pos2.z)
@ -198,7 +197,7 @@ minetest.register_chatcommand("list_areas", {
description = "List your areas, or all areas if you are an admin.",
privs = {},
func = function(name, param)
admin = minetest.check_player_privs(name, {areas=true})
local admin = minetest.check_player_privs(name, {areas=true})
if admin then
minetest.chat_send_player(name,
"Showing all areas.")