1
0

Adds playerlist header and footer broadcasting (1.8-1.13)

This commit is contained in:
dImrich 2021-02-04 00:33:17 +01:00 committed by Tiger Wang
parent b1b7424c43
commit 925f960ea2
16 changed files with 417 additions and 310 deletions

View File

@ -1584,6 +1584,21 @@ end
}, },
Notes = "Sends the specified animation of the specified entity to the client. The AnimationNumber is protocol-specific.", Notes = "Sends the specified animation of the specified entity to the client. The AnimationNumber is protocol-specific.",
}, },
SendPlayerListHeaderFooter =
{
Params =
{
{
Type = "cCompositeChat",
Name = "Header",
},
{
Type = "cCompositeChat",
Name = "Footer",
},
},
Desc = "Sends the header and footer of the player list to the client.",
},
SendHideTitle = SendHideTitle =
{ {
Notes = "Hides the title. This makes the title and subtitle disappear, but if you call SendTitleTimes() the same title and subtitle will appear again." Notes = "Hides the title. This makes the title and subtitle disappear, but if you call SendTitleTimes() the same title and subtitle will appear again."
@ -11388,6 +11403,21 @@ a_Player:OpenWindow(Window);
}, },
Notes = "Broadcasts the specified message to all players, with its message type set to mtWarning. Use for concerning events, such as plugin reload etc.", Notes = "Broadcasts the specified message to all players, with its message type set to mtWarning. Use for concerning events, such as plugin reload etc.",
}, },
BroadcastPlayerListsHeaderFooter =
{
Params =
{
{
Type = "cCompositeChat",
Name = "Header",
},
{
Type = "cCompositeChat",
Name = "Footer",
},
},
Desc = "Broadcasts the header and footer of the player list to all players.",
},
DoWithPlayerByUUID = DoWithPlayerByUUID =
{ {
Params = Params =

View File

@ -327,6 +327,21 @@ return
}, },
Notes = "Spawns the specified particles to all players in the world exept the optional ExeptClient. A list of available particles by thinkofdeath can be found {{https://gist.github.com/thinkofdeath/5110835|Here}}", Notes = "Spawns the specified particles to all players in the world exept the optional ExeptClient. A list of available particles by thinkofdeath can be found {{https://gist.github.com/thinkofdeath/5110835|Here}}",
}, },
BroadcastPlayerListHeaderFooter =
{
Params =
{
{
Type = "cCompositeChat",
Name = "Header",
},
{
Type = "cCompositeChat",
Name = "Footer",
},
},
Desc = "Broadcasts the header and footer of the player list to all players in the world.",
},
BroadcastSoundEffect = BroadcastSoundEffect =
{ {
Params = Params =

View File

@ -48,6 +48,7 @@ public:
virtual void BroadcastParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, const cClientHandle * a_Exclude = nullptr) = 0; virtual void BroadcastParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, const cClientHandle * a_Exclude = nullptr) = 0;
virtual void BroadcastParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data, const cClientHandle * a_Exclude = nullptr) = 0; virtual void BroadcastParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data, const cClientHandle * a_Exclude = nullptr) = 0;
virtual void BroadcastPlayerListAddPlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) = 0; virtual void BroadcastPlayerListAddPlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) = 0;
virtual void BroadcastPlayerListHeaderFooter (const cCompositeChat & a_Header, const cCompositeChat & a_Footer) = 0;
virtual void BroadcastPlayerListRemovePlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) = 0; virtual void BroadcastPlayerListRemovePlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) = 0;
virtual void BroadcastPlayerListUpdateGameMode (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) = 0; virtual void BroadcastPlayerListUpdateGameMode (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) = 0;
virtual void BroadcastPlayerListUpdatePing (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) = 0; virtual void BroadcastPlayerListUpdatePing (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) = 0;

View File

