summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2015-06-04 12:28:43 +0200
committerworktycho <work.tycho@gmail.com>2015-06-04 12:28:43 +0200
commitc9ad1ecd3e9931e6928f8846bdb26cf6f8a6a957 (patch)
treea74fed75c1cd63c0bc1f2c582a00c4bb2d0bbe4e
parentMerge pull request #2188 from cengizIO/master (diff)
parentAdded SendSystemMessage / SendAboveActionBarMessage to the docs (diff)
downloadcuberite-c9ad1ecd3e9931e6928f8846bdb26cf6f8a6a957.tar
cuberite-c9ad1ecd3e9931e6928f8846bdb26cf6f8a6a957.tar.gz
cuberite-c9ad1ecd3e9931e6928f8846bdb26cf6f8a6a957.tar.bz2
cuberite-c9ad1ecd3e9931e6928f8846bdb26cf6f8a6a957.tar.lz
cuberite-c9ad1ecd3e9931e6928f8846bdb26cf6f8a6a957.tar.xz
cuberite-c9ad1ecd3e9931e6928f8846bdb26cf6f8a6a957.tar.zst
cuberite-c9ad1ecd3e9931e6928f8846bdb26cf6f8a6a957.zip
-rw-r--r--MCServer/Plugins/APIDump/APIDesc.lua2
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnKilling.lua1
-rw-r--r--src/Protocol/Protocol17x.cpp12
3 files changed, 14 insertions, 1 deletions
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 4af01c0a4..161fe59d1 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -1917,6 +1917,8 @@ a_Player:OpenWindow(Window);
SendMessagePrivateMsg = { Params = "Message, SenderName", Return = "", Notes = "Prepends Light Blue [MSG: *SenderName*] / prepends SenderName and colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. For private messaging." },
SendMessageSuccess = { Params = "Message", Return = "", Notes = "Prepends Green [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. Success notification." },
SendMessageWarning = { Params = "Message, Sender", Return = "", Notes = "Prepends Rose [WARN] / colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. Denotes that something concerning, such as plugin reload, is about to happen." },
+ SendAboveActionBarMessage = { Params = "Message", Return = "", Notes = "Sends the specified message to the player (shows above action bar, doesn't show for < 1.8 clients)." },
+ SendSystemMessage = { Params = "Message", Return = "", Notes = "Sends the specified message to the player (doesn't show for < 1.8 clients)." },
SendRotation = { Params = "YawDegrees, PitchDegrees", Return = "", Notes = "Sends the specified rotation to the player, forcing them to look that way" },
SetBedPos = { Params = "{{Vector3i|Position}}", Return = "", Notes = "Sets the internal representation of the last bed position the player has slept in. The player will respawn at this position if they die." },
SetCanFly = { Params = "CanFly", Notes = "Sets if the player can fly or not." },
diff --git a/MCServer/Plugins/APIDump/Hooks/OnKilling.lua b/MCServer/Plugins/APIDump/Hooks/OnKilling.lua
index 8ec1cfe2e..5e84009db 100644
--- a/MCServer/Plugins/APIDump/Hooks/OnKilling.lua
+++ b/MCServer/Plugins/APIDump/Hooks/OnKilling.lua
@@ -17,6 +17,7 @@ return
{
{ Name = "Victim", Type = "{{cPawn}}", Notes = "The player or mob that is about to be killed" },
{ Name = "Killer", Type = "{{cEntity}}", Notes = "The entity that has caused the victim to lose the last point of health. May be nil for environment damage" },
+ { Name = "TDI", Type = "{{TakeDamageInfo}}", Notes = "The damage type, cause and effects." },
},
Returns = [[
If the function returns false or no value, MCServer calls other plugins with this event. If the
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index 71c68c071..e043698dd 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -302,7 +302,12 @@ void cProtocol172::SendChatAboveActionBar(const cCompositeChat & a_Message)
void cProtocol172::SendChatType(const AString & a_Message, eChatType type)
{
ASSERT(m_State == 3); // In game mode?
-
+
+ if (type != ctChatBox) // 1.7.2 doesn't support anything else
+ {
+ return;
+ }
+
cPacketizer Pkt(*this, 0x02); // Chat Message packet
Pkt.WriteString(Printf("{\"text\":\"%s\"}", EscapeString(a_Message).c_str()));
}
@@ -315,6 +320,11 @@ void cProtocol172::SendChatType(const cCompositeChat & a_Message, eChatType type
{
ASSERT(m_State == 3); // In game mode?
+ if (type != ctChatBox) // 1.7.2 doesn't support anything else
+ {
+ return;
+ }
+
cWorld * World = m_Client->GetPlayer()->GetWorld();
bool ShouldUseChatPrefixes = (World == nullptr) ? false : World->ShouldUseChatPrefixes();