summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt23
-rw-r--r--GETTING-STARTED.md6
-rw-r--r--MCServer/Plugins/APIDump/APIDesc.lua16
-rw-r--r--MCServer/Plugins/APIDump/APIDump.deproj3
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPluginMessage.lua25
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPluginsLoaded.lua11
-rw-r--r--MCServer/profile_run.cmd96
-rw-r--r--MCServer/profile_run_debug.cmd5
-rw-r--r--Nightbuild2008.cmd12
-rw-r--r--Tools/ProtoProxy/Connection.cpp2
-rw-r--r--VC2008/MCServer.vcproj8
-rw-r--r--VC2008/debug_profile_run.cmd73
-rw-r--r--VC2008/profile_run.cmd73
-rw-r--r--VC2013/MCServer.rc17
-rw-r--r--VC2013/MCServer.vcxproj6
-rw-r--r--VC2013/icon.icobin353118 -> 0 bytes
-rw-r--r--VC2013/resource_MCServer.h5
-rw-r--r--lib/lua/CMakeLists.txt11
-rw-r--r--lib/zlib/example.c.txt (renamed from lib/zlib/example.c)0
-rw-r--r--lib/zlib/minigzip.c.txt (renamed from lib/zlib/minigzip.c)0
-rw-r--r--src/Bindings/LuaState.cpp12
-rw-r--r--src/Bindings/LuaState.h1
-rw-r--r--src/Bindings/PluginLua.cpp2
-rw-r--r--src/Bindings/virtual_method_hooks.lua8
-rw-r--r--src/CMakeLists.txt28
-rw-r--r--src/ClientHandle.h6
-rw-r--r--src/MCServer.vcproj.user167
-rw-r--r--src/OSSupport/Socket.cpp4
-rw-r--r--src/Protocol/Protocol17x.cpp25
-rw-r--r--src/Resources/MCServer.rc (renamed from VC2008/MCServer.rc)0
-rw-r--r--src/Resources/icon.ico (renamed from VC2008/icon.ico)bin353118 -> 353118 bytes
-rw-r--r--src/Resources/icon_128.png (renamed from VC2008/icon_128.png)bin26758 -> 26758 bytes
-rw-r--r--src/Resources/icon_256.png (renamed from VC2008/icon_256.png)bin66137 -> 66137 bytes
-rw-r--r--src/Resources/resource_MCServer.h (renamed from VC2008/resource_MCServer.h)0
34 files changed, 436 insertions, 209 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 416290df1..c39fe679c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,12 +46,20 @@ else()
add_flags_cxx("-pthread")
endif()
-# Allow for a forced 32-bit build under 32-bit OS:
+
+# Allow for a forced 32-bit build under 64-bit OS:
if (FORCE_32)
add_flags_cxx("-m32")
add_flags_lnk("-m32")
endif()
+
+# Have the compiler generate code specifically targeted at the current machine on Linux
+if(LINUX AND NOT CROSSCOMPILE)
+ add_flags_cxx("-march=native")
+endif()
+
+
# Set lower warnings-level for the libraries:
if (MSVC)
# Remove /W3 from command line -- cannot just cancel it later with /w like in unix, MSVC produces a D9025 warning (option1 overriden by option2)
@@ -66,16 +74,19 @@ else()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -w")
endif()
+
# Under clang, we need to disable ASM support in CryptoPP:
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_definitions(-DCRYPTOPP_DISABLE_ASM)
endif()
+
# Under Windows, we need Lua as DLL; on *nix we need it linked statically:
if (WIN32)
add_definitions(-DLUA_BUILD_AS_DLL)
endif()
+
# On Unix we use two dynamic loading libraries dl and ltdl.
# Preference is for dl on unknown systems as it is specified in POSIX
# the dynamic loader is used by lua and sqllite.
@@ -87,6 +98,7 @@ if (UNIX)
endif()
endif()
+
# The Expat library is linked in statically, make the source files aware of that:
add_definitions(-DXML_STATIC)
@@ -100,6 +112,7 @@ else()
set (LNK_PROFILING "-pg")
endif()
+
# Declare the profiling configurations:
SET(CMAKE_CXX_FLAGS_DEBUGPROFILE
"${CMAKE_CXX_FLAGS_DEBUG} ${PCXX_ROFILING}"
@@ -124,19 +137,19 @@ MARK_AS_ADVANCED(
CMAKE_SHARED_LINKER_FLAGS_DEBUGPROFILE )
SET(CMAKE_CXX_FLAGS_RELEASEPROFILE
- "${CMAKE_CXX_FLAGS_DEBUG} ${CXX_PROFILING}"
+ "${CMAKE_CXX_FLAGS_RELEASE} ${CXX_PROFILING}"
CACHE STRING "Flags used by the C++ compiler during profile builds."
FORCE )
SET(CMAKE_C_FLAGS_RELEASEPROFILE
- "${CMAKE_C_FLAGS_DEBUG} ${CXX_PROFILING}"
+ "${CMAKE_C_FLAGS_RELEASE} ${CXX_PROFILING}"
CACHE STRING "Flags used by the C compiler during profile builds."
FORCE )
SET(CMAKE_EXE_LINKER_FLAGS_RELEASEPROFILE
- "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${LNK_PROFILING}"
+ "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${LNK_PROFILING}"
CACHE STRING "Flags used for linking binaries during profile builds."
FORCE )
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASEPROFILE
- "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${LNK_PROFILING}"
+ "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${LNK_PROFILING}"
CACHE STRING "Flags used by the shared libraries linker during profile builds."
FORCE )
MARK_AS_ADVANCED(
diff --git a/GETTING-STARTED.md b/GETTING-STARTED.md
index 66318a629..1ac6fe989 100644
--- a/GETTING-STARTED.md
+++ b/GETTING-STARTED.md
@@ -102,14 +102,14 @@ There are a few fairly easy issues for you to get started with, as well as some
* #288
* #385
* #402
- * #388
- * #380
+ * #380
+ * #503
+ * #491
* Clean up some of the compiler warnings. (Check [Travis CI](http://travis-ci.org/mc-server/MCServer) for a list of them.) With clang, there are over 10000 lines of warnings to clean up.
**More Difficult**:
* #17
- * #418
* #398
You may also want to write some plugins. They are written in lua, with excellent API documentation available via [APIDump](http://mc-server.xoft.cz/LuaAPI). The [Core](https://github.com/mc-server/Core) plugin should also help quite a bit here.
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 9b117b0fa..0dc059cbd 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -449,6 +449,7 @@ end
GetUsername = { Params = "", Return = "string", Notes = "Returns the username that the client has provided" },
GetViewDistance = { Params = "", Return = "number", Notes = "Returns the viewdistance (number of chunks loaded for the player in each direction)" },
Kick = { Params = "Reason", Return = "", Notes = "Kicks the user with the specified reason" },
+ SendPluginMessage = { Params = "Channel, Message", Return = "", Notes = "Sends the plugin message on the specified channel." },
SetUsername = { Params = "Name", Return = "", Notes = "Sets the username" },
SetViewDistance = { Params = "ViewDistance", Return = "", Notes = "Sets the viewdistance (number of chunks loaded for the player in each direction)" },
SendBlockChange = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta", Return = "", Notes = "Sends a BlockChange packet to the client. This can be used to create fake blocks only for that player." },
@@ -706,7 +707,9 @@ end
IsBoat = { Params = "", Return = "bool", Notes = "Returns true if the entity is a {{cBoat|boat}}." },
IsCrouched = { Params = "", Return = "bool", Notes = "Returns true if the entity is crouched. Always false for entities that don't support crouching." },
IsDestroyed = { Params = "", Return = "bool", Notes = "Returns true if the entity has been destroyed and is awaiting removal from the internal structures." },
+ IsExpOrb = { Params = "", Return = "bool", Notes = "Returns true if the entity represents an experience orb" },
IsFallingBlock = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a {{cFallingBlock}} entity." },
+ IsFloater = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a fishing rod floater" },
IsInvisible = { Params = "", Return = "bool", Notes = "Returns true if the entity is invisible" },
IsMinecart = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a {{cMinecart|minecart}}" },
IsMob = { Params = "", Return = "bool", Notes = "Returns true if the entity represents any {{cMonster|mob}}." },
@@ -767,6 +770,7 @@ end
etEntity = { Notes = "No further specialization available" },
etExpOrb = { Notes = "The entity is a {{cExpOrb}}" },
etFallingBlock = { Notes = "The entity is a {{cFallingBlock}}" },
+ etFloater = { Notes = "The entity is a fishing rod floater" },
etMob = { Notes = "The entity is a {{cMonster}} descendant" },
etMonster = { Notes = "The entity is a {{cMonster}} descendant" },
etMinecart = { Notes = "The entity is a {{cMinecart}} descendant" },
@@ -804,6 +808,7 @@ cFile:Delete("/usr/bin/virus.exe");
GetSize = { Params = "FileName", Return = "number", Notes = "(STATIC) Returns the size of the file, or -1 on failure." },
IsFile = { Params = "Path", Return = "bool", Notes = "(STATIC) Returns true if the specified path points to an existing file." },
IsFolder = { Params = "Path", Return = "bool", Notes = "(STATIC) Returns true if the specified path points to an existing folder." },
+ ReadWholeFile = { Params = "FileName", Return = "string", Notes = "(STATIC) Returns the entire contents of the specified file. Returns an empty string if the file cannot be opened." },
Rename = { Params = "OrigPath, NewPath", Return = "bool", Notes = "(STATIC) Renames a file or a folder. Returns true if successful. Undefined result if NewPath already exists." },
},
}, -- cFile
@@ -1583,6 +1588,7 @@ a_Player:OpenWindow(Window);
GetEquippedItem = { Params = "", Return = "{{cItem}}", Notes = "Returns the item that the player is currently holding; empty item if holding nothing." },
GetEyeHeight = { Return = "number", Notes = "Returns the height of the player's eyes, in absolute coords" },
GetEyePosition = { Return = "{{Vector3d|EyePositionVector}}", Notes = "Returns the position of the player's eyes, as a {{Vector3d}}" },
+ GetFloaterID = { Params = "", Return = "number", Notes = "Returns the Entity ID of the fishing hook floater that belongs to the player. Returns -1 if no floater is associated with the player. FIXME: Undefined behavior when the player has used multiple fishing rods simultanously." },
GetFoodExhaustionLevel = { Params = "", Return = "number", Notes = "Returns the food exhaustion level" },
GetFoodLevel = { Params = "", Return = "number", Notes = "Returns the food level (number of half-drumsticks on-screen)" },
GetFoodPoisonedTicksRemaining = { Params = "", Return = "", Notes = "Returns the number of ticks left for the food posoning effect" },
@@ -1607,6 +1613,7 @@ a_Player:OpenWindow(Window);
HasPermission = { Params = "PermissionString", Return = "bool", Notes = "Returns true if the player has the specified permission" },
Heal = { Params = "HitPoints", Return = "", Notes = "Heals the player by the specified amount of HPs. Only positive amounts are expected. Sends a health update to the client." },
IsEating = { Params = "", Return = "bool", Notes = "Returns true if the player is currently eating the item in their hand." },
+ IsFishing = { Params = "", Return = "bool", Notes = "Returns true if the player is currently fishing" },
IsFlying = { Return = "bool", Notes = "Returns true if the player is flying." },
IsGameModeAdventure = { Params = "", Return = "bool", Notes = "Returns true if the player is in the gmAdventure gamemode, or has their gamemode unset and the world is a gmAdventure world." },
IsGameModeCreative = { Params = "", Return = "bool", Notes = "Returns true if the player is in the gmCreative gamemode, or has their gamemode unset and the world is a gmCreative world." },
@@ -1634,6 +1641,7 @@ a_Player:OpenWindow(Window);
SetFoodSaturationLevel = { Params = "FoodSaturationLevel", Return = "", Notes = "Sets the food saturation (overcharge of the food level)." },
SetFoodTickTimer = { Params = "FoodTickTimer", Return = "", Notes = "Sets the number of ticks past the last food-based heal or damage action; when this timer reaches 80, a new heal / damage is applied." },
SetGameMode = { Params = "{{eGameMode|NewGameMode}}", Return = "", Notes = "Sets the gamemode for the player. The new gamemode overrides the world's default gamemode, unless it is set to gmInherit." },
+ SetIsFishing = { Params = "IsFishing, [FloaterEntityID]", Return = "", Notes = "Sets the 'IsFishing' flag for the player. The floater entity ID is expected for the true variant, it can be omitted when IsFishing is false. FIXME: Undefined behavior when multiple fishing rods are used simultanously" },
SetName = { Params = "Name", Return = "", Notes = "Sets the player name. This rename will NOT be visible to any players already in the server who are close enough to see this player." },
SetNormalMaxSpeed = { Params = "NormalMaxSpeed", Return = "", Notes = "Sets the normal (walking) maximum speed (as reported by the 1.6.1+ protocols)" },
SetSprint = { Params = "IsSprinting", Return = "", Notes = "Sets whether the player is sprinting or not." },
@@ -1754,6 +1762,8 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);
HOOK_PLAYER_BREAKING_BLOCK = { Notes = "Called when a player is about to break a block. A plugin may cancel the event." },
HOOK_PLAYER_BROKEN_BLOCK = { Notes = "Called after a player has broken a block." },
HOOK_PLAYER_EATING = { Notes = "Called when the player starts eating a held item. Plugins may abort the eating." },
+ HOOK_PLAYER_FISHED = { Notes = "Called when the player reels the fishing rod back in, after the server decides the player's fishing reward." },
+ HOOK_PLAYER_FISHING = { Notes = "Called when the player reels the fishing rod back in, plugins may alter the fishing reward." },
HOOK_PLAYER_JOINED = { Notes = "Called when the player entity has been created. It has not yet been fully initialized." },
HOOK_PLAYER_LEFT_CLICK = { Notes = "Called when the client sends the LeftClick packet." },
HOOK_PLAYER_MOVING = { Notes = "Called when the player has moved and the movement is now being applied." },
@@ -1989,6 +1999,7 @@ end
Functions =
{
+ BroadcastBlockAction = { Params = "BlockX, BlockY, BlockZ, ActionByte1, ActionByte2, BlockType, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Broadcasts the BlockAction packet to all clients who have the appropriate chunk loaded (except ExcludeClient). The contents of the packet are specified by the parameters for the call, the blocktype needn't match the actual block that is present in the world data at the specified location." },
BroadcastChat = { Params = "Message, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Sends the Message to all players in this world, except the optional ExceptClient" },
BroadcastSoundEffect = { Params = "SoundName, X, Y, Z, Volume, Pitch, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Sends the specified sound effect to all players in this world, except the optional ExceptClient" },
BroadcastSoundParticleEffect = { Params = "EffectID, X, Y, Z, EffectData, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Sends the specified effect to all players in this world, except the optional ExceptClient" },
@@ -2004,6 +2015,7 @@ end
DoWithDropperAt = { Params = "X, Y, Z, CallbackFunction, [CallbackData]", Return = "bool", Notes = "If there is a dropper at the specified coords, calls the CallbackFunction with the {{cDropperEntity}} parameter representing the dropper. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cDropperEntity|DropperEntity}}, [CallbackData])</pre> The function returns false if there is no dropper, or if there is, it returns the bool value that the callback has returned." },
DoWithEntityByID = { Params = "EntityID, CallbackFunction, [CallbackData]", Return = "bool", Notes = "If an entity with the specified ID exists, calls the callback with the {{cEntity}} parameter representing the entity. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}}, [CallbackData])</pre> The function returns false if the entity was not found, and it returns the same bool value that the callback has returned if the entity was found." },
DoWithFurnaceAt = { Params = "X, Y, Z, CallbackFunction, [CallbackData]", Return = "bool", Notes = "If there is a furnace at the specified coords, calls the CallbackFunction with the {{cFurnaceEntity}} parameter representing the furnace. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cFurnaceEntity|FurnaceEntity}}, [CallbackData])</pre> The function returns false if there is no furnace, or if there is, it returns the bool value that the callback has returned." },
+ DoWithNoteBlockAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "If there is a note block at the specified coords, calls the CallbackFunction with the {{cNoteEntity}} parameter representing the note block. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cNoteEntity|NoteEntity}}, [CallbackData])</pre> The function returns false if there is no note block, or if there is, it returns the bool value that the callback has returned." },
DoWithPlayer = { Params = "PlayerName, CallbackFunction, [CallbackData]", Return = "bool", Notes = "If there is a player of the specified name (exact match), calls the CallbackFunction with the {{cPlayer}} parameter representing the player. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}}, [CallbackData])</pre> The function returns false if the player was not found, or whatever bool value the callback returned if the player was found." },
FastSetBlock =
{
@@ -2087,6 +2099,7 @@ end
SetTicksUntilWeatherChange = { Params = "NumTicks", Return = "", Notes = "Sets the number of ticks after which the weather will be changed." },
SetTimeOfDay = { Params = "TimeOfDayTicks", Return = "", Notes = "Sets the time of day, expressed as number of ticks past sunrise, in the range 0 .. 24000." },
SetWeather = { Params = "Weather", Return = "", Notes = "Sets the current weather (wSunny, wRain, wStorm) and resets the TicksUntilWeatherChange to the default value for the new weather. The normal weather-changing hooks are called for the change." },
+ ShouldLavaSpawnFire = { Params = "", Return = "bool", Notes = "Returns true if the world is configured to spawn fires near lava (world.ini: [Physics].ShouldLavaSpawnFire value)" },
SpawnItemPickups =
{
{ Params = "{{cItems|Pickups}}, X, Y, Z, FlyAwaySpeed", Return = "", Notes = "Spawns the specified pickups at the position specified. The FlyAway speed is used to initialize the random speed in which the pickups fly away from the spawn position." },
@@ -2580,7 +2593,9 @@ end
DamageTypeToString = {Params = "{{Globals#DamageType|DamageType}}", Return = "string", Notes = "Converts the {{Globals#DamageType|DamageType}} enumerated value to a string representation "},
EscapeString = {Params = "string", Return = "string", Notes = "Returns a copy of the string with all quotes and backslashes escaped by a backslash"},
GetChar = {Params = "String, Pos", Return = "string", Notes = "Returns one character from the string, specified by position "},
+ GetIniItemSet = { Params = "IniFile, SectionName, KeyName, DefaultValue", Return = "{{cItem}}", Notes = "Returns the item that has been read from the specified INI file value. If the value is not present in the INI file, the DefaultValue is stored in the file and parsed as the result. Returns empty item if the value cannot be parsed. " },
GetTime = {Return = "number", Notes = "Returns the current OS time, as a unix time stamp (number of seconds since Jan 1, 1970)"},
+ IsBiomeNoDownfall = { Params = "Biome", Return = "bool", Notes = "Returns true if the biome is 'dry', that is, there is no precipitation during rains and storms." },
IsValidBlock = {Params = "BlockType", Return = "bool", Notes = "Returns true if BlockType is a known block type"},
IsValidItem = {Params = "ItemType", Return = "bool", Notes = "Returns true if ItemType is a known item type"},
ItemToFullString = {Params = "{{cItem|cItem}}", Return = "string", Notes = "Returns the string representation of the item, in the format 'ItemTypeText:ItemDamage * Count'"},
@@ -2592,6 +2607,7 @@ end
LOGWARN = {Params = "string", Notes = "Logs a text into the server console using 'warning' severity (red text); OBSOLETE, use LOGWARNING() instead"},
LOGWARNING = {Params = "string", Notes = "Logs a text into the server console using 'warning' severity (red text)"},
NoCaseCompare = {Params = "string, string", Return = "number", Notes = "Case-insensitive string comparison; returns 0 if the strings are the same"},
+ NormalizeAngleDegrees = { Params = "AngleDegrees", Return = "AngleDegrees", Notes = "Returns the angle, wrapped into the [-180, +180) range." },
ReplaceString = {Params = "full-string, to-be-replaced-string, to-replace-string", Notes = "Replaces *each* occurence of to-be-replaced-string in full-string with to-replace-string"},
StringSplit = {Params = "string, SeperatorsString", Return = "array table of strings", Notes = "Seperates string into multiple by splitting every time any of the characters in SeperatorsString is encountered."},
StringSplitAndTrim = {Params = "string, SeperatorsString", Return = "array table of strings", Notes = "Seperates string into multiple by splitting every time any of the characters in SeperatorsString is encountered. Each of the separate strings is trimmed (whitespace removed from the beginning and end of the string)"},
diff --git a/MCServer/Plugins/APIDump/APIDump.deproj b/MCServer/Plugins/APIDump/APIDump.deproj
index dffe3eaee..e78974901 100644
--- a/MCServer/Plugins/APIDump/APIDump.deproj
+++ b/MCServer/Plugins/APIDump/APIDump.deproj
@@ -115,6 +115,9 @@
<filename>Hooks\OnPlayerUsingItem.lua</filename>
</file>
<file>
+ <filename>Hooks\OnPluginMessage.lua</filename>
+ </file>
+ <file>
<filename>Hooks\OnPostCrafting.lua</filename>
</file>
<file>
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPluginMessage.lua b/MCServer/Plugins/APIDump/Hooks/OnPluginMessage.lua
new file mode 100644
index 000000000..743d3bb5e
--- /dev/null
+++ b/MCServer/Plugins/APIDump/Hooks/OnPluginMessage.lua
@@ -0,0 +1,25 @@
+return
+{
+ HOOK_PLUGIN_MESSAGE =
+ {
+ CalledWhen = "The server receives a plugin message from a client",
+ DefaultFnName = "OnPluginMessage", -- also used as pagename
+ Desc = [[
+ A plugin may implement an OnPluginMessage() function and register it as a Hook to process plugin messages
+ from the players. The function is then called for every plugin message sent from any player.
+ ]],
+ Params = {
+ { Name = "Client", Type = "{{cClientHandle}}", Notes = "The client who sent the plugin message" },
+ { Name = "Channel", Type = "string", Notes = "The channel on which the message was sent" },
+ { Name = "Message", Type = "string", Notes = "The message's payload" },
+ },
+ Returns = [[
+ If the function returns false or no value, other plugins' callbacks are called. If the function
+ returns true, no other callbacks are called for this event.
+ ]],
+ }, -- HOOK_CHAT
+}
+
+
+
+
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPluginsLoaded.lua b/MCServer/Plugins/APIDump/Hooks/OnPluginsLoaded.lua
index 0d5b7271e..2c8a5a2c9 100644
--- a/MCServer/Plugins/APIDump/Hooks/OnPluginsLoaded.lua
+++ b/MCServer/Plugins/APIDump/Hooks/OnPluginsLoaded.lua
@@ -37,12 +37,14 @@ local function SendMessageFailureFallback(a_Player, a_Message)
end
-- These three "variables" will hold the actual functions to call.
--- By default they are initialized to the Fallback variants, but will be redirected to Core when all plugins load
+-- By default they are initialized to the Fallback variants,
+-- but will be redirected to Core when all plugins load
SendMessage = SendMessageFallback;
SendMessageSuccess = SendMessageSuccessFallback;
SendMessageFailure = SendMessageFailureFallback;
--- The callback tries to connect to the Core, if successful, overwrites the three functions with Core ones
+-- The callback tries to connect to the Core
+-- If successful, overwrites the three functions with Core ones
local function OnPluginsLoaded()
local CorePlugin = cPluginManager:Get():GetPlugin("Core");
if (CorePlugin == nil) then
@@ -67,7 +69,10 @@ cPluginManager.AddHook(cPluginManager.HOOK_PLUGINS_LOADED, CoreMessagingPluginsL
-- Usage, anywhere else in the plugin:
-SendMessageFailure(a_Player, "Cannot teleport to player, the destination player " .. PlayerName .. " was not found");
+SendMessageFailure(
+ a_Player,
+ "Cannot teleport to player, the destination player " .. PlayerName .. " was not found"
+);
]],
},
} , -- CodeExamples
diff --git a/MCServer/profile_run.cmd b/MCServer/profile_run.cmd
new file mode 100644
index 000000000..58efea64a
--- /dev/null
+++ b/MCServer/profile_run.cmd
@@ -0,0 +1,96 @@
+@echo off
+::
+:: Profiling using a MSVC standalone profiler
+::
+:: See http://www.codeproject.com/Articles/144643/Profiling-of-C-Applications-in-Visual-Studio-for-F for details
+:: Note that this script assumes a newer version of the tool, Performance Tools 2010, so that it is Win7-compatible
+:: Download at http://www.microsoft.com/en-ca/download/details.aspx?id=23205
+::
+:: This script sets the profiler up, then starts the app, waits for it to finish and stops the profiler.
+:: Then it generates all the CSV report files
+::
+:: It expects the MS Performance tools installed in C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Performance Tools
+:: You can override this path by setting the pt environment variable prior to launching this script
+::
+:: By default it will launch the release version of MCServer; set the app environment variable to another executable to run that instead.
+:: Note that the app needs to be compiled with the "/PROFILE" flag in order for the profiling to work
+
+
+
+
+setlocal
+
+:: Get the 32-bit program files folder
+:: Note that in Win7 the %ProgramFiles% variable points to 32-bit program files for normal users and to 64-bit program files for elevated users
+:: This script needs elevation, but the performance tools are 32-bit only
+if "%programfiles(x86)%p" == "p" (
+ set ProgFiles="%ProgramFiles%"
+) else (
+ set ProgFiles="%ProgramFiles(x86)%"
+)
+
+:: Check that the required variables exist, provide defaults:
+if %pt%n == n (
+ set pt="%ProgFiles:"=%\Microsoft Visual Studio 10.0\Team Tools\Performance Tools"
+)
+
+if %app%n == n (
+ set app=MCServer_profile.exe
+)
+
+if %outputdir%n == n (
+ set outputdir=..\Profiling
+)
+
+
+
+
+::Create the output directory, if it didn't exist
+mkdir %outputdir%
+
+
+
+
+
+:: Start the profiler
+set outputname=profile.vsp
+set output=%outputdir%\%outputname%
+%pt%\vsperfcmd /start:sample /output:%output%
+if errorlevel 1 goto haderror
+
+:: Launch the application via the profiler
+%pt%\vsperfcmd /launch:%app%
+if errorlevel 1 goto haderror
+
+:: Shut down the profiler (this command waits, until the application is terminated)
+%pt%\vsperfcmd /shutdown
+if errorlevel 1 goto haderror
+
+
+
+
+
+:: cd to outputdir, so that the reports are generated there
+cd %outputdir%
+
+:: generate the report files (.csv)
+%pt%\vsperfreport /summary:all %outputname% /symbolpath:"srv*C:\Programovani\Symbols*http://msdl.microsoft.com/download/symbols"
+if errorlevel 1 goto haderror
+
+
+
+
+
+goto finished
+
+
+
+
+:haderror
+echo An error was encountered
+pause
+
+
+
+
+:finished
diff --git a/MCServer/profile_run_debug.cmd b/MCServer/profile_run_debug.cmd
new file mode 100644
index 000000000..8bf85f049
--- /dev/null
+++ b/MCServer/profile_run_debug.cmd
@@ -0,0 +1,5 @@
+@echo off
+:: This script uses the profile_run.cmd script to run profiling on the DebugProfile executable
+
+set app=MCServer_debug_profile.exe
+call profile_run.cmd \ No newline at end of file
diff --git a/Nightbuild2008.cmd b/Nightbuild2008.cmd
index 8dcd5dc46..bbaea0fb7 100644
--- a/Nightbuild2008.cmd
+++ b/Nightbuild2008.cmd
@@ -90,6 +90,16 @@ if exist %TAGFILE% (
+
+
+:: Configure the sources to use the MSVC2008 compiler:
+cmake -G "Visual Studio 9 2008" .
+if errorlevel 1 goto haderror
+
+
+
+
+
:: Update the Bindings:
echo Updating Lua bindings
del src\Bindings\Bindings.cpp
@@ -107,7 +117,7 @@ echo Setting up VS environment...
call "%VS90COMNTOOLS%\vsvars32.bat"
echo Compiling MCServer...
title MCS Nightbuild
-start "vc" /b /wait /low /min %vc% /r vc2008\MCServer.sln "Release|Win32"
+start "vc" /b /wait /low /min %vc% /r MCServer.sln "Release|Win32"
if errorlevel 1 goto haderror
diff --git a/Tools/ProtoProxy/Connection.cpp b/Tools/ProtoProxy/Connection.cpp
index f38ea02ed..de67c6e43 100644
--- a/Tools/ProtoProxy/Connection.cpp
+++ b/Tools/ProtoProxy/Connection.cpp
@@ -1249,7 +1249,7 @@ bool cConnection::HandleServerLoginDisconnect(void)
HANDLE_SERVER_PACKET_READ(ReadVarUTF8String, AString, Reason);
Log("Received a login-disconnect packet from the server:");
Log(" Reason = \"%s\"", Reason.c_str());
- COPY_TO_SERVER();
+ COPY_TO_CLIENT();
return true;
}
diff --git a/VC2008/MCServer.vcproj b/VC2008/MCServer.vcproj
index f835819a6..0927f2f7b 100644
--- a/VC2008/MCServer.vcproj
+++ b/VC2008/MCServer.vcproj
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9.00"
+ Version="9,00"
Name="MCServer"
ProjectGUID="{32012054-0C96-4C43-AB27-174FF8E72D66}"
RootNamespace="MCServer"
@@ -413,15 +413,15 @@
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
- RelativePath=".\icon.ico"
+ RelativePath="..\src\Resources\icon.ico"
>
</File>
<File
- RelativePath=".\MCServer.rc"
+ RelativePath="..\src\Resources\MCServer.rc"
>
</File>
<File
- RelativePath=".\resource_MCServer.h"
+ RelativePath="..\src\Resources\resource_MCServer.h"
>
</File>
<File
diff --git a/VC2008/debug_profile_run.cmd b/VC2008/debug_profile_run.cmd
deleted file mode 100644
index a078768d0..000000000
--- a/VC2008/debug_profile_run.cmd
+++ /dev/null
@@ -1,73 +0,0 @@
-@echo off
-::
-:: Profiling using a MSVC standalone profiler
-::
-:: See http://www.codeproject.com/Articles/144643/Profiling-of-C-Applications-in-Visual-Studio-for-F for details
-::
-
-
-
-
-set pt="C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Performance Tools"
-set appdir=..\MCServer
-set app=MCServer_dbgprof.exe
-
-:: outputdir is relative to appdir!
-set outputdir=..\Profiling
-set outputname=profile.vsp
-set output=%outputdir%\%outputname%
-
-
-
-
-
-:: Must cd to MCServer's directory so that it can find settings.ini etc.
-cd %appdir%
-
-::Create the output directory, if it didn't exist
-mkdir %outputdir%
-
-
-
-
-
-:: Start the profiler
-%pt%\vsperfcmd /start:sample /output:%output%
-if errorlevel 1 goto haderror
-
-:: Launch the application via the profiler
-%pt%\vsperfcmd /launch:%app%
-if errorlevel 1 goto haderror
-
-:: Shut down the profiler (this command waits, until the application is terminated)
-%pt%\vsperfcmd /shutdown
-if errorlevel 1 goto haderror
-
-
-
-
-
-:: cd to outputdir, so that the reports are generated there
-cd %outputdir%
-
-:: generate the report files (.csv)
-%pt%\vsperfreport /summary:all %outputname% /symbolpath:"srv*C:\Programovani\Symbols*http://msdl.microsoft.com/download/symbols"
-if errorlevel 1 goto haderror
-
-
-
-
-
-goto finished
-
-
-
-
-:haderror
-echo An error was encountered
-pause
-
-
-
-
-:finished
diff --git a/VC2008/profile_run.cmd b/VC2008/profile_run.cmd
deleted file mode 100644
index e8e6eb11b..000000000
--- a/VC2008/profile_run.cmd
+++ /dev/null
@@ -1,73 +0,0 @@
-@echo off
-::
-:: Profiling using a MSVC standalone profiler
-::
-:: See http://www.codeproject.com/Articles/144643/Profiling-of-C-Applications-in-Visual-Studio-for-F for details
-::
-
-
-
-
-set pt="C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Performance Tools"
-set appdir=..\MCServer
-set app=MCServer_profiled.exe
-
-:: outputdir is relative to appdir!
-set outputdir=..\Profiling
-set outputname=profile.vsp
-set output=%outputdir%\%outputname%
-
-
-
-
-
-:: Must cd to MCServer's directory so that it can find settings.ini etc.
-cd %appdir%
-
-::Create the output directory, if it didn't exist
-mkdir %outputdir%
-
-
-
-
-
-:: Start the profiler
-%pt%\vsperfcmd /start:sample /output:%output%
-if errorlevel 1 goto haderror
-
-:: Launch the application via the profiler
-%pt%\vsperfcmd /launch:%app%
-if errorlevel 1 goto haderror
-
-:: Shut down the profiler (this command waits, until the application is terminated)
-%pt%\vsperfcmd /shutdown
-if errorlevel 1 goto haderror
-
-
-
-
-
-:: cd to outputdir, so that the reports are generated there
-cd %outputdir%
-
-:: generate the report files (.csv)
-%pt%\vsperfreport /summary:all %outputname% /symbolpath:"srv*C:\Programovani\Symbols*http://msdl.microsoft.com/download/symbols"
-if errorlevel 1 goto haderror
-
-
-
-
-
-goto finished
-
-
-
-
-:haderror
-echo An error was encountered
-pause
-
-
-
-
-:finished
diff --git a/VC2013/MCServer.rc b/VC2013/MCServer.rc
deleted file mode 100644
index e0fbbea5d..000000000
--- a/VC2013/MCServer.rc
+++ /dev/null
@@ -1,17 +0,0 @@
-// Generated by ResEdit 1.5.11
-// Copyright (C) 2006-2012
-// http://www.resedit.net
-
-#include <windows.h>
-#include <commctrl.h>
-#include <richedit.h>
-#include "resource_MCServer.h"
-
-
-
-
-//
-// Icon resources
-//
-LANGUAGE 9, SUBLANG_DEFAULT
-IDI_ICON1 ICON "icon.ico"
diff --git a/VC2013/MCServer.vcxproj b/VC2013/MCServer.vcxproj
index ada5c5134..36c29bf11 100644
--- a/VC2013/MCServer.vcxproj
+++ b/VC2013/MCServer.vcxproj
@@ -218,13 +218,13 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
- <Image Include="icon.ico" />
+ <Image Include="..\src\Resources\icon.ico" />
</ItemGroup>
<ItemGroup>
- <ResourceCompile Include="MCServer.rc" />
+ <ResourceCompile Include="..\src\Resources\MCServer.rc" />
</ItemGroup>
<ItemGroup>
- <ClInclude Include="resource_MCServer.h" />
+ <ClInclude Include="..\src\Resources\resource_MCServer.h" />
<ClInclude Include="..\src\Authenticator.h" />
<ClInclude Include="..\src\BiomeDef.h" />
<ClInclude Include="..\src\BlockArea.h" />
diff --git a/VC2013/icon.ico b/VC2013/icon.ico
deleted file mode 100644
index 4024523a1..000000000
--- a/VC2013/icon.ico
+++ /dev/null
Binary files differ
diff --git a/VC2013/resource_MCServer.h b/VC2013/resource_MCServer.h
deleted file mode 100644
index 42f6c4eaf..000000000
--- a/VC2013/resource_MCServer.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef IDC_STATIC
-#define IDC_STATIC (-1)
-#endif
-
-#define IDI_ICON1 101
diff --git a/lib/lua/CMakeLists.txt b/lib/lua/CMakeLists.txt
index af03f4b1a..4a77578dd 100644
--- a/lib/lua/CMakeLists.txt
+++ b/lib/lua/CMakeLists.txt
@@ -21,6 +21,16 @@ endif()
# Lua needs to be linked dynamically on Windows and statically on *nix, so that LuaRocks work
if (WIN32)
add_library(lua SHARED ${SOURCE})
+ set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/MCServer)
+ if (MSVC)
+ # MSVC generator adds a "Debug" or "Release" postfixes to the LIBRARY_OUTPUT_PATH, we need to cancel them:
+ SET_TARGET_PROPERTIES(lua PROPERTIES PREFIX "../")
+ SET_TARGET_PROPERTIES(lua PROPERTIES IMPORT_PREFIX "../")
+
+ SET_TARGET_PROPERTIES(
+ lua PROPERTIES COMPILE_FLAGS "-D_CRT_SECURE_NO_WARNINGS"
+ )
+ endif()
else()
add_library(lua ${SOURCE})
endif()
@@ -33,3 +43,4 @@ endif()
if (UNIX)
target_link_libraries(lua m ${DYNAMIC_LOADER})
endif()
+
diff --git a/lib/zlib/example.c b/lib/zlib/example.c.txt
index f515a4853..f515a4853 100644
--- a/lib/zlib/example.c
+++ b/lib/zlib/example.c.txt
diff --git a/lib/zlib/minigzip.c b/lib/zlib/minigzip.c.txt
index aa7ac7a04..aa7ac7a04 100644
--- a/lib/zlib/minigzip.c
+++ b/lib/zlib/minigzip.c.txt
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index 149c304ed..00e62fcf6 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -632,18 +632,6 @@ void cLuaState::Push(cTNTEntity * a_TNTEntity)
-void cLuaState::Push(cCreeper * a_Creeper)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_Creeper, "cCreeper");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
void cLuaState::Push(Vector3i * a_Vector)
{
ASSERT(IsValid());
diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h
index a43d39732..414e5e4b2 100644
--- a/src/Bindings/LuaState.h
+++ b/src/Bindings/LuaState.h
@@ -177,7 +177,6 @@ public:
void Push(cWebAdmin * a_WebAdmin);
void Push(const HTTPTemplateRequest * a_Request);
void Push(cTNTEntity * a_TNTEntity);
- void Push(cCreeper * a_Creeper);
void Push(Vector3i * a_Vector);
void Push(void * a_Ptr);
void Push(cHopperEntity * a_Hopper);
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp
index eefcd2b09..4c4664815 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -436,7 +436,7 @@ bool cPluginLua::OnExploding(cWorld & a_World, double & a_ExplosionSize, bool &
{
case esOther: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
case esPrimedTNT: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (cTNTEntity *)a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
- case esCreeper: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (cCreeper *)a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
+ case esMonster: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (cMonster *)a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
case esBed: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (Vector3i *)a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
case esEnderCrystal: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (Vector3i *)a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
case esGhastFireball: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
diff --git a/src/Bindings/virtual_method_hooks.lua b/src/Bindings/virtual_method_hooks.lua
index 15ff1d7f8..c610d424f 100644
--- a/src/Bindings/virtual_method_hooks.lua
+++ b/src/Bindings/virtual_method_hooks.lua
@@ -504,3 +504,11 @@ end
+
+function post_output_hook()
+ print("Bindings have been generated.")
+end
+
+
+
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 853138769..1c031173b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -25,12 +25,34 @@ if (NOT MSVC)
list(REMOVE_ITEM SOURCE "${PROJECT_SOURCE_DIR}/StackWalker.cpp" "${PROJECT_SOURCE_DIR}/LeakFinder.cpp")
+ # If building a windows version, but not using MSVC, add the resources directly to the makefile:
+ if (WIN32)
+ FILE(GLOB ResourceFiles
+ "Resources/*.rc"
+ )
+ list(APPEND SOURCE "${ResourceFiles}")
+ endif()
+
+
else ()
+ # Generate the Bindings if they don't exist:
+ if (NOT EXISTS "${PROJECT_SOURCE_DIR}/Bindings/Bindings.cpp")
+ message("Bindings.cpp not found, generating now")
+ set(tolua_executable ${PROJECT_SOURCE_DIR}/Bindings/tolua++.exe)
+ execute_process(
+ COMMAND ${tolua_executable} -L virtual_method_hooks.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/Bindings
+ )
+ endif()
+
+ # Add all subfolders as solution-folders:
+ list(APPEND FOLDERS "Resources")
function(includefolder PATH)
FILE(GLOB FOLDER_FILES
"${PATH}/*.cpp"
"${PATH}/*.h"
+ "${PATH}/*.rc"
)
source_group("${PATH}" FILES ${FOLDER_FILES})
endfunction(includefolder)
@@ -59,9 +81,9 @@ else ()
SET_SOURCE_FILES_PROPERTIES(
"StackWalker.cpp LeakFinder.h" PROPERTIES COMPILE_FLAGS "/Yc\"Globals.h\""
)
+ list(APPEND SOURCE "Resources/MCServer.rc")
endif()
-
set(EXECUTABLE MCServer)
add_executable(${EXECUTABLE} ${SOURCE})
@@ -78,6 +100,10 @@ endif()
# Make the debug executable have a "_debug" suffix
SET_TARGET_PROPERTIES(${EXECUTABLE} PROPERTIES DEBUG_POSTFIX "_debug")
+# Make the profiled executables have a "_profile" postfix
+SET_TARGET_PROPERTIES(${EXECUTABLE} PROPERTIES DEBUGPROFILE_POSTFIX "_debug_profile")
+SET_TARGET_PROPERTIES(${EXECUTABLE} PROPERTIES RELEASEPROFILE_POSTFIX "_profile")
+
# Precompiled headers (2nd part)
if (MSVC)
diff --git a/src/ClientHandle.h b/src/ClientHandle.h
index 297d62d57..da2704b72 100644
--- a/src/ClientHandle.h
+++ b/src/ClientHandle.h
@@ -171,7 +171,13 @@ public:
void HandleCreativeInventory(short a_SlotNum, const cItem & a_HeldItem);
void HandleDisconnect (const AString & a_Reason);
void HandleEntityAction (int a_EntityID, char a_ActionID);
+
+ /** Called when the protocol handshake has been received (for protocol versions that support it;
+ otherwise the first instant when a username is received).
+ Returns true if the player is to be let in, false if they were disconnected
+ */
bool HandleHandshake (const AString & a_Username);
+
void HandleKeepAlive (int a_KeepAliveID);
void HandleLeftClick (int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status);
void HandlePing (void);
diff --git a/src/MCServer.vcproj.user b/src/MCServer.vcproj.user
new file mode 100644
index 000000000..b17909f71
--- /dev/null
+++ b/src/MCServer.vcproj.user
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="9,00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command="$(TargetPath)"
+ WorkingDirectory="..\MCServer"
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor="0"
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="DebugProfile|Win32"
+ >
+ <DebugSettings
+ Command="$(TargetPath)"
+ WorkingDirectory="..\MCServer"
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor="0"
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="MinSizeRel|Win32"
+ >
+ <DebugSettings
+ Command="$(TargetPath)"
+ WorkingDirectory="..\MCServer"
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor="0"
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command="$(TargetPath)"
+ WorkingDirectory="..\MCServer"
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor="0"
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="ReleaseProfile|Win32"
+ >
+ <DebugSettings
+ Command="$(TargetPath)"
+ WorkingDirectory="..\MCServer"
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="ASAGA"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor="0"
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="RelWithDebInfo|Win32"
+ >
+ <DebugSettings
+ Command="$(TargetPath)"
+ WorkingDirectory="..\MCServer"
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor="0"
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/OSSupport/Socket.cpp b/src/OSSupport/Socket.cpp
index f25f800c2..d511e5487 100644
--- a/src/OSSupport/Socket.cpp
+++ b/src/OSSupport/Socket.cpp
@@ -72,10 +72,6 @@ void cSocket::CloseSocket()
#else // _WIN32
- if (shutdown(m_Socket, SHUT_RDWR) != 0)//SD_BOTH);
- {
- LOGWARN("Error on shutting down socket %d (%s): %s", m_Socket, m_IPString.c_str(), GetLastErrorString().c_str());
- }
if (close(m_Socket) != 0)
{
LOGWARN("Error closing socket %d (%s): %s", m_Socket, m_IPString.c_str(), GetLastErrorString().c_str());
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index 9c46c6843..68992155e 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -216,8 +216,23 @@ void cProtocol172::SendDestroyEntity(const cEntity & a_Entity)
void cProtocol172::SendDisconnect(const AString & a_Reason)
{
- cPacketizer Pkt(*this, 0x40);
- Pkt.WriteString(Printf("{\"text\":\"%s\"}", EscapeString(a_Reason).c_str()));
+ switch (m_State)
+ {
+ case 2:
+ {
+ // During login:
+ cPacketizer Pkt(*this, 0);
+ Pkt.WriteString(Printf("{\"text\":\"%s\"}", EscapeString(a_Reason).c_str()));
+ break;
+ }
+ case 3:
+ {
+ // In-game:
+ cPacketizer Pkt(*this, 0x40);
+ Pkt.WriteString(Printf("{\"text\":\"%s\"}", EscapeString(a_Reason).c_str()));
+ break;
+ }
+ }
}
@@ -1156,6 +1171,12 @@ void cProtocol172::HandlePacketLoginStart(cByteBuffer & a_ByteBuffer)
// TODO: Protocol encryption should be set up here if not localhost / auth
+ if (!m_Client->HandleHandshake(Username))
+ {
+ // The client is not welcome here, they have been sent a Kick packet already
+ return;
+ }
+
// Send login success:
{
cPacketizer Pkt(*this, 0x02); // Login success packet
diff --git a/VC2008/MCServer.rc b/src/Resources/MCServer.rc
index e0fbbea5d..e0fbbea5d 100644
--- a/VC2008/MCServer.rc
+++ b/src/Resources/MCServer.rc
diff --git a/VC2008/icon.ico b/src/Resources/icon.ico
index 4024523a1..4024523a1 100644
--- a/VC2008/icon.ico
+++ b/src/Resources/icon.ico
Binary files differ
diff --git a/VC2008/icon_128.png b/src/Resources/icon_128.png
index 87d939a04..87d939a04 100644
--- a/VC2008/icon_128.png
+++ b/src/Resources/icon_128.png
Binary files differ
diff --git a/VC2008/icon_256.png b/src/Resources/icon_256.png
index 9a77a490f..9a77a490f 100644
--- a/VC2008/icon_256.png
+++ b/src/Resources/icon_256.png
Binary files differ
diff --git a/VC2008/resource_MCServer.h b/src/Resources/resource_MCServer.h
index 42f6c4eaf..42f6c4eaf 100644
--- a/VC2008/resource_MCServer.h
+++ b/src/Resources/resource_MCServer.h