@ -418,6 +418,19 @@ void cWorld::BroadcastPlayerListAddPlayer(const cPlayer & a_Player, const cClien
void cWorld::BroadcastPlayerListHeaderFooter(const cCompositeChat & a_Header, const cCompositeChat & a_Footer)
{
ForClientsInWorld(*this, nullptr, [&](cClientHandle & a_Client)
{
a_Client.SendPlayerListHeaderFooter(a_Header, a_Footer);
}
);
}
void cWorld::BroadcastPlayerListRemovePlayer(const cPlayer & a_Player, const cClientHandle * a_Exclude) void cWorld::BroadcastPlayerListRemovePlayer(const cPlayer & a_Player, const cClientHandle * a_Exclude)
{ {
ForClientsInWorld(*this, a_Exclude, [&](cClientHandle & a_Client) ForClientsInWorld(*this, a_Exclude, [&](cClientHandle & a_Client)

View File

@ -2625,6 +2625,15 @@ void cClientHandle::SendPlayerListAddPlayer(const cPlayer & a_Player)
void cClientHandle::SendPlayerListHeaderFooter(const cCompositeChat & a_Header, const cCompositeChat & a_Footer)
{
m_Protocol->SendPlayerListHeaderFooter(a_Header, a_Footer);
}
void cClientHandle::SendPlayerListRemovePlayer(const cPlayer & a_Player) void cClientHandle::SendPlayerListRemovePlayer(const cPlayer & a_Player)
{ {
m_Protocol->SendPlayerListRemovePlayer(a_Player); m_Protocol->SendPlayerListRemovePlayer(a_Player);

View File

@ -183,6 +183,7 @@ public: // tolua_export
void SendParticleEffect (const AString & a_ParticleName, const Vector3f a_Src, const Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data); void SendParticleEffect (const AString & a_ParticleName, const Vector3f a_Src, const Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data);
void SendPlayerAbilities (void); void SendPlayerAbilities (void);
void SendPlayerListAddPlayer (const cPlayer & a_Player); void SendPlayerListAddPlayer (const cPlayer & a_Player);
void SendPlayerListHeaderFooter (const cCompositeChat & a_Header, const cCompositeChat & a_Footer); // tolua_export
void SendPlayerListRemovePlayer (const cPlayer & a_Player); void SendPlayerListRemovePlayer (const cPlayer & a_Player);
void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName); void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName);
void SendPlayerListUpdateGameMode (const cPlayer & a_Player); void SendPlayerListUpdateGameMode (const cPlayer & a_Player);

View File

@ -57,81 +57,82 @@ AString cPacketizer::PacketTypeToStr(cProtocol::ePacketType a_PacketType)
{ {
switch (a_PacketType) switch (a_PacketType)
{ {
case cProtocol::pktAttachEntity: return "pktAttachEntity"; case cProtocol::pktAttachEntity: return "pktAttachEntity";
case cProtocol::pktBlockAction: return "pktBlockAction"; case cProtocol::pktBlockAction: return "pktBlockAction";
case cProtocol::pktBlockBreakAnim: return "pktBlockBreakAnim"; case cProtocol::pktBlockBreakAnim: return "pktBlockBreakAnim";
case cProtocol::pktBlockChange: return "pktBlockChange"; case cProtocol::pktBlockChange: return "pktBlockChange";
case cProtocol::pktBlockChanges: return "pktBlockChanges"; case cProtocol::pktBlockChanges: return "pktBlockChanges";
case cProtocol::pktCameraSetTo: return "pktCameraSetTo"; case cProtocol::pktCameraSetTo: return "pktCameraSetTo";
case cProtocol::pktChatRaw: return "pktChatRaw"; case cProtocol::pktChatRaw: return "pktChatRaw";
case cProtocol::pktCollectEntity: return "pktCollectEntity"; case cProtocol::pktCollectEntity: return "pktCollectEntity";
case cProtocol::pktDestroyEntity: return "pktDestroyEntity"; case cProtocol::pktDestroyEntity: return "pktDestroyEntity";
case cProtocol::pktDifficulty: return "pktDifficulty"; case cProtocol::pktDifficulty: return "pktDifficulty";
case cProtocol::pktDisconnectDuringLogin: return "pktDisconnectDuringLogin"; case cProtocol::pktDisconnectDuringLogin: return "pktDisconnectDuringLogin";
case cProtocol::pktDisconnectDuringGame: return "pktDisconnectDuringGame"; case cProtocol::pktDisconnectDuringGame: return "pktDisconnectDuringGame";
case cProtocol::pktDisplayObjective: return "pktDisplayObjective"; case cProtocol::pktDisplayObjective: return "pktDisplayObjective";
case cProtocol::pktEditSign: return "pktEditSign"; case cProtocol::pktEditSign: return "pktEditSign";
case cProtocol::pktEncryptionRequest: return "pktEncryptionRequest"; case cProtocol::pktEncryptionRequest: return "pktEncryptionRequest";
case cProtocol::pktEntityAnimation: return "pktEntityAnimation"; case cProtocol::pktEntityAnimation: return "pktEntityAnimation";
case cProtocol::pktEntityEffect: return "pktEntityEffect"; case cProtocol::pktEntityEffect: return "pktEntityEffect";
case cProtocol::pktEntityEquipment: return "pktEntityEquipment"; case cProtocol::pktEntityEquipment: return "pktEntityEquipment";
case cProtocol::pktEntityHeadLook: return "pktEntityHeadLook"; case cProtocol::pktEntityHeadLook: return "pktEntityHeadLook";
case cProtocol::pktEntityLook: return "pktEntityLook"; case cProtocol::pktEntityLook: return "pktEntityLook";
case cProtocol::pktEntityMeta: return "pktEntityMeta"; case cProtocol::pktEntityMeta: return "pktEntityMeta";
case cProtocol::pktEntityProperties: return "pktEntityProperties"; case cProtocol::pktEntityProperties: return "pktEntityProperties";
case cProtocol::pktEntityRelMove: return "pktEntityRelMove"; case cProtocol::pktEntityRelMove: return "pktEntityRelMove";
case cProtocol::pktEntityRelMoveLook: return "pktEntityRelMoveLook"; case cProtocol::pktEntityRelMoveLook: return "pktEntityRelMoveLook";
case cProtocol::pktEntityStatus: return "pktEntityStatus"; case cProtocol::pktEntityStatus: return "pktEntityStatus";
case cProtocol::pktEntityVelocity: return "pktEntityVelocity"; case cProtocol::pktEntityVelocity: return "pktEntityVelocity";
case cProtocol::pktExperience: return "pktExperience"; case cProtocol::pktExperience: return "pktExperience";
case cProtocol::pktExplosion: return "pktExplosion"; case cProtocol::pktExplosion: return "pktExplosion";
case cProtocol::pktGameMode: return "pktGameMode"; case cProtocol::pktGameMode: return "pktGameMode";
case cProtocol::pktHeldItemChange: return "pktHeldItemChange"; case cProtocol::pktHeldItemChange: return "pktHeldItemChange";
case cProtocol::pktInventorySlot: return "pktInventorySlot"; case cProtocol::pktInventorySlot: return "pktInventorySlot";
case cProtocol::pktJoinGame: return "pktJoinGame"; case cProtocol::pktJoinGame: return "pktJoinGame";
case cProtocol::pktKeepAlive: return "pktKeepAlive"; case cProtocol::pktKeepAlive: return "pktKeepAlive";
case cProtocol::pktLeashEntity: return "pktLeashEntity"; case cProtocol::pktLeashEntity: return "pktLeashEntity";
case cProtocol::pktLoginSuccess: return "pktLoginSuccess"; case cProtocol::pktLoginSuccess: return "pktLoginSuccess";
case cProtocol::pktMapData: return "pktMapData"; case cProtocol::pktMapData: return "pktMapData";
case cProtocol::pktParticleEffect: return "pktParticleEffect"; case cProtocol::pktParticleEffect: return "pktParticleEffect";
case cProtocol::pktPingResponse: return "pktPingResponse"; case cProtocol::pktPingResponse: return "pktPingResponse";
case cProtocol::pktPlayerAbilities: return "pktPlayerAbilities"; case cProtocol::pktPlayerAbilities: return "pktPlayerAbilities";
case cProtocol::pktPlayerList: return "pktPlayerList"; case cProtocol::pktPlayerList: return "pktPlayerList";
case cProtocol::pktPlayerMaxSpeed: return "pktPlayerMaxSpeed"; case cProtocol::pktPlayerListHeaderFooter: return "pktPlayerListHeaderFooter";
case cProtocol::pktPlayerMoveLook: return "pktPlayerMoveLook"; case cProtocol::pktPlayerMaxSpeed: return "pktPlayerMaxSpeed";
case cProtocol::pktPluginMessage: return "pktPluginMessage"; case cProtocol::pktPlayerMoveLook: return "pktPlayerMoveLook";
case cProtocol::pktRemoveEntityEffect: return "pktRemoveEntityEffect"; case cProtocol::pktPluginMessage: return "pktPluginMessage";
case cProtocol::pktResourcePack: return "pktResourcePack"; case cProtocol::pktRemoveEntityEffect: return "pktRemoveEntityEffect";
case cProtocol::pktRespawn: return "pktRespawn"; case cProtocol::pktResourcePack: return "pktResourcePack";
case cProtocol::pktScoreboardObjective: return "pktScoreboardObjective"; case cProtocol::pktRespawn: return "pktRespawn";
case cProtocol::pktSpawnObject: return "pktSpawnObject"; case cProtocol::pktScoreboardObjective: return "pktScoreboardObjective";
case cProtocol::pktSoundEffect: return "pktSoundEffect"; case cProtocol::pktSpawnObject: return "pktSpawnObject";
case cProtocol::pktSoundParticleEffect: return "pktSoundParticleEffect"; case cProtocol::pktSoundEffect: return "pktSoundEffect";
case cProtocol::pktSpawnExperienceOrb: return "pktSpawnExperienceOrb"; case cProtocol::pktSoundParticleEffect: return "pktSoundParticleEffect";
case cProtocol::pktSpawnGlobalEntity: return "pktSpawnGlobalEntity"; case cProtocol::pktSpawnExperienceOrb: return "pktSpawnExperienceOrb";
case cProtocol::pktSpawnMob: return "pktSpawnMob"; case cProtocol::pktSpawnGlobalEntity: return "pktSpawnGlobalEntity";
case cProtocol::pktSpawnOtherPlayer: return "pktSpawnOtherPlayer"; case cProtocol::pktSpawnMob: return "pktSpawnMob";
case cProtocol::pktSpawnPainting: return "pktSpawnPainting"; case cProtocol::pktSpawnOtherPlayer: return "pktSpawnOtherPlayer";
case cProtocol::pktSpawnPosition: return "pktSpawnPosition"; case cProtocol::pktSpawnPainting: return "pktSpawnPainting";
case cProtocol::pktStartCompression: return "pktStartCompression"; case cProtocol::pktSpawnPosition: return "pktSpawnPosition";
case cProtocol::pktStatistics: return "pktStatistics"; case cProtocol::pktStartCompression: return "pktStartCompression";
case cProtocol::pktStatusResponse: return "pktStatusResponse"; case cProtocol::pktStatistics: return "pktStatistics";
case cProtocol::pktTabCompletionResults: return "pktTabCompletionResults"; case cProtocol::pktStatusResponse: return "pktStatusResponse";
case cProtocol::pktTeleportEntity: return "pktTeleportEntity"; case cProtocol::pktTabCompletionResults: return "pktTabCompletionResults";
case cProtocol::pktTimeUpdate: return "pktTimeUpdate"; case cProtocol::pktTeleportEntity: return "pktTeleportEntity";
case cProtocol::pktTitle: return "pktTitle"; case cProtocol::pktTimeUpdate: return "pktTimeUpdate";
case cProtocol::pktUnloadChunk: return "pktUnloadChunk"; case cProtocol::pktTitle: return "pktTitle";
case cProtocol::pktUnlockRecipe: return "pktUnlockRecipe"; case cProtocol::pktUnloadChunk: return "pktUnloadChunk";
case cProtocol::pktUpdateBlockEntity: return "pktUpdateBlockEntity"; case cProtocol::pktUnlockRecipe: return "pktUnlockRecipe";
case cProtocol::pktUpdateHealth: return "pktUpdateHealth"; case cProtocol::pktUpdateBlockEntity: return "pktUpdateBlockEntity";
case cProtocol::pktUpdateScore: return "pktUpdateScore"; case cProtocol::pktUpdateHealth: return "pktUpdateHealth";
case cProtocol::pktUpdateSign: return "pktUpdateSign"; case cProtocol::pktUpdateScore: return "pktUpdateScore";
case cProtocol::pktUseBed: return "pktUseBed"; case cProtocol::pktUpdateSign: return "pktUpdateSign";
case cProtocol::pktWeather: return "pktWeather"; case cProtocol::pktUseBed: return "pktUseBed";
case cProtocol::pktWindowItems: return "pktWindowItems"; case cProtocol::pktWeather: return "pktWeather";
case cProtocol::pktWindowClose: return "pktWindowClose"; case cProtocol::pktWindowItems: return "pktWindowItems";
case cProtocol::pktWindowOpen: return "pktWindowOpen"; case cProtocol::pktWindowClose: return "pktWindowClose";
case cProtocol::pktWindowProperty: return "pktWindowProperty"; case cProtocol::pktWindowOpen: return "pktWindowOpen";
case cProtocol::pktWindowProperty: return "pktWindowProperty";
} }
return Printf("Unknown packet type: 0x%02x", a_PacketType); return Printf("Unknown packet type: 0x%02x", a_PacketType);
} }

View File

@ -102,6 +102,7 @@ public:
pktPingResponse, pktPingResponse,
pktPlayerAbilities, pktPlayerAbilities,
pktPlayerList, pktPlayerList,
pktPlayerListHeaderFooter,
pktPlayerMaxSpeed, pktPlayerMaxSpeed,
pktPlayerMoveLook, pktPlayerMoveLook,
pktPluginMessage, pktPluginMessage,
@ -397,6 +398,7 @@ public:
virtual void SendParticleEffect (const AString & a_SoundName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) = 0; virtual void SendParticleEffect (const AString & a_SoundName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) = 0;
virtual void SendParticleEffect (const AString & a_SoundName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data) = 0; virtual void SendParticleEffect (const AString & a_SoundName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data) = 0;
virtual void SendPlayerListAddPlayer (const cPlayer & a_Player) = 0; virtual void SendPlayerListAddPlayer (const cPlayer & a_Player) = 0;
virtual void SendPlayerListHeaderFooter (const cCompositeChat & a_Header, const cCompositeChat & a_Footer) = 0;
virtual void SendPlayerListRemovePlayer (const cPlayer & a_Player) = 0; virtual void SendPlayerListRemovePlayer (const cPlayer & a_Player) = 0;
virtual void SendPlayerListUpdateGameMode (const cPlayer & a_Player) = 0; virtual void SendPlayerListUpdateGameMode (const cPlayer & a_Player) = 0;
virtual void SendPlayerListUpdatePing (const cPlayer & a_Player) = 0; virtual void SendPlayerListUpdatePing (const cPlayer & a_Player) = 0;

View File

@ -1167,36 +1167,37 @@ UInt32 cProtocol_1_12_1::GetPacketID(ePacketType a_Packet)
{ {
switch (a_Packet) switch (a_Packet)
{ {
case pktAttachEntity: return 0x43; case pktAttachEntity: return 0x43;
case pktCameraSetTo: return 0x39; case pktCameraSetTo: return 0x39;
case pktCollectEntity: return 0x4b; case pktCollectEntity: return 0x4b;
case pktDestroyEntity: return 0x32; case pktDestroyEntity: return 0x32;
case pktDisplayObjective: return 0x3b; case pktDisplayObjective: return 0x3b;
case pktEntityEffect: return 0x4f; case pktEntityEffect: return 0x4f;
case pktEntityEquipment: return 0x3f; case pktEntityEquipment: return 0x3f;
case pktEntityHeadLook: return 0x36; case pktEntityHeadLook: return 0x36;
case pktEntityMeta: return 0x3c; case pktEntityMeta: return 0x3c;
case pktEntityProperties: return 0x4e; case pktEntityProperties: return 0x4e;
case pktEntityVelocity: return 0x3e; case pktEntityVelocity: return 0x3e;
case pktExperience: return 0x40; case pktExperience: return 0x40;
case pktHeldItemChange: return 0x3a; case pktHeldItemChange: return 0x3a;
case pktLeashEntity: return 0x3d; case pktLeashEntity: return 0x3d;
case pktPlayerList: return 0x2e; case pktPlayerList: return 0x2e;
case pktPlayerAbilities: return 0x2c; case pktPlayerListHeaderFooter: return 0x4a;
case pktPlayerMaxSpeed: return 0x4e; case pktPlayerAbilities: return 0x2c;
case pktPlayerMoveLook: return 0x2f; case pktPlayerMaxSpeed: return 0x4e;
case pktRemoveEntityEffect: return 0x33; case pktPlayerMoveLook: return 0x2f;
case pktResourcePack: return 0x34; case pktRemoveEntityEffect: return 0x33;
case pktRespawn: return 0x35; case pktResourcePack: return 0x34;
case pktScoreboardObjective: return 0x42; case pktRespawn: return 0x35;
case pktSpawnPosition: return 0x46; case pktScoreboardObjective: return 0x42;
case pktUnlockRecipe: return 0x31; case pktSpawnPosition: return 0x46;
case pktUpdateHealth: return 0x41; case pktUnlockRecipe: return 0x31;
case pktUpdateScore: return 0x45; case pktUpdateHealth: return 0x41;
case pktUseBed: return 0x30; case pktUpdateScore: return 0x45;
case pktTeleportEntity: return 0x4c; case pktUseBed: return 0x30;
case pktTimeUpdate: return 0x47; case pktTeleportEntity: return 0x4c;
case pktTitle: return 0x48; case pktTimeUpdate: return 0x47;
case pktTitle: return 0x48;
default: return Super::GetPacketID(a_Packet); default: return Super::GetPacketID(a_Packet);
} }

View File

@ -337,59 +337,60 @@ UInt32 cProtocol_1_13::GetPacketID(ePacketType a_PacketType)
{ {
switch (a_PacketType) switch (a_PacketType)
{ {
case pktAttachEntity: return 0x46; case pktAttachEntity: return 0x46;
case pktBlockChanges: return 0x0f; case pktBlockChanges: return 0x0f;
case pktCameraSetTo: return 0x3c; case pktCameraSetTo: return 0x3c;
case pktChatRaw: return 0x0e; case pktChatRaw: return 0x0e;
case pktCollectEntity: return 0x4f; case pktCollectEntity: return 0x4f;
case pktDestroyEntity: return 0x35; case pktDestroyEntity: return 0x35;
case pktDisconnectDuringGame: return 0x1b; case pktDisconnectDuringGame: return 0x1b;
case pktEditSign: return 0x2c; case pktEditSign: return 0x2c;
case pktEntityEffect: return 0x53; case pktEntityEffect: return 0x53;
case pktEntityEquipment: return 0x42; case pktEntityEquipment: return 0x42;
case pktEntityHeadLook: return 0x39; case pktEntityHeadLook: return 0x39;
case pktEntityLook: return 0x2a; case pktEntityLook: return 0x2a;
case pktEntityMeta: return 0x3f; case pktEntityMeta: return 0x3f;
case pktEntityProperties: return 0x52; case pktEntityProperties: return 0x52;
case pktEntityRelMove: return 0x28; case pktEntityRelMove: return 0x28;
case pktEntityRelMoveLook: return 0x29; case pktEntityRelMoveLook: return 0x29;
case pktEntityStatus: return 0x1c; case pktEntityStatus: return 0x1c;
case pktEntityVelocity: return 0x41; case pktEntityVelocity: return 0x41;
case pktExperience: return 0x43; case pktExperience: return 0x43;
case pktExplosion: return 0x1e; case pktExplosion: return 0x1e;
case pktGameMode: return 0x20; case pktGameMode: return 0x20;
case pktHeldItemChange: return 0x3d; case pktHeldItemChange: return 0x3d;
case pktInventorySlot: return 0x17; case pktInventorySlot: return 0x17;
case pktJoinGame: return 0x25; case pktJoinGame: return 0x25;
case pktKeepAlive: return 0x21; case pktKeepAlive: return 0x21;
case pktLeashEntity: return 0x40; case pktLeashEntity: return 0x40;
case pktMapData: return 0x26; case pktMapData: return 0x26;
case pktParticleEffect: return 0x24; case pktParticleEffect: return 0x24;
case pktPlayerAbilities: return 0x2e; case pktPlayerAbilities: return 0x2e;
case pktPlayerList: return 0x30; case pktPlayerList: return 0x30;
case pktPlayerMaxSpeed: return 0x52; case pktPlayerListHeaderFooter: return 0x4E;
case pktPlayerMoveLook: return 0x32; case pktPlayerMaxSpeed: return 0x52;
case pktPluginMessage: return 0x19; case pktPlayerMoveLook: return 0x32;
case pktRemoveEntityEffect: return 0x36; case pktPluginMessage: return 0x19;
case pktRespawn: return 0x38; case pktRemoveEntityEffect: return 0x36;
case pktScoreboardObjective: return 0x45; case pktRespawn: return 0x38;
case pktSoundEffect: return 0x1a; case pktScoreboardObjective: return 0x45;
case pktSoundParticleEffect: return 0x23; case pktSoundEffect: return 0x1a;
case pktSpawnPosition: return 0x49; case pktSoundParticleEffect: return 0x23;
case pktTabCompletionResults: return 0x10; case pktSpawnPosition: return 0x49;
case pktTeleportEntity: return 0x50; case pktTabCompletionResults: return 0x10;
case pktTimeUpdate: return 0x4a; case pktTeleportEntity: return 0x50;
case pktTitle: return 0x4b; case pktTimeUpdate: return 0x4a;
case pktUnloadChunk: return 0x1f; case pktTitle: return 0x4b;
case pktUnlockRecipe: return 0x32; case pktUnloadChunk: return 0x1f;
case pktUpdateHealth: return 0x44; case pktUnlockRecipe: return 0x32;
case pktUpdateScore: return 0x48; case pktUpdateHealth: return 0x44;
case pktUpdateSign: return GetPacketID(pktUpdateBlockEntity); case pktUpdateScore: return 0x48;
case pktUseBed: return 0x33; case pktUpdateSign: return GetPacketID(pktUpdateBlockEntity);
case pktWindowClose: return 0x13; case pktUseBed: return 0x33;
case pktWindowItems: return 0x15; case pktWindowClose: return 0x13;
case pktWindowOpen: return 0x14; case pktWindowItems: return 0x15;
case pktWindowProperty: return 0x16; case pktWindowOpen: return 0x14;
case pktWindowProperty: return 0x16;
default: return Super::GetPacketID(a_PacketType); default: return Super::GetPacketID(a_PacketType);
} }
} }

View File

@ -994,6 +994,19 @@ void cProtocol_1_8_0::SendPlayerListAddPlayer(const cPlayer & a_Player)
void cProtocol_1_8_0::SendPlayerListHeaderFooter(const cCompositeChat & a_Header, const cCompositeChat & a_Footer)
{
ASSERT(m_State == 3); // In game mode?
cPacketizer Pkt(*this, pktPlayerListHeaderFooter);
Pkt.WriteString(a_Header.CreateJsonString(false));
Pkt.WriteString(a_Footer.CreateJsonString(false));
}
void cProtocol_1_8_0::SendPlayerListRemovePlayer(const cPlayer & a_Player) void cProtocol_1_8_0::SendPlayerListRemovePlayer(const cPlayer & a_Player)
{ {
ASSERT(m_State == 3); // In game mode? ASSERT(m_State == 3); // In game mode?
@ -2043,79 +2056,80 @@ UInt32 cProtocol_1_8_0::GetPacketID(ePacketType a_PacketType)
{ {
switch (a_PacketType) switch (a_PacketType)
{ {
case pktAttachEntity: return 0x1b; case pktAttachEntity: return 0x1b;
case pktBlockAction: return 0x24; case pktBlockAction: return 0x24;
case pktBlockBreakAnim: return 0x25; case pktBlockBreakAnim: return 0x25;
case pktBlockChange: return 0x23; case pktBlockChange: return 0x23;
case pktBlockChanges: return 0x22; case pktBlockChanges: return 0x22;
case pktCameraSetTo: return 0x43; case pktCameraSetTo: return 0x43;
case pktChatRaw: return 0x02; case pktChatRaw: return 0x02;
case pktCollectEntity: return 0x0d; case pktCollectEntity: return 0x0d;
case pktDestroyEntity: return 0x13; case pktDestroyEntity: return 0x13;
case pktDifficulty: return 0x41; case pktDifficulty: return 0x41;
case pktDisconnectDuringGame: return 0x40; case pktDisconnectDuringGame: return 0x40;
case pktDisconnectDuringLogin: return 0x00; case pktDisconnectDuringLogin: return 0x00;
case pktDisplayObjective: return 0x3d; case pktDisplayObjective: return 0x3d;
case pktEditSign: return 0x36; case pktEditSign: return 0x36;
case pktEncryptionRequest: return 0x01; case pktEncryptionRequest: return 0x01;
case pktEntityAnimation: return 0x0b; case pktEntityAnimation: return 0x0b;
case pktEntityEffect: return 0x1d; case pktEntityEffect: return 0x1d;
case pktEntityEquipment: return 0x04; case pktEntityEquipment: return 0x04;
case pktEntityHeadLook: return 0x19; case pktEntityHeadLook: return 0x19;
case pktEntityLook: return 0x16; case pktEntityLook: return 0x16;
case pktEntityMeta: return 0x1c; case pktEntityMeta: return 0x1c;
case pktEntityProperties: return 0x20; case pktEntityProperties: return 0x20;
case pktEntityRelMove: return 0x15; case pktEntityRelMove: return 0x15;
case pktEntityRelMoveLook: return 0x17; case pktEntityRelMoveLook: return 0x17;
case pktEntityStatus: return 0x1a; case pktEntityStatus: return 0x1a;
case pktEntityVelocity: return 0x12; case pktEntityVelocity: return 0x12;
case pktExperience: return 0x1f; case pktExperience: return 0x1f;
case pktExplosion: return 0x27; case pktExplosion: return 0x27;
case pktGameMode: return 0x2b; case pktGameMode: return 0x2b;
case pktHeldItemChange: return 0x09; case pktHeldItemChange: return 0x09;
case pktInventorySlot: return 0x2f; case pktInventorySlot: return 0x2f;
case pktJoinGame: return 0x01; case pktJoinGame: return 0x01;
case pktKeepAlive: return 0x00; case pktKeepAlive: return 0x00;
case pktLeashEntity: return 0x1b; case pktLeashEntity: return 0x1b;
case pktLoginSuccess: return 0x02; case pktLoginSuccess: return 0x02;
case pktMapData: return 0x34; case pktMapData: return 0x34;
case pktParticleEffect: return 0x2a; case pktParticleEffect: return 0x2a;
case pktPingResponse: return 0x01; case pktPingResponse: return 0x01;
case pktPlayerAbilities: return 0x39; case pktPlayerAbilities: return 0x39;
case pktPlayerList: return 0x38; case pktPlayerList: return 0x38;
case pktPlayerMoveLook: return 0x08; case pktPlayerListHeaderFooter: return 0x47;
case pktPluginMessage: return 0x3f; case pktPlayerMoveLook: return 0x08;
case pktRemoveEntityEffect: return 0x1e; case pktPluginMessage: return 0x3f;
case pktResourcePack: return 0x48; case pktRemoveEntityEffect: return 0x1e;
case pktRespawn: return 0x07; case pktResourcePack: return 0x48;
case pktScoreboardObjective: return 0x3b; case pktRespawn: return 0x07;
case pktSoundEffect: return 0x29; case pktScoreboardObjective: return 0x3b;
case pktSoundParticleEffect: return 0x28; case pktSoundEffect: return 0x29;
case pktSpawnExperienceOrb: return 0x11; case pktSoundParticleEffect: return 0x28;
case pktSpawnGlobalEntity: return 0x2c; case pktSpawnExperienceOrb: return 0x11;
case pktSpawnMob: return 0x0f; case pktSpawnGlobalEntity: return 0x2c;
case pktSpawnObject: return 0x0e; case pktSpawnMob: return 0x0f;
case pktSpawnOtherPlayer: return 0x0c; case pktSpawnObject: return 0x0e;
case pktSpawnPainting: return 0x10; case pktSpawnOtherPlayer: return 0x0c;
case pktSpawnPosition: return 0x05; case pktSpawnPainting: return 0x10;
case pktStartCompression: return 0x03; case pktSpawnPosition: return 0x05;
case pktStatistics: return 0x37; case pktStartCompression: return 0x03;
case pktStatusResponse: return 0x00; case pktStatistics: return 0x37;
case pktTabCompletionResults: return 0x3a; case pktStatusResponse: return 0x00;
case pktTeleportEntity: return 0x18; case pktTabCompletionResults: return 0x3a;
case pktTimeUpdate: return 0x03; case pktTeleportEntity: return 0x18;
case pktTitle: return 0x45; case pktTimeUpdate: return 0x03;
case pktUnloadChunk: return 0x21; case pktTitle: return 0x45;
case pktUpdateBlockEntity: return 0x35; case pktUnloadChunk: return 0x21;
case pktUpdateHealth: return 0x06; case pktUpdateBlockEntity: return 0x35;
case pktUpdateScore: return 0x3c; case pktUpdateHealth: return 0x06;
case pktUpdateSign: return 0x33; case pktUpdateScore: return 0x3c;
case pktUseBed: return 0x0a; case pktUpdateSign: return 0x33;
case pktWeather: return 0x2b; case pktUseBed: return 0x0a;
case pktWindowClose: return 0x2e; case pktWeather: return 0x2b;
case pktWindowItems: return 0x30; case pktWindowClose: return 0x2e;
case pktWindowOpen: return 0x2d; case pktWindowItems: return 0x30;
case pktWindowProperty: return 0x31; case pktWindowOpen: return 0x2d;
case pktWindowProperty: return 0x31;
default: default:
{ {
LOG("Unhandled outgoing packet type: %s (0x%02x)", cPacketizer::PacketTypeToStr(a_PacketType), a_PacketType); LOG("Unhandled outgoing packet type: %s (0x%02x)", cPacketizer::PacketTypeToStr(a_PacketType), a_PacketType);

View File

@ -83,6 +83,7 @@ public:
virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override; virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override;
virtual void SendParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data) override; virtual void SendParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data) override;
virtual void SendPlayerListAddPlayer (const cPlayer & a_Player) override; virtual void SendPlayerListAddPlayer (const cPlayer & a_Player) override;
virtual void SendPlayerListHeaderFooter (const cCompositeChat & a_Header, const cCompositeChat & a_Footer) override;
virtual void SendPlayerListRemovePlayer (const cPlayer & a_Player) override; virtual void SendPlayerListRemovePlayer (const cPlayer & a_Player) override;
virtual void SendPlayerListUpdateGameMode (const cPlayer & a_Player) override; virtual void SendPlayerListUpdateGameMode (const cPlayer & a_Player) override;
virtual void SendPlayerListUpdatePing (const cPlayer & a_Player) override; virtual void SendPlayerListUpdatePing (const cPlayer & a_Player) override;

View File

@ -483,80 +483,81 @@ UInt32 cProtocol_1_9_0::GetPacketID(cProtocol::ePacketType a_Packet)
{ {
switch (a_Packet) switch (a_Packet)
{ {
case pktAttachEntity: return 0x40; case pktAttachEntity: return 0x40;
case pktBlockAction: return 0x0a; case pktBlockAction: return 0x0a;
case pktBlockBreakAnim: return 0x08; case pktBlockBreakAnim: return 0x08;
case pktBlockChange: return 0x0b; case pktBlockChange: return 0x0b;
case pktBlockChanges: return 0x10; case pktBlockChanges: return 0x10;
case pktCameraSetTo: return 0x36; case pktCameraSetTo: return 0x36;
case pktChatRaw: return 0x0f; case pktChatRaw: return 0x0f;
case pktCollectEntity: return 0x49; case pktCollectEntity: return 0x49;
case pktDestroyEntity: return 0x30; case pktDestroyEntity: return 0x30;
case pktDifficulty: return 0x0d; case pktDifficulty: return 0x0d;
case pktDisconnectDuringGame: return 0x1a; case pktDisconnectDuringGame: return 0x1a;
case pktDisconnectDuringLogin: return 0x0; case pktDisconnectDuringLogin: return 0x0;
case pktDisplayObjective: return 0x38; case pktDisplayObjective: return 0x38;
case pktEditSign: return 0x2a; case pktEditSign: return 0x2a;
case pktEncryptionRequest: return 0x01; case pktEncryptionRequest: return 0x01;
case pktEntityAnimation: return 0x06; case pktEntityAnimation: return 0x06;
case pktEntityEffect: return 0x4c; case pktEntityEffect: return 0x4c;
case pktEntityEquipment: return 0x3c; case pktEntityEquipment: return 0x3c;
case pktEntityHeadLook: return 0x34; case pktEntityHeadLook: return 0x34;
case pktEntityLook: return 0x27; case pktEntityLook: return 0x27;
case pktEntityMeta: return 0x39; case pktEntityMeta: return 0x39;
case pktEntityProperties: return 0x4b; case pktEntityProperties: return 0x4b;
case pktEntityRelMove: return 0x25; case pktEntityRelMove: return 0x25;
case pktEntityRelMoveLook: return 0x26; case pktEntityRelMoveLook: return 0x26;
case pktEntityStatus: return 0x1b; case pktEntityStatus: return 0x1b;
case pktEntityVelocity: return 0x3b; case pktEntityVelocity: return 0x3b;
case pktExperience: return 0x3d; case pktExperience: return 0x3d;
case pktExplosion: return 0x1c; case pktExplosion: return 0x1c;
case pktGameMode: return 0x1e; case pktGameMode: return 0x1e;
case pktHeldItemChange: return 0x37; case pktHeldItemChange: return 0x37;
case pktInventorySlot: return 0x16; case pktInventorySlot: return 0x16;
case pktJoinGame: return 0x23; case pktJoinGame: return 0x23;
case pktKeepAlive: return 0x1f; case pktKeepAlive: return 0x1f;
case pktLeashEntity: return 0x3a; case pktLeashEntity: return 0x3a;
case pktLoginSuccess: return 0x02; case pktLoginSuccess: return 0x02;
case pktMapData: return 0x24; case pktMapData: return 0x24;
case pktParticleEffect: return 0x22; case pktParticleEffect: return 0x22;
case pktPingResponse: return 0x01; case pktPingResponse: return 0x01;
case pktPlayerAbilities: return 0x2b; case pktPlayerAbilities: return 0x2b;
case pktPlayerList: return 0x2d; case pktPlayerList: return 0x2d;
case pktPlayerMaxSpeed: return 0x4b; case pktPlayerListHeaderFooter: return 0x48;
case pktPlayerMoveLook: return 0x2e; case pktPlayerMaxSpeed: return 0x4b;
case pktPluginMessage: return 0x18; case pktPlayerMoveLook: return 0x2e;
case pktRemoveEntityEffect: return 0x31; case pktPluginMessage: return 0x18;
case pktResourcePack: return 0x32; case pktRemoveEntityEffect: return 0x31;
case pktRespawn: return 0x33; case pktResourcePack: return 0x32;
case pktScoreboardObjective: return 0x3f; case pktRespawn: return 0x33;
case pktSpawnExperienceOrb: return 0x01; case pktScoreboardObjective: return 0x3f;
case pktSpawnGlobalEntity: return 0x02; case pktSpawnExperienceOrb: return 0x01;
case pktSpawnObject: return 0x00; case pktSpawnGlobalEntity: return 0x02;
case pktSpawnOtherPlayer: return 0x05; case pktSpawnObject: return 0x00;
case pktSpawnPainting: return 0x04; case pktSpawnOtherPlayer: return 0x05;
case pktSpawnPosition: return 0x43; case pktSpawnPainting: return 0x04;
case pktSoundEffect: return 0x19; case pktSpawnPosition: return 0x43;
case pktSoundParticleEffect: return 0x21; case pktSoundEffect: return 0x19;
case pktSpawnMob: return 0x03; case pktSoundParticleEffect: return 0x21;
case pktStartCompression: return 0x03; case pktSpawnMob: return 0x03;
case pktStatistics: return 0x07; case pktStartCompression: return 0x03;
case pktStatusResponse: return 0x00; case pktStatistics: return 0x07;
case pktTabCompletionResults: return 0x0e; case pktStatusResponse: return 0x00;
case pktTeleportEntity: return 0x4a; case pktTabCompletionResults: return 0x0e;
case pktTimeUpdate: return 0x44; case pktTeleportEntity: return 0x4a;
case pktTitle: return 0x45; case pktTimeUpdate: return 0x44;
case pktUnloadChunk: return 0x1d; case pktTitle: return 0x45;
case pktUpdateBlockEntity: return 0x09; case pktUnloadChunk: return 0x1d;
case pktUpdateHealth: return 0x3e; case pktUpdateBlockEntity: return 0x09;
case pktUpdateScore: return 0x42; case pktUpdateHealth: return 0x3e;
case pktUpdateSign: return 0x46; case pktUpdateScore: return 0x42;
case pktUseBed: return 0x2f; case pktUpdateSign: return 0x46;
case pktWeather: return 0x1e; case pktUseBed: return 0x2f;
case pktWindowClose: return 0x12; case pktWeather: return 0x1e;
case pktWindowItems: return 0x14; case pktWindowClose: return 0x12;
case pktWindowOpen: return 0x13; case pktWindowItems: return 0x14;
case pktWindowProperty: return 0x15; case pktWindowOpen: return 0x13;
case pktWindowProperty: return 0x15;
// Unsupported packets // Unsupported packets
case pktUnlockRecipe: case pktUnlockRecipe:
@ -2309,11 +2310,12 @@ UInt32 cProtocol_1_9_4::GetPacketID(cProtocol::ePacketType a_Packet)
{ {
switch (a_Packet) switch (a_Packet)
{ {
case pktCollectEntity: return 0x48; case pktCollectEntity: return 0x48;
case pktEntityEffect: return 0x4b; case pktEntityEffect: return 0x4b;
case pktEntityProperties: return 0x4a; case pktEntityProperties: return 0x4a;
case pktPlayerMaxSpeed: return 0x4a; case pktPlayerMaxSpeed: return 0x4a;
case pktTeleportEntity: return 0x49; case pktPlayerListHeaderFooter: return 0x47;
case pktTeleportEntity: return 0x49;
default: return Super::GetPacketID(a_Packet); default: return Super::GetPacketID(a_Packet);
} }

View File

@ -648,6 +648,18 @@ void cRoot::BroadcastPlayerListsRemovePlayer(const cPlayer & a_Player, const cCl
void cRoot::BroadcastPlayerListsHeaderFooter(const cCompositeChat & a_Header, const cCompositeChat & a_Footer)
{
for (auto & Entry : m_WorldsByName)
{
Entry.second.BroadcastPlayerListHeaderFooter(a_Header, a_Footer);
}
}
void cRoot::BroadcastChat(const AString & a_Message, eMessageType a_ChatPrefix) void cRoot::BroadcastChat(const AString & a_Message, eMessageType a_ChatPrefix)
{ {
for (auto & Entry : m_WorldsByName) for (auto & Entry : m_WorldsByName)

View File

@ -166,6 +166,9 @@ public:
/** Broadcast playerlist removal through all worlds */ /** Broadcast playerlist removal through all worlds */
void BroadcastPlayerListsRemovePlayer(const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr); void BroadcastPlayerListsRemovePlayer(const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr);
/** Broadcast playerlist header and footer through all worlds */
void BroadcastPlayerListsHeaderFooter(const cCompositeChat & a_Header, const cCompositeChat & a_Footer); // tolua_export
// tolua_begin // tolua_begin
/** Sends a chat message to all connected clients (in all worlds) */ /** Sends a chat message to all connected clients (in all worlds) */

View File

@ -209,6 +209,7 @@ public:
virtual void BroadcastParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp virtual void BroadcastParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp
virtual void BroadcastParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp virtual void BroadcastParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp
virtual void BroadcastPlayerListAddPlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override; virtual void BroadcastPlayerListAddPlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override;
virtual void BroadcastPlayerListHeaderFooter (const cCompositeChat & a_Header, const cCompositeChat & a_Footer) override; // tolua_export
virtual void BroadcastPlayerListRemovePlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override; virtual void BroadcastPlayerListRemovePlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override;
virtual void BroadcastPlayerListUpdateGameMode (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override; virtual void BroadcastPlayerListUpdateGameMode (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override;
virtual void BroadcastPlayerListUpdatePing (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override; virtual void BroadcastPlayerListUpdatePing (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override;