1
0

Use LastPlacedSign instead of LastPlacedBlock.

This commit is contained in:
Howaner 2014-11-15 22:36:31 +01:00
parent fe9750136c
commit 277151582f
3 changed files with 6 additions and 9 deletions

View File

@ -536,7 +536,6 @@ end
GetViewDistance = { Params = "", Return = "number", Notes = "Returns the viewdistance (number of chunks loaded for the player in each direction)" }, GetViewDistance = { Params = "", Return = "number", Notes = "Returns the viewdistance (number of chunks loaded for the player in each direction)" },
HasPluginChannel = { Params = "ChannelName", Return = "bool", Notes = "Returns true if the client has registered to receive messages on the specified plugin channel." }, HasPluginChannel = { Params = "ChannelName", Return = "bool", Notes = "Returns true if the client has registered to receive messages on the specified plugin channel." },
IsUUIDOnline = { Params = "UUID", Return = "bool", Notes = "(STATIC) Returns true if the UUID is generated by online auth, false if it is an offline-generated UUID. We use Version-3 UUIDs for offline UUIDs, online UUIDs are Version-4, thus we can tell them apart. Accepts both 32-char and 36-char UUIDs (with and without dashes). If the string given is not a valid UUID, returns false."}, IsUUIDOnline = { Params = "UUID", Return = "bool", Notes = "(STATIC) Returns true if the UUID is generated by online auth, false if it is an offline-generated UUID. We use Version-3 UUIDs for offline UUIDs, online UUIDs are Version-4, thus we can tell them apart. Accepts both 32-char and 36-char UUIDs (with and without dashes). If the string given is not a valid UUID, returns false."},
GetLastPlacedBlock = { Params = "", Return = "{{Vector3i}}", Notes = "Returns the positions from the last block that the player placed." },
Kick = { Params = "Reason", Return = "", Notes = "Kicks the user with the specified reason" }, 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." }, SendPluginMessage = { Params = "Channel, Message", Return = "", Notes = "Sends the plugin message on the specified channel." },
SetClientBrand = { Params = "ClientBrand", Return = "", Notes = "Sets the value of the client's brand. Normally this value is received from the client by a MC|Brand plugin message, this function lets plugins overwrite the value." }, SetClientBrand = { Params = "ClientBrand", Return = "", Notes = "Sets the value of the client's brand. Normally this value is received from the client by a MC|Brand plugin message, this function lets plugins overwrite the value." },

View File

@ -93,7 +93,7 @@ cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance) :
m_UniqueID(0), m_UniqueID(0),
m_HasSentPlayerChunk(false), m_HasSentPlayerChunk(false),
m_Locale("en_GB"), m_Locale("en_GB"),
m_LastPlacedBlock(0, -1, 0), m_LastPlacedSign(0, -1, 0),
m_ProtocolVersion(0) m_ProtocolVersion(0)
{ {
m_Protocol = new cProtocolRecognizer(this); m_Protocol = new cProtocolRecognizer(this);
@ -1501,7 +1501,6 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, e
{ {
m_Player->GetInventory().RemoveOneEquippedItem(); m_Player->GetInventory().RemoveOneEquippedItem();
} }
m_LastPlacedBlock.Set(a_BlockX, a_BlockY, a_BlockZ);
cChunkInterface ChunkInterface(World->GetChunkMap()); cChunkInterface ChunkInterface(World->GetChunkMap());
NewBlock->OnPlacedByPlayer(ChunkInterface, *World, m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta); NewBlock->OnPlacedByPlayer(ChunkInterface, *World, m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
@ -1680,8 +1679,9 @@ void cClientHandle::HandleUpdateSign(
const AString & a_Line3, const AString & a_Line4 const AString & a_Line3, const AString & a_Line4
) )
{ {
if (m_LastPlacedBlock.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ))) if (m_LastPlacedSign.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ)))
{ {
m_LastPlacedSign.Set(0, -1, 0);
m_Player->GetWorld()->SetSignLines(a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4, m_Player); m_Player->GetWorld()->SetSignLines(a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4, m_Player);
} }
} }
@ -2262,6 +2262,7 @@ void cClientHandle::SendDisconnect(const AString & a_Reason)
void cClientHandle::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ) void cClientHandle::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ)
{ {
m_LastPlacedSign.Set(a_BlockX, a_BlockY, a_BlockZ);
m_Protocol->SendEditSign(a_BlockX, a_BlockY, a_BlockZ); m_Protocol->SendEditSign(a_BlockX, a_BlockY, a_BlockZ);
} }

View File

@ -125,9 +125,6 @@ public:
inline bool IsLoggedIn(void) const { return (m_State >= csAuthenticating); } inline bool IsLoggedIn(void) const { return (m_State >= csAuthenticating); }
/** Returns the positions from the last block that the player placed. */
const Vector3i & GetLastPlacedBlock(void) const { return m_LastPlacedBlock; } // tolua_export
/** Called while the client is being ticked from the world via its cPlayer object */ /** Called while the client is being ticked from the world via its cPlayer object */
void Tick(float a_Dt); void Tick(float a_Dt);
@ -436,8 +433,8 @@ private:
/** Client Settings */ /** Client Settings */
AString m_Locale; AString m_Locale;
/** The positions from the last block that the player placed. It's needed to verify the sign text change. */ /** The positions from the last sign that the player placed. It's needed to verify the sign text change. */
Vector3i m_LastPlacedBlock; Vector3i m_LastPlacedSign;
/** The plugin channels that the client has registered. */ /** The plugin channels that the client has registered. */
cChannels m_PluginChannels; cChannels m_PluginChannels;