summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp4
-rw-r--r--src/ClientHandle.h2
-rw-r--r--src/Entities/Entity.cpp6
-rw-r--r--src/Entities/Player.cpp40
-rw-r--r--src/Entities/Player.h11
-rw-r--r--src/Protocol/Protocol.h2
-rw-r--r--src/Protocol/Protocol125.cpp2
-rw-r--r--src/Protocol/Protocol125.h2
-rw-r--r--src/Protocol/Protocol16x.h2
-rw-r--r--src/Protocol/Protocol17x.cpp2
-rw-r--r--src/Protocol/Protocol17x.h2
-rw-r--r--src/Protocol/ProtocolRecognizer.h2
-rw-r--r--src/World.cpp16
-rw-r--r--src/World.h12
14 files changed, 28 insertions, 77 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 1a18649c9..f90da94dd 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -2375,9 +2375,9 @@ void cClientHandle::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effec
-void cClientHandle::SendRespawn(eDimension a_Dimension)
+void cClientHandle::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks)
{
- m_Protocol->SendRespawn(a_Dimension);
+ m_Protocol->SendRespawn(a_Dimension, a_ShouldIgnoreDimensionChecks);
}
diff --git a/src/ClientHandle.h b/src/ClientHandle.h
index cb0471421..e3c2b590f 100644
--- a/src/ClientHandle.h
+++ b/src/ClientHandle.h
@@ -161,7 +161,7 @@ public:
void SendPlayerSpawn (const cPlayer & a_Player);
void SendPluginMessage (const AString & a_Channel, const AString & a_Message); // Exported in ManualBindings.cpp
void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID);
- void SendRespawn (eDimension a_Dimension);
+ void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks = false);
void SendExperience (void);
void SendExperienceOrb (const cExpOrb & a_ExpOrb);
void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode);
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index e5e4cf4cb..bd1839580 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -1028,7 +1028,7 @@ void cEntity::DetectCacti(void)
void cEntity::DetectPortal()
{
- if (!GetWorld()->AreNetherPortalsEnabled() && !GetWorld()->AreEndPortalsEnabled())
+ if (!GetWorld()->GetNetherWorldName().empty() && !GetWorld()->GetEndWorldName().empty())
{
return;
}
@@ -1040,7 +1040,7 @@ void cEntity::DetectPortal()
{
case E_BLOCK_NETHER_PORTAL:
{
- if (!GetWorld()->AreNetherPortalsEnabled() || m_PortalCooldownData.second)
+ if (GetWorld()->GetNetherWorldName().empty() || m_PortalCooldownData.second)
{
return;
}
@@ -1085,7 +1085,7 @@ void cEntity::DetectPortal()
}
case E_BLOCK_END_PORTAL:
{
- if (!GetWorld()->AreEndPortalsEnabled() || m_PortalCooldownData.second)
+ if (GetWorld()->GetNetherWorldName().empty() || m_PortalCooldownData.second)
{
return;
}
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 1acc8a962..2a91600e7 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1695,12 +1695,7 @@ void cPlayer::LoadPermissionsFromDisk()
-<<<<<<< HEAD
bool cPlayer::LoadFromDisk(cWorldPtr & a_World)
-=======
-
-bool cPlayer::LoadFromDisk(void)
->>>>>>> master
{
a_World = cRoot::Get()->GetWorld(GetLoadedWorldName());
if (a_World == NULL)
@@ -1711,7 +1706,7 @@ bool cPlayer::LoadFromDisk(void)
LoadPermissionsFromDisk();
// Load from the UUID file:
- if (LoadFromFile(GetUUIDFileName(m_UUID)))
+ if (LoadFromFile(GetUUIDFileName(m_UUID), a_World))
{
return true;
}
@@ -1720,7 +1715,7 @@ bool cPlayer::LoadFromDisk(void)
AString OfflineUUID = cClientHandle::GenerateOfflineUUID(GetName());
if (cRoot::Get()->GetServer()->ShouldLoadOfflinePlayerData())
{
- if (LoadFromFile(GetUUIDFileName(OfflineUUID)))
+ if (LoadFromFile(GetUUIDFileName(OfflineUUID), a_World))
{
return true;
}
@@ -1730,7 +1725,7 @@ bool cPlayer::LoadFromDisk(void)
if (cRoot::Get()->GetServer()->ShouldLoadNamedPlayerData())
{
AString OldStyleFileName = Printf("players/%s.json", GetName().c_str());
- if (LoadFromFile(OldStyleFileName))
+ if (LoadFromFile(OldStyleFileName, a_World))
{
// Save in new format and remove the old file
if (SaveToDisk())
@@ -1752,7 +1747,7 @@ bool cPlayer::LoadFromDisk(void)
-bool cPlayer::LoadFromFile(const AString & a_FileName)
+bool cPlayer::LoadFromFile(const AString & a_FileName, cWorld * a_World)
{
// Load the data from the file:
cFile f;
@@ -1860,28 +1855,6 @@ bool cPlayer::SaveToDisk()
cEnderChestEntity::SaveToJson(JSON_EnderChestInventory, m_EnderChestContents);
Json::Value root;
-<<<<<<< HEAD
- root["position"] = JSON_PlayerPosition;
- root["rotation"] = JSON_PlayerRotation;
- root["inventory"] = JSON_Inventory;
- root["health"] = m_Health;
- root["xpTotal"] = m_LifetimeTotalXp;
- root["xpCurrent"] = m_CurrentXp;
- root["air"] = m_AirLevel;
- root["food"] = m_FoodLevel;
- root["foodSaturation"] = m_FoodSaturationLevel;
- root["foodTickTimer"] = m_FoodTickTimer;
- root["foodExhaustion"] = m_FoodExhaustionLevel;
- root["world"] = GetWorld()->GetName();
- root["isflying"] = IsFlying();
- root["SpawnX"] = GetLastBedPos().x;
- root["SpawnY"] = GetLastBedPos().y;
- root["SpawnZ"] = GetLastBedPos().z;
-
- if (m_GameMode == GetWorld()->GetGameMode())
- {
- root["gamemode"] = (int) eGameMode_NotSet;
-=======
root["position"] = JSON_PlayerPosition;
root["rotation"] = JSON_PlayerRotation;
root["inventory"] = JSON_Inventory;
@@ -1896,6 +1869,10 @@ bool cPlayer::SaveToDisk()
root["foodExhaustion"] = m_FoodExhaustionLevel;
root["isflying"] = IsFlying();
root["lastknownname"] = GetName();
+ root["SpawnX"] = GetLastBedPos().x;
+ root["SpawnY"] = GetLastBedPos().y;
+ root["SpawnZ"] = GetLastBedPos().z;
+
if (m_World != NULL)
{
root["world"] = m_World->GetName();
@@ -1907,7 +1884,6 @@ bool cPlayer::SaveToDisk()
{
root["gamemode"] = (int) m_GameMode;
}
->>>>>>> master
}
else
{
diff --git a/src/Entities/Player.h b/src/Entities/Player.h
index f84cc5f55..ad434f036 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -326,11 +326,6 @@ public:
virtual void Killed(cEntity * a_Victim) override;
- void Respawn(void); // tolua_export
-
- void SetVisible(bool a_bVisible); // tolua_export
- bool IsVisible(void) const { return m_bVisible; } // tolua_export
-
void Respawn(void); // tolua_export
void SetVisible( bool a_bVisible ); // tolua_export
@@ -352,7 +347,7 @@ Takes a (NULL) cWorld pointer which it will assign a value to based on either th
/** Loads the player data from the specified file.
Returns true on success, false on failure. */
- bool LoadFromFile(const AString & a_FileName);
+ bool LoadFromFile(const AString & a_FileName, cWorld * a_World);
void LoadPermissionsFromDisk(void); // tolua_export
@@ -544,8 +539,6 @@ protected:
cStatManager m_Stats;
-<<<<<<< HEAD
-=======
/** Flag representing whether the player is currently in a bed
Set by a right click on unoccupied bed, unset by a time fast forward or teleport */
bool m_bIsInBed;
@@ -563,8 +556,6 @@ protected:
If no ClientHandle is given, the UUID is initialized to empty. */
AString m_UUID;
-
->>>>>>> master
/** Sets the speed and sends it to the client, so that they are forced to move so. */
virtual void DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) override;
diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h
index 7e9eed402..58dbfeff5 100644
--- a/src/Protocol/Protocol.h
+++ b/src/Protocol/Protocol.h
@@ -100,7 +100,7 @@ public:
virtual void SendPlayerSpawn (const cPlayer & a_Player) = 0;
virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) = 0;
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) = 0;
- virtual void SendRespawn (eDimension a_Dimension) = 0;
+ virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) = 0;
virtual void SendExperience (void) = 0;
virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) = 0;
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) = 0;
diff --git a/src/Protocol/Protocol125.cpp b/src/Protocol/Protocol125.cpp
index 8cb34c128..320c1212c 100644
--- a/src/Protocol/Protocol125.cpp
+++ b/src/Protocol/Protocol125.cpp
@@ -836,7 +836,7 @@ void cProtocol125::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effect
void cProtocol125::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks)
{
cCSLock Lock(m_CSPacket);
- if ((m_LastSentDimension == a_World.GetDimension()) && !a_ShouldIgnoreDimensionChecks)
+ if ((m_LastSentDimension == a_Dimension) && !a_ShouldIgnoreDimensionChecks)
{
// Must not send a respawn for the world with the same dimension, the client goes cuckoo if we do (unless we are respawning from death)
return;
diff --git a/src/Protocol/Protocol125.h b/src/Protocol/Protocol125.h
index 955e3e741..d1ed00b54 100644
--- a/src/Protocol/Protocol125.h
+++ b/src/Protocol/Protocol125.h
@@ -72,7 +72,7 @@ public:
virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override;
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override;
- virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks = false) override;
+ virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override;
virtual void SendExperience (void) override;
virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override;
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
diff --git a/src/Protocol/Protocol16x.h b/src/Protocol/Protocol16x.h
index 13866801a..add761d1e 100644
--- a/src/Protocol/Protocol16x.h
+++ b/src/Protocol/Protocol16x.h
@@ -42,7 +42,7 @@ protected:
virtual void SendGameMode (eGameMode a_GameMode) override;
virtual void SendHealth (void) override;
virtual void SendPlayerMaxSpeed(void) override;
- virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks = false) override;
+ virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override;
virtual void SendWindowOpen (const cWindow & a_Window) override;
virtual int ParseEntityAction (void) override;
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index a421e4da6..0ff0d0357 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -988,7 +988,7 @@ void cProtocol172::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effect
void cProtocol172::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks)
{
- if ((m_LastSentDimension == a_World.GetDimension()) && !a_ShouldIgnoreDimensionChecks)
+ if ((m_LastSentDimension == a_Dimension) && !a_ShouldIgnoreDimensionChecks)
{
// Must not send a respawn for the world with the same dimension, the client goes cuckoo if we do (unless we are respawning from death)
return;
diff --git a/src/Protocol/Protocol17x.h b/src/Protocol/Protocol17x.h
index 2d4005f57..be41abd64 100644
--- a/src/Protocol/Protocol17x.h
+++ b/src/Protocol/Protocol17x.h
@@ -104,7 +104,7 @@ public:
virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override;
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override;
- virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks = false) override;
+ virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override;
virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override;
virtual void SendExperience (void) override;
virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override;
diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h
index b78528e29..9c6c898ab 100644
--- a/src/Protocol/ProtocolRecognizer.h
+++ b/src/Protocol/ProtocolRecognizer.h
@@ -107,7 +107,7 @@ public:
virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override;
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override;
- virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks = false) override;
+ virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override;
virtual void SendExperience (void) override;
virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override;
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
diff --git a/src/World.cpp b/src/World.cpp
index e32771353..924d5adbb 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -527,7 +527,7 @@ void cWorld::Start(bool a_WasDimensionSet)
AString Dimension = IniFile.GetValueSet("General", "Dimension", a_WasDimensionSet ? DimensionToString(GetDimension()) : "Overworld");
m_Dimension = StringToDimension(Dimension);
- m_OverworldName = IniFile.GetValue("General", "OverworldName", a_WasDimensionSet ? m_OverworldName : "");
+ m_OverworldName = IniFile.GetValue("LinkedWorlds", "OverworldName", a_WasDimensionSet ? m_OverworldName : "");
// Try to find the "SpawnPosition" key and coord values in the world configuration, set the flag if found
int KeyNum = IniFile.FindKey("SpawnPosition");
@@ -577,10 +577,8 @@ void cWorld::Start(bool a_WasDimensionSet)
if ((GetDimension() != dimNether) && (GetDimension() != dimEnd))
{
- m_bNetherPortalsEnabled = IniFile.GetValueSetB("General", "NetherPortalsEnabled", true);
- m_NetherWorldName = IniFile.GetValueSet("General", "NetherWorldName", DEFAULT_NETHER_NAME);
- m_bEndPortalsEnabled = IniFile.GetValueSetB("General", "EndPortalsEnabled", true);
- m_EndWorldName = IniFile.GetValueSet("General", "EndWorldName", DEFAULT_END_NAME);
+ m_NetherWorldName = IniFile.GetValueSet("LinkedWorlds", "NetherWorldName", DEFAULT_NETHER_NAME);
+ m_EndWorldName = IniFile.GetValueSet("LinkedWorlds", "EndWorldName", DEFAULT_END_NAME);
}
// Adjust the enum-backed variables into their respective bounds:
@@ -757,14 +755,12 @@ void cWorld::Stop(void)
IniFile.ReadFile(m_IniFileName);
if ((GetDimension() != dimNether) && (GetDimension() != dimEnd))
{
- IniFile.SetValueB("General", "NetherPortalsEnabled", m_bNetherPortalsEnabled);
- IniFile.SetValue("General", "NetherWorldName", m_NetherWorldName);
- IniFile.SetValueB("General", "EndPortalsEnabled", m_bEndPortalsEnabled);
- IniFile.SetValue("General", "EndWorldName", m_EndWorldName);
+ IniFile.SetValue("LinkedWorlds", "NetherWorldName", m_NetherWorldName);
+ IniFile.SetValue("LinkedWorlds", "EndWorldName", m_EndWorldName);
}
else
{
- IniFile.SetValue("General", "OverworldName", m_OverworldName);
+ IniFile.SetValue("LinkedWorlds", "OverworldName", m_OverworldName);
}
IniFile.SetValueI("Physics", "TNTShrapnelLevel", (int)m_TNTShrapnelLevel);
IniFile.SetValueB("Mechanics", "CommandBlocksEnabled", m_bCommandBlocksEnabled);
diff --git a/src/World.h b/src/World.h
index 92376b4a0..73b8b81b0 100644
--- a/src/World.h
+++ b/src/World.h
@@ -630,12 +630,6 @@ public:
bool ShouldUseChatPrefixes(void) const { return m_bUseChatPrefixes; }
void SetShouldUseChatPrefixes(bool a_Flag) { m_bUseChatPrefixes = a_Flag; }
- bool AreNetherPortalsEnabled(void) const { return m_bNetherPortalsEnabled; }
- void SetNetherPortalsEnabled(bool a_Flag) { m_bNetherPortalsEnabled = a_Flag; }
-
- bool AreEndPortalsEnabled(void) const { return m_bEndPortalsEnabled; }
- void SetEndPortalsEnabled(bool a_Flag) { m_bEndPortalsEnabled = a_Flag; }
-
AString GetNetherWorldName(void) const { return m_NetherWorldName; }
void SetNetherWorldName(const AString & a_Name) { m_NetherWorldName = a_Name; }
@@ -938,12 +932,6 @@ private:
*/
eShrapnelLevel m_TNTShrapnelLevel;
- /** Whether nether portals teleport entities */
- bool m_bNetherPortalsEnabled;
-
- /** Whether end portals teleport entities */
- bool m_bEndPortalsEnabled;
-
/** Name of the nether world */
AString m_NetherWorldName;