oops i broke it

This commit is contained in:
Evert Prants 2019-11-10 23:15:22 +02:00
parent bc036b4551
commit a3e43cc09a
Signed by: evert
GPG Key ID: 1688DA83D222D0B5

View File

@ -8,31 +8,34 @@ local function cmd_repair(name, params, splitparams)
splitparams[1] = "all" splitparams[1] = "all"
end end
if splitparams[1] == "all" then if #splitparams > 0 then
if not ess.priv_match(name, "ess.tools.repairall") then if splitparams[1] == "all" then
return ess.reject_permission() if not ess.priv_match(name, "ess.tools.repairall") then
return ess.reject_permission()
end
-- Repair all tools
commit = 2
elseif splitparams[2] == "all" and minetest.get_player_by_name(splitparams[1]) then
if not ess.priv_match(name, "ess.tools.repairall.other") then
return ess.reject_permission()
end
player = minetest.get_player_by_name(splitparams[1])
-- Repair all of a player's tools
commit = 2
elseif splitparams[1] ~= name and minetest.get_player_by_name(splitparams[1]) then
if not ess.priv_match(name, "ess.tools.repair.other") then
return ess.reject_permission()
end
player = minetest.get_player_by_name(splitparams[1])
-- Repair a player's held tool
commit = 1
end end
-- Repair all tools
commit = 2
elseif splitparams[2] == "all" and minetest.get_player_by_name(splitparams[1]) then
if not ess.priv_match(name, "ess.tools.repairall.other") then
return ess.reject_permission()
end
player = minetest.get_player_by_name(splitparams[1])
-- Repair all of a player's tools
commit = 2
elseif splitparams[1] ~= name and minetest.get_player_by_name(splitparams[1]) then
if not ess.priv_match(name, "ess.tools.repair.other") then
return ess.reject_permission()
end
player = minetest.get_player_by_name(splitparams[1])
-- Repair a player's held tool
commit = 1
else else
-- Repair my own tool -- Repair my own tool
commit = 1 commit = 1
end end
if commit == 1 and player then if commit == 1 and player then
local held = player:get_wielded_item() local held = player:get_wielded_item()
if held:get_wear() > 0 then if held:get_wear() > 0 then