Skip to content

Commit

Permalink
whitespace indentation fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
SwissalpS committed Sep 3, 2024
1 parent be04916 commit 5c5292e
Showing 1 changed file with 113 additions and 113 deletions.
226 changes: 113 additions & 113 deletions areas.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
local xp_areas = {}

function xp_redo.get_area_xp_limits(id)
return xp_areas[id] or {}
return xp_areas[id] or {}
end

-- protection check
Expand Down Expand Up @@ -50,131 +50,131 @@ xp_areas = load_xp_areas()

-- cleanup for removed areas
areas:registerOnRemove(function(id)
xp_areas[id] = nil
save_xp_areas()
xp_areas[id] = nil
save_xp_areas()
end)

-- chat

minetest.register_chatcommand("area_xp_set_max", {
params = "<ID> <xp_limit>",
description = "Set or clear the max-xp value of an area",
func = function(playername, param)
local matcher = param:gmatch("(%S+)")
local id_str = matcher()
local xp = matcher()
if id_str == nil then
return true, "Invalid syntax!"
end

local id = tonumber(id_str)
if not id then
return true, "area-id is not numeric: " .. id_str
end

if not areas:isAreaOwner(id, playername) and
not minetest.check_player_privs(playername, { protection_bypas = true })
then
return true, "you are not the owner of area: " .. id
end

local xp_area = xp_areas[id]
if not xp_area then
xp_area = {}
end

xp_area.max = tonumber(xp)
xp_areas[id] = xp_area
save_xp_areas()
return true, "Area " .. id .. " max-xp value: " .. (xp_area.max or "<none>")
end,
params = "<ID> <xp_limit>",
description = "Set or clear the max-xp value of an area",
func = function(playername, param)
local matcher = param:gmatch("(%S+)")
local id_str = matcher()
local xp = matcher()
if id_str == nil then
return true, "Invalid syntax!"
end

local id = tonumber(id_str)
if not id then
return true, "area-id is not numeric: " .. id_str
end

if not areas:isAreaOwner(id, playername) and
not minetest.check_player_privs(playername, { protection_bypas = true })
then
return true, "you are not the owner of area: " .. id
end

local xp_area = xp_areas[id]
if not xp_area then
xp_area = {}
end

xp_area.max = tonumber(xp)
xp_areas[id] = xp_area
save_xp_areas()
return true, "Area " .. id .. " max-xp value: " .. (xp_area.max or "<none>")
end,
})

minetest.register_chatcommand("area_xp_get_max", {
params = "<ID>",
description = "Returns the max-xp value of an area",
func = function(playername, param)
if param == nil then
return true, "Invalid syntax!"
end

local id = tonumber(param)
if not id then
return true, "area-id is not numeric: " .. param
end

if not areas:isAreaOwner(id, playername) and
not minetest.check_player_privs(playername, { protection_bypas = true })
then
return true, "you are not the owner of area: " .. id
end

local xp_area = xp_areas[id]
if not xp_area then
xp_area = {}
end

return true, "Area " .. id .. " max-xp value: " .. (xp_area.max or "<none>")
end,
params = "<ID>",
description = "Returns the max-xp value of an area",
func = function(playername, param)
if param == nil then
return true, "Invalid syntax!"
end

local id = tonumber(param)
if not id then
return true, "area-id is not numeric: " .. param
end

if not areas:isAreaOwner(id, playername) and
not minetest.check_player_privs(playername, { protection_bypas = true })
then
return true, "you are not the owner of area: " .. id
end

local xp_area = xp_areas[id]
if not xp_area then
xp_area = {}
end

return true, "Area " .. id .. " max-xp value: " .. (xp_area.max or "<none>")
end,
})

minetest.register_chatcommand("area_xp_set_min", {
params = "<ID> <xp_limit>",
description = "Set or clear the min-xp value of an area",
func = function(playername, param)
local matcher = param:gmatch("(%S+)")
local id_str = matcher()
local xp = matcher()
if id_str == nil then
return true, "Invalid syntax!"
end

local id = tonumber(id_str)
if not id then
return true, "area-id is not numeric: " .. id_str
end

if not areas:isAreaOwner(id, playername) and
not minetest.check_player_privs(playername, { protection_bypas=true }) then
return true, "you are not the owner of area: " .. id
end

local xp_area = xp_areas[id]
if not xp_area then
xp_area = {}
end

xp_area.min = tonumber(xp)
xp_areas[id] = xp_area
save_xp_areas()
return true, "Area " .. id .. " min-xp value: " .. (xp_area.min or "<none>")
end,
params = "<ID> <xp_limit>",
description = "Set or clear the min-xp value of an area",
func = function(playername, param)
local matcher = param:gmatch("(%S+)")
local id_str = matcher()
local xp = matcher()
if id_str == nil then
return true, "Invalid syntax!"
end

local id = tonumber(id_str)
if not id then
return true, "area-id is not numeric: " .. id_str
end

if not areas:isAreaOwner(id, playername) and
not minetest.check_player_privs(playername, { protection_bypas=true }) then
return true, "you are not the owner of area: " .. id
end

local xp_area = xp_areas[id]
if not xp_area then
xp_area = {}
end

xp_area.min = tonumber(xp)
xp_areas[id] = xp_area
save_xp_areas()
return true, "Area " .. id .. " min-xp value: " .. (xp_area.min or "<none>")
end,
})

minetest.register_chatcommand("area_xp_get_min", {
params = "<ID>",
description = "Returns the min-xp value of an area",
func = function(playername, param)
if param == nil then
return true, "Invalid syntax!"
end

local id = tonumber(param)
if not id then
return true, "area-id is not numeric: " .. param
end

if not areas:isAreaOwner(id, playername) and
not minetest.check_player_privs(playername, { protection_bypas=true }) then
return true, "you are not the owner of area: " .. id
end

local xp_area = xp_areas[id]
if not xp_area then
xp_area = {}
end

return true, "Area " .. id .. " min-xp value: " .. (xp_area.min or "<none>")
end,
params = "<ID>",
description = "Returns the min-xp value of an area",
func = function(playername, param)
if param == nil then
return true, "Invalid syntax!"
end

local id = tonumber(param)
if not id then
return true, "area-id is not numeric: " .. param
end

if not areas:isAreaOwner(id, playername) and
not minetest.check_player_privs(playername, { protection_bypas=true }) then
return true, "you are not the owner of area: " .. id
end

local xp_area = xp_areas[id]
if not xp_area then
xp_area = {}
end

return true, "Area " .. id .. " min-xp value: " .. (xp_area.min or "<none>")
end,
})

0 comments on commit 5c5292e

Please sign in to comment.