1
0

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Tiger Wang 2013-08-18 00:36:51 +01:00
commit 7014979bff
19 changed files with 87 additions and 179 deletions

9
.gitmodules vendored Normal file
View File

@ -0,0 +1,9 @@
[submodule "MCServer/Plugins/Core"]
path = MCServer/Plugins/Core
url = git@github.com:mc-server/Core.git
[submodule "MCServer/Plugins/ProtectionAreas"]
path = MCServer/Plugins/ProtectionAreas
url = git@github.com:mc-server/ProtectionAreas.git
[submodule "MCServer/Plugins/TransAPI"]
path = MCServer/Plugins/TransAPI
url = git@github.com:bearbin/transapi.git

View File

@ -1,7 +0,0 @@
:: ClonePlugins.cmd
:: Clones the base plugins from their respective repos into proper folders (./MCServer/Plugins
git clone https://github.com/mc-server/Core.git ./MCServer/Plugins/Core
git clone https://github.com/mc-server/ProtectionAreas.git ./MCServer/Plugins/ProtectionAreas

View File

@ -1,2 +0,0 @@
Core
ProtectionAreas

1
MCServer/Plugins/Core Submodule

@ -0,0 +1 @@
Subproject commit e3a45f34303331be77aceacf2ba53e503ad7284f

@ -0,0 +1 @@
Subproject commit 3019c7b396221b987cd3f89d422276f764834ffe

@ -0,0 +1 @@
Subproject commit 52e1de4332a026e58fda843aae98c1f51e57199e

View File

@ -1,20 +0,0 @@
The MIT License (MIT)
Copyright (c) 2013 Alexander Harkness
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,20 +0,0 @@
TransAPI
========
A plugin translation API for MCServer.
TransAPI is designed to be used with the [client library](https://github.com/bearbin/transapi-client), however there is also a stable API available for use.
API
---
GetLanguage ( cPlayer )
Returns the user's preferred language (or server default if not set). (ISO 639-1 language code)
GetConsoleLanguage ( )
Returns the preferred language for console text. (ISO 639-1 language code)
Commands
--------
* /language [lang] - Takes a language code (ISO 639-1) and sets the user's preferred language to that. (tranapi.setlang)

View File

@ -1,91 +0,0 @@
-- This plugin copyright Alexander Harkness 2013, licensed under the MIT license.
-- Configuration
g_ServerLang = "en"
g_ConsoleLang = "en"
-- Global Variables
g_Plugin = nil
g_PluginManager = nil
g_PluginDir = nil
g_UserData = nil
-- START WITH DA AWESOME!
function Initialize( Plugin )
-- Set up the globals.
g_Plugin = Plugin
g_PluginManager = cRoot:Get():GetPluginManager()
g_PluginDir = Plugin:GetDirectory()
-- Set up the plugin details.
Plugin:SetName( "TransAPI" )
Plugin:SetVersion( 1 )
-- This is the place for commands!
g_PluginManager:BindCommand("/language", "transapi.setlang", HandleLanguageCommand, " - Set your preferred language (use ISO 639-1)")
-- Load the userdata file.
g_UserData = cIniFile( g_PluginDir .. "/userdata.ini" )
if g_UserData ~= true then
LOGERROR( "TransAPI INI file could not be opened!" )
end
LOG( "Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() )
return true
end
function GetLanguage( Player )
-- Returns a language to use.
if g_UserData:ReadFile() == true then
local userLang = g_UserData:GetValueSet( Player:GetName(), "language", "false" )
g_UserData:WriteFile()
end
if userLang == "false" then
return g_ServerLang
else
return userLang
end
end
function GetConsoleLanguage()
-- Return the language to use for console messages.
return g_ConsoleLang
end
function HandleLanguageCommand ( Split, Player )
-- If the user is not setting the language, tell them the currently selected one.
if #Split ~= 2 then
local userLang = g_UserData:GetValueSet( Player:GetName(), "language", "false" )
if userLang == "false" then
return g_ServerLang
else
return userLang
end
end
-- Set the language.
local success = g_UserData:SetValue( Player:GetName(), "language" Split[2] )
g_UserData:WriteFile()
if not success then
Player:SendMessage( "Language could not be set!" )
else
Player:SendMessage( "Language set!" )
end
return true
end
function OnDisable()
LOG( "Disabled TransAPI!" )
end

View File

@ -10,6 +10,8 @@ Installation
To install MCServer, you can either download the repository and compile it, or download a pre-compiled version. To install MCServer, you can either download the repository and compile it, or download a pre-compiled version.
If you are cloning the repository, you are required to recursively download the submodules also with `git clone -r`. When pulling, you should use `git pull --recurse-submodules`. You might want to set the base forms as aliases to these.
Compilation instructions are available in the COMPILING file. Compilation instructions are available in the COMPILING file.
Linux builds can be downloaded from [the Berboe CI server](http://ci.berboe.co.uk) and windows from xoft's [nightly build service](http://mc-server.xoft.cz). Linux builds can be downloaded from [the Berboe CI server](http://ci.berboe.co.uk) and windows from xoft's [nightly build service](http://mc-server.xoft.cz).

View File

@ -1,6 +1,6 @@
/* /*
** Lua binding: AllToLua ** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 08/16/13 10:46:12. ** Generated automatically by tolua++-1.0.92 on 08/17/13 23:54:30.
*/ */
#ifndef __cplusplus #ifndef __cplusplus
@ -20372,6 +20372,40 @@ static int tolua_AllToLua_cRoot_SaveAllChunks00(lua_State* tolua_S)
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
/* method: BroadcastChat of class cRoot */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_BroadcastChat00
static int tolua_AllToLua_cRoot_BroadcastChat00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) ||
!tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0);
const AString a_Message = ((const AString) tolua_tocppstring(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'BroadcastChat'", NULL);
#endif
{
self->BroadcastChat(a_Message);
tolua_pushcppstring(tolua_S,(const char*)a_Message);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'BroadcastChat'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: GetProtocolVersionTextFromInt of class cRoot */ /* method: GetProtocolVersionTextFromInt of class cRoot */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetProtocolVersionTextFromInt00 #ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetProtocolVersionTextFromInt00
static int tolua_AllToLua_cRoot_GetProtocolVersionTextFromInt00(lua_State* tolua_S) static int tolua_AllToLua_cRoot_GetProtocolVersionTextFromInt00(lua_State* tolua_S)
@ -30174,6 +30208,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"QueueExecuteConsoleCommand",tolua_AllToLua_cRoot_QueueExecuteConsoleCommand00); tolua_function(tolua_S,"QueueExecuteConsoleCommand",tolua_AllToLua_cRoot_QueueExecuteConsoleCommand00);
tolua_function(tolua_S,"GetTotalChunkCount",tolua_AllToLua_cRoot_GetTotalChunkCount00); tolua_function(tolua_S,"GetTotalChunkCount",tolua_AllToLua_cRoot_GetTotalChunkCount00);
tolua_function(tolua_S,"SaveAllChunks",tolua_AllToLua_cRoot_SaveAllChunks00); tolua_function(tolua_S,"SaveAllChunks",tolua_AllToLua_cRoot_SaveAllChunks00);
tolua_function(tolua_S,"BroadcastChat",tolua_AllToLua_cRoot_BroadcastChat00);
tolua_function(tolua_S,"GetProtocolVersionTextFromInt",tolua_AllToLua_cRoot_GetProtocolVersionTextFromInt00); tolua_function(tolua_S,"GetProtocolVersionTextFromInt",tolua_AllToLua_cRoot_GetProtocolVersionTextFromInt00);
tolua_endmodule(tolua_S); tolua_endmodule(tolua_S);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,6 +1,6 @@
/* /*
** Lua binding: AllToLua ** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 08/16/13 10:46:13. ** Generated automatically by tolua++-1.0.92 on 08/17/13 23:54:30.
*/ */
/* Exported function */ /* Exported function */

View File

@ -296,7 +296,6 @@ bool cLuaState::PushFunctionFromRefTable(cRef & a_TableRef, const char * a_FnNam
void cLuaState::Push(const AString & a_String) void cLuaState::Push(const AString & a_String)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushcppstring(m_LuaState, a_String); tolua_pushcppstring(m_LuaState, a_String);
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -309,7 +308,6 @@ void cLuaState::Push(const AString & a_String)
void cLuaState::Push(const AStringVector & a_Vector) void cLuaState::Push(const AStringVector & a_Vector)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
lua_createtable(m_LuaState, a_Vector.size(), 0); lua_createtable(m_LuaState, a_Vector.size(), 0);
int newTable = lua_gettop(m_LuaState); int newTable = lua_gettop(m_LuaState);
@ -329,7 +327,6 @@ void cLuaState::Push(const AStringVector & a_Vector)
void cLuaState::PushUserType(void * a_Object, const char * a_Type) void cLuaState::PushUserType(void * a_Object, const char * a_Type)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Object, a_Type); tolua_pushusertype(m_LuaState, a_Object, a_Type);
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -342,7 +339,6 @@ void cLuaState::PushUserType(void * a_Object, const char * a_Type)
void cLuaState::Push(int a_Value) void cLuaState::Push(int a_Value)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushnumber(m_LuaState, a_Value); tolua_pushnumber(m_LuaState, a_Value);
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -355,7 +351,6 @@ void cLuaState::Push(int a_Value)
void cLuaState::Push(double a_Value) void cLuaState::Push(double a_Value)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushnumber(m_LuaState, a_Value); tolua_pushnumber(m_LuaState, a_Value);
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -368,7 +363,6 @@ void cLuaState::Push(double a_Value)
void cLuaState::Push(const char * a_Value) void cLuaState::Push(const char * a_Value)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushstring(m_LuaState, a_Value); tolua_pushstring(m_LuaState, a_Value);
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -381,7 +375,6 @@ void cLuaState::Push(const char * a_Value)
void cLuaState::Push(bool a_Value) void cLuaState::Push(bool a_Value)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushboolean(m_LuaState, a_Value ? 1 : 0); tolua_pushboolean(m_LuaState, a_Value ? 1 : 0);
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -394,7 +387,6 @@ void cLuaState::Push(bool a_Value)
void cLuaState::Push(cWorld * a_World) void cLuaState::Push(cWorld * a_World)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_World, "cWorld"); tolua_pushusertype(m_LuaState, a_World, "cWorld");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -407,7 +399,6 @@ void cLuaState::Push(cWorld * a_World)
void cLuaState::Push(cPlayer * a_Player) void cLuaState::Push(cPlayer * a_Player)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Player, "cPlayer"); tolua_pushusertype(m_LuaState, a_Player, "cPlayer");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -420,7 +411,6 @@ void cLuaState::Push(cPlayer * a_Player)
void cLuaState::Push(const cPlayer * a_Player) void cLuaState::Push(const cPlayer * a_Player)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, (void *)a_Player, "cPlayer"); tolua_pushusertype(m_LuaState, (void *)a_Player, "cPlayer");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -433,7 +423,6 @@ void cLuaState::Push(const cPlayer * a_Player)
void cLuaState::Push(cEntity * a_Entity) void cLuaState::Push(cEntity * a_Entity)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Entity, "cEntity"); tolua_pushusertype(m_LuaState, a_Entity, "cEntity");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -446,7 +435,6 @@ void cLuaState::Push(cEntity * a_Entity)
void cLuaState::Push(cMonster * a_Monster) void cLuaState::Push(cMonster * a_Monster)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Monster, "cMonster"); tolua_pushusertype(m_LuaState, a_Monster, "cMonster");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -459,7 +447,6 @@ void cLuaState::Push(cMonster * a_Monster)
void cLuaState::Push(cItem * a_Item) void cLuaState::Push(cItem * a_Item)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Item, "cItem"); tolua_pushusertype(m_LuaState, a_Item, "cItem");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -472,7 +459,6 @@ void cLuaState::Push(cItem * a_Item)
void cLuaState::Push(cItems * a_Items) void cLuaState::Push(cItems * a_Items)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Items, "cItems"); tolua_pushusertype(m_LuaState, a_Items, "cItems");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -485,7 +471,6 @@ void cLuaState::Push(cItems * a_Items)
void cLuaState::Push(cClientHandle * a_Client) void cLuaState::Push(cClientHandle * a_Client)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Client, "cClientHandle"); tolua_pushusertype(m_LuaState, a_Client, "cClientHandle");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -498,7 +483,6 @@ void cLuaState::Push(cClientHandle * a_Client)
void cLuaState::Push(cPickup * a_Pickup) void cLuaState::Push(cPickup * a_Pickup)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Pickup, "cPickup"); tolua_pushusertype(m_LuaState, a_Pickup, "cPickup");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -511,7 +495,6 @@ void cLuaState::Push(cPickup * a_Pickup)
void cLuaState::Push(cChunkDesc * a_ChunkDesc) void cLuaState::Push(cChunkDesc * a_ChunkDesc)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_ChunkDesc, "cChunkDesc"); tolua_pushusertype(m_LuaState, a_ChunkDesc, "cChunkDesc");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -524,7 +507,6 @@ void cLuaState::Push(cChunkDesc * a_ChunkDesc)
void cLuaState::Push(const cCraftingGrid * a_Grid) void cLuaState::Push(const cCraftingGrid * a_Grid)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, (void *)a_Grid, "cCraftingGrid"); tolua_pushusertype(m_LuaState, (void *)a_Grid, "cCraftingGrid");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -537,7 +519,6 @@ void cLuaState::Push(const cCraftingGrid * a_Grid)
void cLuaState::Push(const cCraftingRecipe * a_Recipe) void cLuaState::Push(const cCraftingRecipe * a_Recipe)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, (void *)a_Recipe, "cCraftingRecipe"); tolua_pushusertype(m_LuaState, (void *)a_Recipe, "cCraftingRecipe");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -550,7 +531,6 @@ void cLuaState::Push(const cCraftingRecipe * a_Recipe)
void cLuaState::Push(TakeDamageInfo * a_TDI) void cLuaState::Push(TakeDamageInfo * a_TDI)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_TDI, "TakeDamageInfo"); tolua_pushusertype(m_LuaState, a_TDI, "TakeDamageInfo");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -563,7 +543,6 @@ void cLuaState::Push(TakeDamageInfo * a_TDI)
void cLuaState::Push(cWindow * a_Window) void cLuaState::Push(cWindow * a_Window)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Window, "cWindow"); tolua_pushusertype(m_LuaState, a_Window, "cWindow");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -576,7 +555,6 @@ void cLuaState::Push(cWindow * a_Window)
void cLuaState::Push(cPlugin_NewLua * a_Plugin) void cLuaState::Push(cPlugin_NewLua * a_Plugin)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Plugin, "cPlugin_NewLua"); tolua_pushusertype(m_LuaState, a_Plugin, "cPlugin_NewLua");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -589,7 +567,6 @@ void cLuaState::Push(cPlugin_NewLua * a_Plugin)
void cLuaState::Push(const HTTPRequest * a_Request) void cLuaState::Push(const HTTPRequest * a_Request)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, (void *)a_Request, "HTTPRequest"); tolua_pushusertype(m_LuaState, (void *)a_Request, "HTTPRequest");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -602,7 +579,6 @@ void cLuaState::Push(const HTTPRequest * a_Request)
void cLuaState::Push(cWebAdmin * a_WebAdmin) void cLuaState::Push(cWebAdmin * a_WebAdmin)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_WebAdmin, "cWebAdmin"); tolua_pushusertype(m_LuaState, a_WebAdmin, "cWebAdmin");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -615,7 +591,6 @@ void cLuaState::Push(cWebAdmin * a_WebAdmin)
void cLuaState::Push(const HTTPTemplateRequest * a_Request) void cLuaState::Push(const HTTPTemplateRequest * a_Request)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, (void *)a_Request, "HTTPTemplateRequest"); tolua_pushusertype(m_LuaState, (void *)a_Request, "HTTPTemplateRequest");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -628,7 +603,6 @@ void cLuaState::Push(const HTTPTemplateRequest * a_Request)
void cLuaState::Push(cTNTEntity * a_TNTEntity) void cLuaState::Push(cTNTEntity * a_TNTEntity)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_TNTEntity, "cTNTEntity"); tolua_pushusertype(m_LuaState, a_TNTEntity, "cTNTEntity");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -641,7 +615,6 @@ void cLuaState::Push(cTNTEntity * a_TNTEntity)
void cLuaState::Push(cCreeper * a_Creeper) void cLuaState::Push(cCreeper * a_Creeper)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Creeper, "cCreeper"); tolua_pushusertype(m_LuaState, a_Creeper, "cCreeper");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -654,7 +627,6 @@ void cLuaState::Push(cCreeper * a_Creeper)
void cLuaState::Push(Vector3i * a_Vector) void cLuaState::Push(Vector3i * a_Vector)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Vector, "Vector3i"); tolua_pushusertype(m_LuaState, a_Vector, "Vector3i");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -667,7 +639,6 @@ void cLuaState::Push(Vector3i * a_Vector)
void cLuaState::Push(void * a_Ptr) void cLuaState::Push(void * a_Ptr)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
lua_pushnil(m_LuaState); lua_pushnil(m_LuaState);
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -680,7 +651,6 @@ void cLuaState::Push(void * a_Ptr)
void cLuaState::Push(cHopperEntity * a_Hopper) void cLuaState::Push(cHopperEntity * a_Hopper)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Hopper, "cHopperEntity"); tolua_pushusertype(m_LuaState, a_Hopper, "cHopperEntity");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;
@ -693,7 +663,6 @@ void cLuaState::Push(cHopperEntity * a_Hopper)
void cLuaState::Push(cBlockEntity * a_BlockEntity) void cLuaState::Push(cBlockEntity * a_BlockEntity)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_BlockEntity, "cBlockEntity"); tolua_pushusertype(m_LuaState, a_BlockEntity, "cBlockEntity");
m_NumCurrentFunctionArgs += 1; m_NumCurrentFunctionArgs += 1;

