1
0

Packet refactoring, phase two, partial. Rewritten a few packet handling functions not to use cPacket-descendant objects.

This breaks plugin API! Plugins need to modify their hook functions to match those used in the Core plugin

git-svn-id: http://mc-server.googlecode.com/svn/trunk@750 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2012-08-18 09:56:28 +00:00
parent 2cae4b24d8
commit 2691e8daed
50 changed files with 2299 additions and 2704 deletions

View File

@@ -37,10 +37,16 @@ void cPlugin::Tick(float a_Dt)
bool cPlugin::OnBlockPlace(cPacket_BlockPlace * a_PacketData, cPlayer * a_Player)
bool cPlugin::OnBlockDig(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status, BLOCKTYPE a_OldBlock, NIBBLETYPE a_OldMeta)
{
UNUSED(a_PacketData);
UNUSED(a_Player);
UNUSED(a_BlockX);
UNUSED(a_BlockY);
UNUSED(a_BlockZ);
UNUSED(a_BlockFace);
UNUSED(a_Status);
UNUSED(a_OldBlock);
UNUSED(a_OldMeta);
return false;
}
@@ -48,11 +54,14 @@ bool cPlugin::OnBlockPlace(cPacket_BlockPlace * a_PacketData, cPlayer * a_Player
bool cPlugin::OnBlockDig(cPacket_BlockDig * a_PacketData, cPlayer * a_Player, cItem * a_PickupItem)
bool cPlugin::OnBlockPlace(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, const cItem & a_HeldItem)
{
UNUSED(a_PacketData);
UNUSED(a_Player);
UNUSED(a_PickupItem);
UNUSED(a_BlockX);
UNUSED(a_BlockY);
UNUSED(a_BlockZ);
UNUSED(a_BlockFace);
UNUSED(a_HeldItem);
return false;
}
@@ -60,21 +69,13 @@ bool cPlugin::OnBlockDig(cPacket_BlockDig * a_PacketData, cPlayer * a_Player, cI
bool cPlugin::OnCollectItem(cPickup * a_Pickup, cPlayer * a_Player)
bool cPlugin::OnBlockToPickup(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, const cPlayer * a_Player, const cItem & a_EquippedItem, cItems & a_Pickups)
{
UNUSED(a_Pickup);
UNUSED(a_Player);
return false;
}
bool cPlugin::OnDisconnect(const AString & a_Reason, cPlayer * a_Player)
{
UNUSED(a_Reason);
UNUSED(a_BlockType);
UNUSED(a_BlockMeta);
UNUSED(a_Player);
UNUSED(a_EquippedItem);
UNUSED(a_Pickups);
return false;
}
@@ -93,65 +94,6 @@ bool cPlugin::OnChat(const char * a_Chat, cPlayer * a_Player)
bool cPlugin::OnLogin(cPacket_Login * a_PacketData)
{
UNUSED(a_PacketData);
return false;
}
void cPlugin::OnPlayerSpawn(cPlayer * a_Player)
{
UNUSED(a_Player);
}
bool cPlugin::OnPlayerJoin(cPlayer * a_Player)
{
UNUSED(a_Player);
return false;
}
void cPlugin::OnPlayerMove(cPlayer * a_Player)
{
UNUSED(a_Player);
}
void cPlugin::OnTakeDamage(cPawn * a_Pawn, TakeDamageInfo * a_TakeDamageInfo)
{
UNUSED(a_Pawn);
UNUSED(a_TakeDamageInfo);
}
bool cPlugin::OnKilled(cPawn * a_Killed, cEntity * a_Killer)
{
UNUSED(a_Killed);
UNUSED(a_Killer);
return false;
}
void cPlugin::OnChunkGenerated(cWorld * a_World, int a_ChunkX, int a_ChunkZ)
{
UNUSED(a_World);
@@ -176,11 +118,10 @@ bool cPlugin::OnChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cL
bool cPlugin::OnPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe)
bool cPlugin::OnCollectItem(cPickup * a_Pickup, cPlayer * a_Player)
{
UNUSED(a_Pickup);
UNUSED(a_Player);
UNUSED(a_Grid);
UNUSED(a_Recipe);
return false;
}
@@ -200,6 +141,68 @@ bool cPlugin::OnCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid *
bool cPlugin::OnDisconnect(const AString & a_Reason, cPlayer * a_Player)
{
UNUSED(a_Reason);
UNUSED(a_Player);
return false;
}
bool cPlugin::OnKilled(cPawn * a_Killed, cEntity * a_Killer)
{
UNUSED(a_Killed);
UNUSED(a_Killer);
return false;
}
bool cPlugin::OnLogin(cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username)
{
UNUSED(a_Client);
UNUSED(a_ProtocolVersion);
UNUSED(a_Username);
return false;
}
bool cPlugin::OnPlayerJoin(cPlayer * a_Player)
{
UNUSED(a_Player);
return false;
}
void cPlugin::OnPlayerMove(cPlayer * a_Player)
{
UNUSED(a_Player);
}
void cPlugin::OnPlayerSpawn(cPlayer * a_Player)
{
UNUSED(a_Player);
}
bool cPlugin::OnPostCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe)
{
UNUSED(a_Player);
@@ -212,13 +215,11 @@ bool cPlugin::OnPostCrafting(const cPlayer * a_Player, const cCraftingGrid * a_G
bool cPlugin::OnBlockToPickup(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, const cPlayer * a_Player, const cItem & a_EquippedItem, cItems & a_Pickups)
bool cPlugin::OnPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe)
{
UNUSED(a_BlockType);
UNUSED(a_BlockMeta);
UNUSED(a_Player);
UNUSED(a_EquippedItem);
UNUSED(a_Pickups);
UNUSED(a_Grid);
UNUSED(a_Recipe);
return false;
}
@@ -226,9 +227,26 @@ bool cPlugin::OnBlockToPickup(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, con
bool cPlugin::OnWeatherChanged(cWorld * a_World)
void cPlugin::OnTakeDamage(cPawn * a_Pawn, TakeDamageInfo * a_TakeDamageInfo)
{
UNUSED(a_Pawn);
UNUSED(a_TakeDamageInfo);
}
bool cPlugin::OnUpdatedSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4)
{
UNUSED(a_World);
UNUSED(a_BlockX);
UNUSED(a_BlockY);
UNUSED(a_BlockZ);
UNUSED(a_Line1);
UNUSED(a_Line2);
UNUSED(a_Line3);
UNUSED(a_Line4);
return false;
}
@@ -253,16 +271,9 @@ bool cPlugin::OnUpdatingSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a
bool cPlugin::OnUpdatedSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4)
bool cPlugin::OnWeatherChanged(cWorld * a_World)
{
UNUSED(a_World);
UNUSED(a_BlockX);
UNUSED(a_BlockY);
UNUSED(a_BlockZ);
UNUSED(a_Line1);
UNUSED(a_Line2);
UNUSED(a_Line3);
UNUSED(a_Line4);
return false;
}