summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/cClientHandle.cpp10
-rw-r--r--source/cPlayer.cpp2
2 files changed, 11 insertions, 1 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index e4c501a4f..6e7df2bb8 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -307,7 +307,7 @@ void cClientHandle::Authenticate(void)
World = cRoot::Get()->GetDefaultWorld();
}
- m_Player->LoginSetGameMode (World->GetGameMode()); //set player's gamemode to server's gamemode at login. TODO: set to last player's gamemode at logout
+ // We donīt need this, do we? m_Player->LoginSetGameMode (World->GetGameMode()); //set player's gamemode to server's gamemode at login. TODO: set to last player's gamemode at logout
m_Player->SetIP (m_Socket.GetIPString());
@@ -909,6 +909,14 @@ void cClientHandle::HandleBlockDig(cPacket_BlockDig * a_Packet)
void cClientHandle::HandleBlockPlace(cPacket_BlockPlace * a_Packet)
{
+ if(a_Packet->m_PosX == -1
+ && a_Packet->m_PosY == 255
+ && a_Packet->m_PosZ == -1)
+ {
+ //I donīt know whats the idea behind these packets O.o
+ return;
+ }
+
if (!CheckBlockInteractionsRate())
{
return;
diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp
index ecf6cb145..5ab06fa62 100644
--- a/source/cPlayer.cpp
+++ b/source/cPlayer.cpp
@@ -915,6 +915,7 @@ bool cPlayer::LoadFromDisk()
m_Health = (short)root.get("health", 0 ).asInt();
m_FoodLevel = (short)root.get("food", 0 ).asInt();
+ m_GameMode = (eGameMode) root.get("gamemode", cRoot::Get()->GetDefaultWorld()->GetGameMode()).asInt();
m_Inventory->LoadFromJson(root["inventory"]);
m_CreativeInventory->LoadFromJson(root["creativeinventory"]);
@@ -960,6 +961,7 @@ bool cPlayer::SaveToDisk()
root["health"] = m_Health;
root["food"] = m_FoodLevel;
root["world"] = GetWorld()->GetName();
+ root["gamemode"] = (int) m_GameMode;
Json::StyledWriter writer;
std::string JsonData = writer.write( root );