View File

@ -48,6 +48,16 @@ cLuaWindow::cLuaWindow(cWindow::WindowType a_WindowType, int a_SlotsX, int a_Slo
cLuaWindow::~cLuaWindow() cLuaWindow::~cLuaWindow()
{ {
m_Contents.RemoveListener(*this);
// Must delete slot areas now, because they are referencing this->m_Contents and would try to access it in cWindow's
// destructor, when the member is already gone.
for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
{
delete *itr;
}
m_SlotAreas.clear();
ASSERT(m_OpenedBy.empty()); ASSERT(m_OpenedBy.empty());
} }

View File

@ -478,6 +478,18 @@ void cRoot::SaveAllChunks(void)
void cRoot::BroadcastChat(const AString & a_Message)
{
for (WorldMap::iterator itr = m_WorldsByName.begin(), end = m_WorldsByName.end(); itr != end; ++itr)
{
itr->second->BroadcastChat(a_Message);
} // for itr - m_WorldsByName[]
}
bool cRoot::ForEachPlayer(cPlayerListCallback & a_Callback) bool cRoot::ForEachPlayer(cPlayerListCallback & a_Callback)
{ {
for (WorldMap::iterator itr = m_WorldsByName.begin(), itr2 = itr; itr != m_WorldsByName.end(); itr = itr2) for (WorldMap::iterator itr = m_WorldsByName.begin(), itr2 = itr; itr != m_WorldsByName.end(); itr = itr2)

View File

@ -95,6 +95,9 @@ public:
/// Saves all chunks in all worlds /// Saves all chunks in all worlds
void SaveAllChunks(void); // tolua_export void SaveAllChunks(void); // tolua_export
/// Sends a chat message to all connected clients (in all worlds)
void BroadcastChat(const AString & a_Message); // tolua_export
/// Calls the callback for each player in all worlds /// Calls the callback for each player in all worlds
bool ForEachPlayer(cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS << bool ForEachPlayer(cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<

View File

@ -355,8 +355,13 @@ bool cServer::Tick(float a_Dt)
m_PlayerCount += PlayerCountDiff; m_PlayerCount += PlayerCountDiff;
} }
// Send the tick to the plugins, as well as let the plugin manager reload, if asked to (issue #102):
cPluginManager::Get()->Tick(a_Dt);
// Let the Root process all the queued commands:
cRoot::Get()->TickCommands(); cRoot::Get()->TickCommands();
// Tick all clients not yet assigned to a world:
TickClients(a_Dt); TickClients(a_Dt);
if (!m_bRestarting) if (!m_bRestarting)

View File

@ -8,7 +8,7 @@
cTNTEntity::cTNTEntity(double a_X, double a_Y, double a_Z, float a_FuseTimeInSec) : cTNTEntity::cTNTEntity(double a_X, double a_Y, double a_Z, double a_FuseTimeInSec) :
super(etTNT, a_X, a_Y, a_Z, 0.98, 0.98), super(etTNT, a_X, a_Y, a_Z, 0.98, 0.98),
m_Counter(0), m_Counter(0),
m_MaxFuseTime(a_FuseTimeInSec) m_MaxFuseTime(a_FuseTimeInSec)
@ -19,7 +19,7 @@ cTNTEntity::cTNTEntity(double a_X, double a_Y, double a_Z, float a_FuseTimeInSec
cTNTEntity::cTNTEntity(const Vector3d & a_Pos, float a_FuseTimeInSec) : cTNTEntity::cTNTEntity(const Vector3d & a_Pos, double a_FuseTimeInSec) :
super(etTNT, a_Pos.x, a_Pos.y, a_Pos.z, 0.98, 0.98), super(etTNT, a_Pos.x, a_Pos.y, a_Pos.z, 0.98, 0.98),
m_Counter(0), m_Counter(0),
m_MaxFuseTime(a_FuseTimeInSec) m_MaxFuseTime(a_FuseTimeInSec)

View File

@ -16,8 +16,8 @@ class cTNTEntity :
public: public:
CLASS_PROTODEF(cTNTEntity); CLASS_PROTODEF(cTNTEntity);
cTNTEntity(double a_X, double a_Y, double a_Z, float a_FuseTimeInSec); cTNTEntity(double a_X, double a_Y, double a_Z, double a_FuseTimeInSec);
cTNTEntity(const Vector3d & a_Pos, float a_FuseTimeInSec); cTNTEntity(const Vector3d & a_Pos, double a_FuseTimeInSec);
// cEntity overrides: // cEntity overrides:
virtual bool Initialize(cWorld * a_World) override; virtual bool Initialize(cWorld * a_World) override;
@ -25,8 +25,8 @@ public:
virtual void Tick(float a_Dt, cChunk & a_Chunk) override; virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
protected: protected:
float m_Counter; ///< How much time has elapsed since the object was created, in seconds double m_Counter; ///< How much time has elapsed since the object was created, in seconds
float m_MaxFuseTime; ///< How long the fuse is, in seconds double m_MaxFuseTime; ///< How long the fuse is, in seconds
}; };