3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "lua_api/l_base.h"
24 class ModApiServer : public ModApiBase
27 // request_shutdown([message], [reconnect])
28 static int l_request_shutdown(lua_State *L);
30 // get_server_status()
31 static int l_get_server_status(lua_State *L);
33 // get_server_uptime()
34 static int l_get_server_uptime(lua_State *L);
37 static int l_get_worldpath(lua_State *L);
40 static int l_is_singleplayer(lua_State *L);
42 // get_current_modname()
43 static int l_get_current_modname(lua_State *L);
45 // get_modpath(modname)
46 static int l_get_modpath(lua_State *L);
49 // the returned list is sorted alphabetically for you
50 static int l_get_modnames(lua_State *L);
53 static int l_print(lua_State *L);
55 // chat_send_all(text)
56 static int l_chat_send_all(lua_State *L);
58 // chat_send_player(name, text)
59 static int l_chat_send_player(lua_State *L);
61 // show_formspec(playername,formname,formspec)
62 static int l_show_formspec(lua_State *L);
64 // sound_play(spec, parameters)
65 static int l_sound_play(lua_State *L);
68 static int l_sound_stop(lua_State *L);
70 // sound_fade(handle, step, gain)
71 static int l_sound_fade(lua_State *L);
73 // get_player_privs(name, text)
74 static int l_get_player_privs(lua_State *L);
77 static int l_get_player_ip(lua_State *L);
79 // get_player_information(name)
80 static int l_get_player_information(lua_State *L);
83 static int l_get_ban_list(lua_State *L);
85 // get_ban_description()
86 static int l_get_ban_description(lua_State *L);
89 static int l_ban_player(lua_State *L);
91 // unban_player_or_ip()
92 static int l_unban_player_or_ip(lua_State *L);
94 // kick_player(name, [message]) -> success
95 static int l_kick_player(lua_State *L);
97 // remove_player(name)
98 static int l_remove_player(lua_State *L);
100 // notify_authentication_modified(name)
101 static int l_notify_authentication_modified(lua_State *L);
103 // get_last_run_mod()
104 static int l_get_last_run_mod(lua_State *L);
106 // set_last_run_mod(modname)
107 static int l_set_last_run_mod(lua_State *L);
110 static void Initialize(lua_State *L, int top);