delegated ban should be on towns, not on spawns
parent
330f06e744
commit
7543d6bbc7
|
@ -24,10 +24,9 @@ Randomized spawning typically causes players to spawn far from eachother. If pla
|
|||
The player issuing the invite (host) must typically pay a levvy when adding another player.
|
||||
|
||||
* `/spawn add <player>` - allow another player to visit your spawn directly (levvy must be paid), or lift their exile (no levvy to pay)
|
||||
* `/spawn kick <targetplayer> [<hostplayer>]`
|
||||
* `/spawn kick <targetplayer>`
|
||||
* revoke rights to visit you
|
||||
* if the exiled player gets close to your spawn, they are kicked back to their own spawn
|
||||
* if you are an explicit guest of `hostplayer` (not just a town visitor), you can exile `targetplayer` on their behalf
|
||||
* `/spawn visit <player>` - visit a player's spawn
|
||||
* `/spawn guests` - see who you have added to your spawn
|
||||
* `/spawn hosts` - see whose spawns you may visit
|
||||
|
@ -39,7 +38,8 @@ You can host a town from your spawn if you wish. Hosting a town means that any p
|
|||
There is no levvy on hosting a town.
|
||||
|
||||
* `/spawn town { open | close }` - switch town hosting on or off.
|
||||
* `/spawn town { ban | unban } <playername>` - ban or unban a player from a town
|
||||
* `/spawn town { ban | unban } <playername> [<town>]` - ban or unban a player from a town
|
||||
* Town owners can use this, as well as unexiled guests of the town owner
|
||||
|
||||
## Settings
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ end
|
|||
|
||||
minetest.register_chatcommand("spawn", {
|
||||
description = "Teleport to your spawn, or manage guests in your spawn.",
|
||||
params = "[ add <player> | visit <player> | kick <player> | guests | hosts | town { open | close | ban <player> | unban <player> } ]",
|
||||
params = "[ add <player> | visit <player> | kick <player> | guests | hosts | town { open | close | ban <player> [<town>] | unban <player> [<town>] } ]",
|
||||
privs = "spawn",
|
||||
func = function(playername, args)
|
||||
local target = rspawn.playerspawns[playername]
|
||||
|
|
|
@ -152,7 +152,7 @@ function rspawn.guestlists:addplayer(hostname, guestname)
|
|||
minetest.log("action", "rspawn - "..hostname.." adds "..guestname.." to their spawn")
|
||||
end
|
||||
|
||||
function rspawn.guestlists:exileplayer(hostname, guestname, notifyname)
|
||||
function rspawn.guestlists:exileplayer(hostname, guestname)
|
||||
if hostname == guestname then
|
||||
minetest.chat_send_player(hostname, "Cannot ban yourself!")
|
||||
return false
|
||||
|
@ -164,7 +164,7 @@ function rspawn.guestlists:exileplayer(hostname, guestname, notifyname)
|
|||
rspawn.playerspawns["guest lists"][hostname] = guestlist
|
||||
|
||||
else
|
||||
minetest.chat_send_player(notifyname or hostname, guestname.." is not in accepted guests list for "..hostname)
|
||||
minetest.chat_send_player(hostname, guestname.." is not in accepted guests list for "..hostname)
|
||||
return false
|
||||
end
|
||||
|
||||
|
@ -174,21 +174,10 @@ function rspawn.guestlists:exileplayer(hostname, guestname, notifyname)
|
|||
return true
|
||||
end
|
||||
|
||||
function rspawn.guestlists:kickplayer(callername, params)
|
||||
params = params:split(" ")
|
||||
local guestname = params[1]
|
||||
local hostname = params[2]
|
||||
function rspawn.guestlists:kickplayer(callername, guestname)
|
||||
|
||||
-- Caller is an explicit non-exiled guest
|
||||
if hostname then
|
||||
if rspawn.playerspawns["guest lists"][hostname] and rspawn.playerspawns["guest lists"][hostname][callername] == GUEST_ALLOW then
|
||||
if rspawn.guestlists:exileplayer(hostname, guestname, callername) then
|
||||
minetest.chat_send_player(callername, "Evicted "..guestname.." from "..hostname.."'s spawn")
|
||||
minetest.log("action", "rspawn - "..callername.." evicts "..guestname.." on behalf of "..hostname)
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(callername, "You are not permitted to act on behalf of "..hostname)
|
||||
end
|
||||
else
|
||||
if rspawn.guestlists:exileplayer(callername, guestname) then
|
||||
minetest.chat_send_player(callername, "Evicted "..guestname.." from "..callername.."'s spawn")
|
||||
|
@ -249,6 +238,8 @@ function rspawn.guestlists:listhosts(guestname)
|
|||
end
|
||||
|
||||
function rspawn.guestlists:visitplayer(hostname, guestname)
|
||||
if not (hostname and guestname) then return end
|
||||
|
||||
local guest = minetest.get_player_by_name(guestname)
|
||||
local hostpos = rspawn.playerspawns[hostname]
|
||||
|
||||
|
@ -264,7 +255,49 @@ function rspawn.guestlists:visitplayer(hostname, guestname)
|
|||
end
|
||||
end
|
||||
|
||||
local function townban(callername, guestname, hostname)
|
||||
if not (callername and guestname) then return end
|
||||
|
||||
hostname = hostname or callername
|
||||
if hostname == callername or (rspawn.playerspawns["guest lists"][hostname] and rspawn.playerspawns["guest lists"][hostname][callername] == GUEST_ALLOW) then
|
||||
if not rspawn.playerspawns["town lists"][hostname] then
|
||||
minetest.chat_send_player(callername, "No such town "..hostname)
|
||||
return
|
||||
end
|
||||
|
||||
rspawn.playerspawns["town lists"][hostname][guestname] = GUEST_BAN
|
||||
|
||||
minetest.chat_send_player(callername, "Evicted "..guestname.." from "..hostname.."'s spawn")
|
||||
minetest.log("action", "rspawn - "..callername.." evicts "..guestname.." on behalf of "..hostname)
|
||||
else
|
||||
minetest.chat_send_player(callername, "You are not permitted to act on behalf of "..hostname)
|
||||
end
|
||||
rspawn:spawnsave()
|
||||
end
|
||||
|
||||
local function townunban(callername, guestname, hostname)
|
||||
if not (callername and guestname) then return end
|
||||
|
||||
hostname = hostname or callername
|
||||
if hostname == callername or (rspawn.playerspawns["guest lists"][hostname] and rspawn.playerspawns["guest lists"][hostname][callername] == GUEST_ALLOW) then
|
||||
if not rspawn.playerspawns["town lists"][hostname] then
|
||||
minetest.chat_send_player(callername, "No such town "..hostname)
|
||||
return
|
||||
end
|
||||
|
||||
rspawn.playerspawns["town lists"][hostname][guestname] = nil
|
||||
|
||||
minetest.chat_send_player(callername, "Evicted "..guestname.." from "..hostname.."'s spawn")
|
||||
minetest.log("action", "rspawn - "..callername.." evicts "..guestname.." on behalf of "..hostname)
|
||||
else
|
||||
minetest.chat_send_player(callername, "You are not permitted to act on behalf of "..hostname)
|
||||
end
|
||||
rspawn:spawnsave()
|
||||
end
|
||||
|
||||
function rspawn.guestlists:townset(hostname, params)
|
||||
if not hostname then return end
|
||||
|
||||
params = params or ""
|
||||
params = params:split(" ")
|
||||
|
||||
|
@ -286,12 +319,10 @@ function rspawn.guestlists:townset(hostname, params)
|
|||
return
|
||||
|
||||
elseif mode == "ban" and guestname and guestname ~= hostname then
|
||||
town_banlist[guestname] = GUEST_BAN
|
||||
minetest.chat_send_all(guestname.." is exiled from "..hostname.."'s town.")
|
||||
townban(hostname, guestname, params[3])
|
||||
|
||||
elseif mode == "unban" and guestname then
|
||||
town_banlist[guestname] = nil
|
||||
minetest.chat_send_all(guestname.." is no longer exiled from "..hostname.."'s town.")
|
||||
townunban(hostname, guestname, params[3])
|
||||
|
||||
else
|
||||
minetest.chat_send_player(hostname, "Unknown parameterless town operation: "..tostring(mode) )
|
||||
|
|
Loading…
Reference in New Issue