Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -448,68 +448,76 @@ enum ChatPrefixCodes | |
// http://forum.mc-server.org/showthread.php?tid=1212 | ||
// MessageType... | ||
|
||
mtCustom, // Plugin prints what it wants | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
madmaxoft
Member
|
||
mtFailure, // Something could not be done (i.e. command not executed due to insufficient privilege) | ||
mtInformation, // Informational message (i.e. command usage) | ||
mtSuccess, // Something executed successfully | ||
mtWarning, // Something concerning (i.e. reload) is about to happen | ||
mtFatal, // Something catastrophic occured (i.e. plugin crash) | ||
mtDeath, // Denotes death of player | ||
mtPrivateMessage // Player to player messaging identifier | ||
mtPrivateMessage, // Player to player messaging identifier | ||
mtJoin, // A player has joined the server | ||
mtLeave, // A player has left the server | ||
}; | ||
|
||
|
||
|
||
|
||
inline AString AppendChatEpithet(const AString & a_ChatMessage, ChatPrefixCodes a_ChatPrefix) | ||
{ | ||
AString Message; | ||
|
||
switch (a_ChatPrefix) | ||
{ | ||
case mtCustom: return a_ChatMessage; | ||
case mtFailure: | ||
{ | ||
AString Message(Printf("%s[INFO] %s", cChatColor::Rose.c_str(), cChatColor::White.c_str())); | ||
Message.append(a_ChatMessage); | ||
return Message; | ||
Message = Printf("%s[INFO] %s", cChatColor::Rose.c_str(), cChatColor::White.c_str()); | ||
break; | ||
} | ||
case mtInformation: | ||
{ | ||
AString Message(Printf("%s[INFO] %s", cChatColor::Yellow.c_str(), cChatColor::White.c_str())); | ||
Message.append(a_ChatMessage); | ||
return Message; | ||
Message = Printf("%s[INFO] %s", cChatColor::Yellow.c_str(), cChatColor::White.c_str()); | ||
break; | ||
} | ||
case mtSuccess: | ||
{ | ||
AString Message(Printf("%s[INFO] %s", cChatColor::Green.c_str(), cChatColor::White.c_str())); | ||
Message.append(a_ChatMessage); | ||
return Message; | ||
Message = Printf("%s[INFO] %s", cChatColor::Green.c_str(), cChatColor::White.c_str()); | ||
break; | ||
} | ||
case mtWarning: | ||
{ | ||
AString Message(Printf("%s[WARN] %s", cChatColor::Rose.c_str(), cChatColor::White.c_str())); | ||
Message.append(a_ChatMessage); | ||
return Message; | ||
Message = Printf("%s[WARN] %s", cChatColor::Rose.c_str(), cChatColor::White.c_str()); | ||
break; | ||
} | ||
case mtFatal: | ||
{ | ||
AString Message(Printf("%s[FATAL] %s", cChatColor::Red.c_str(), cChatColor::White.c_str())); | ||
Message.append(a_ChatMessage); | ||
return Message; | ||
Message = Printf("%s[FATAL] %s", cChatColor::Red.c_str(), cChatColor::White.c_str()); | ||
break; | ||
} | ||
case mtDeath: | ||
{ | ||
AString Message(Printf("%s[DEATH] %s", cChatColor::Gray.c_str(), cChatColor::White.c_str())); | ||
Message.append(a_ChatMessage); | ||
return Message; | ||
Message = Printf("%s[DEATH] %s", cChatColor::Gray.c_str(), cChatColor::White.c_str()); | ||
break; | ||
} | ||
case mtPrivateMessage: | ||
{ | ||
AString Message(Printf("%s[MSG] %s%s", cChatColor::LightBlue.c_str(), cChatColor::White.c_str(), cChatColor::Italic.c_str())); | ||
Message.append(a_ChatMessage); | ||
return Message; | ||
Message = Printf("%s[MSG] %s%s", cChatColor::LightBlue.c_str(), cChatColor::White.c_str(), cChatColor::Italic.c_str()); | ||
break; | ||
} | ||
case mtJoin: | ||
{ | ||
Message = Printf("%s[JOIN] %s", cChatColor::Yellow.c_str(), cChatColor::White.c_str()); | ||
break; | ||
} | ||
case mtLeave: | ||
{ | ||
Message = Printf("%s[LEAVE] %s", cChatColor::Yellow.c_str(), cChatColor::White.c_str()); | ||
break; | ||
} | ||
default: ASSERT(!"Unhandled chat prefix type!"); return ""; | ||
} | ||
|
||
Message.append(a_ChatMessage); | ||
return Message; | ||
} | ||
|
||
// tolua_begin | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,7 +157,17 @@ class cWorld : public cForEachChunkProvider, public cWorldInterface, public cBro | |
void BroadcastBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = NULL); // tolua_export | ||
void BroadcastBlockBreakAnimation(int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage, const cClientHandle * a_Exclude = NULL); | ||
void BroadcastBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = NULL); ///< If there is a block entity at the specified coods, sends it to all clients except a_Exclude | ||
void BroadcastChat (const AString & a_Message, const cClientHandle * a_Exclude = NULL); // tolua_export | ||
|
||
// tolua_start | ||
void BroadcastChat(const AString & a_Message, const cClientHandle * a_Exclude = NULL); | ||
This comment has been minimized.
Sorry, something went wrong.
worktycho
Member
|
||
void BroadcastChatInfo(const AString & a_Message, const cClientHandle * a_Exclude = NULL) { BroadcastChat(AppendChatEpithet(a_Message, mtInformation)); } | ||
void BroadcastChatFailure(const AString & a_Message, const cClientHandle * a_Exclude = NULL) { BroadcastChat(AppendChatEpithet(a_Message, mtFailure)); } | ||
void BroadcastChatSuccess(const AString & a_Message, const cClientHandle * a_Exclude = NULL) { BroadcastChat(AppendChatEpithet(a_Message, mtSuccess)); } | ||
void BroadcastChatWarning(const AString & a_Message, const cClientHandle * a_Exclude = NULL) { BroadcastChat(AppendChatEpithet(a_Message, mtWarning)); } | ||
void BroadcastChatFatal(const AString & a_Message, const cClientHandle * a_Exclude = NULL) { BroadcastChat(AppendChatEpithet(a_Message, mtFailure)); } | ||
void BroadcastChatDeath(const AString & a_Message, const cClientHandle * a_Exclude = NULL) { BroadcastChat(AppendChatEpithet(a_Message, mtDeath)); } | ||
// tolua_end | ||
|
||
void BroadcastChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer, const cClientHandle * a_Exclude = NULL); | ||
void BroadcastCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player, const cClientHandle * a_Exclude = NULL); | ||
void BroadcastDestroyEntity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL); | ||
|
Again, We should probably keep this temporarily (but warn on use) to prevent breaking plugins using this.