Skip to content

Commit 15a030e

Browse files
authoredNov 5, 2019
Improve documentation around banning (#9088)
* Fix ban chatcommand description * Correct ban API documentation
1 parent 2907c0f commit 15a030e

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed
 

Diff for: ‎builtin/game/chat.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -909,8 +909,8 @@ core.register_chatcommand("shutdown", {
909909
})
910910

911911
core.register_chatcommand("ban", {
912-
params = "[<name> | <IP_address>]",
913-
description = "Ban player or show ban list",
912+
params = "[<name>]",
913+
description = "Ban the IP of a player or show the ban list",
914914
privs = {ban=true},
915915
func = function(name, param)
916916
if param == "" then
@@ -922,7 +922,7 @@ core.register_chatcommand("ban", {
922922
end
923923
end
924924
if not core.get_player_by_name(param) then
925-
return false, "No such player."
925+
return false, "Player is not online."
926926
end
927927
if not core.ban_player(param) then
928928
return false, "Failed to ban player."
@@ -935,7 +935,7 @@ core.register_chatcommand("ban", {
935935

936936
core.register_chatcommand("unban", {
937937
params = "<name> | <IP_address>",
938-
description = "Remove player ban",
938+
description = "Remove IP ban belonging to a player/IP",
939939
privs = {ban=true},
940940
func = function(name, param)
941941
if not core.unban_player_or_ip(param) then

Diff for: ‎doc/lua_api.txt

+9-6
Original file line numberDiff line numberDiff line change
@@ -4896,13 +4896,16 @@ Server
48964896
Bans
48974897
----
48984898

4899-
* `minetest.get_ban_list()`: returns the ban list
4900-
(same as `minetest.get_ban_description("")`).
4901-
* `minetest.get_ban_description(ip_or_name)`: returns ban description (string)
4902-
* `minetest.ban_player(name)`: ban a player
4903-
* `minetest.unban_player_or_ip(name)`: unban player or IP address
4904-
* `minetest.kick_player(name, [reason])`: disconnect a player with a optional
4899+
* `minetest.get_ban_list()`: returns a list of all bans formatted as string
4900+
* `minetest.get_ban_description(ip_or_name)`: returns list of bans matching
4901+
IP address or name formatted as string
4902+
* `minetest.ban_player(name)`: ban the IP of a currently connected player
4903+
* Returns boolean indicating success
4904+
* `minetest.unban_player_or_ip(ip_or_name)`: remove ban record matching
4905+
IP address or name
4906+
* `minetest.kick_player(name, [reason])`: disconnect a player with an optional
49054907
reason.
4908+
* Returns boolean indicating success (false if player nonexistant)
49064909

49074910
Particles
49084911
---------

0 commit comments

Comments
 (0)