Cuberite
A lightweight, fast and extensible game server for Minecraft
Classes | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Types | List of all members
cPluginLua Class Reference

#include <PluginLua.h>

Inheritance diagram for cPluginLua:
Inheritance graph
[legend]
Collaboration diagram for cPluginLua:
Collaboration graph
[legend]

Classes

class  cOperation
 A RAII-style mutex lock for accessing the internal LuaState. More...
 

Public Member Functions

bool AddHookCallback (int a_HookType, cLuaState::cCallbackPtr &&a_Callback)
 Adds a Lua callback to be called for the specified hook. More...
 
template<typename FnT , typename... Args>
bool Call (FnT a_Fn, Args &&... a_Args)
 Call a Lua function residing in the plugin. More...
 
int CallFunctionFromForeignState (const AString &a_FunctionName, cLuaState &a_ForeignState, int a_ParamStart, int a_ParamEnd)
 Calls a function in this plugin's LuaState with parameters copied over from a_ForeignState. More...
 
bool CanAddOldStyleHook (int a_HookType)
 Returns true if the plugin contains the function for the specified hook type, using the old-style registration (#121) More...
 
 cPluginLua (const AString &a_PluginDirectory, cDeadlockDetect &a_DeadlockDetect)
 
virtual bool Load (void) override
 Loads and initializes the plugin. More...
 
virtual bool OnBlockSpread (cWorld &a_World, int a_BlockX, int a_BlockY, int a_BlockZ, eSpreadSource a_Source) override
 Calls the specified hook with the params given. More...
 
virtual bool OnBlockToPickups (cWorld &a_World, Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, const cBlockEntity *a_BlockEntity, const cEntity *a_Digger, const cItem *a_Tool, cItems &a_Pickups) override
 
virtual bool OnBrewingCompleted (cWorld &a_World, cBrewingstandEntity &a_BrewingstandEntity) override
 
virtual bool OnBrewingCompleting (cWorld &a_World, cBrewingstandEntity &a_BrewingstandEntity) override
 
virtual bool OnChat (cPlayer &a_Player, AString &a_Message) override
 
virtual bool OnChunkAvailable (cWorld &a_World, int a_ChunkX, int a_ChunkZ) override
 
virtual bool OnChunkGenerated (cWorld &a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc *a_ChunkDesc) override
 
virtual bool OnChunkGenerating (cWorld &a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc *a_ChunkDesc) override
 
virtual bool OnChunkUnloaded (cWorld &a_World, int a_ChunkX, int a_ChunkZ) override
 
virtual bool OnChunkUnloading (cWorld &a_World, int a_ChunkX, int a_ChunkZ) override
 
virtual bool OnCollectingPickup (cPlayer &a_Player, cPickup &a_Pickup) override
 
virtual bool OnCraftingNoRecipe (cPlayer &a_Player, cCraftingGrid &a_Grid, cCraftingRecipe &a_Recipe) override
 
virtual void OnDisable (void) override
 Called as the last call into the plugin before it is unloaded. More...
 
virtual bool OnDisconnect (cClientHandle &a_Client, const AString &a_Reason) override
 
virtual bool OnDropSpense (cWorld &a_World, cDropSpenserEntity &a_DropSpenser, int a_SlotNum) override
 
virtual bool OnEntityAddEffect (cEntity &a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, double a_DistanceModifier) override
 
virtual bool OnEntityChangedWorld (cEntity &a_Entity, cWorld &a_World) override
 
virtual bool OnEntityChangingWorld (cEntity &a_Entity, cWorld &a_World) override
 
virtual bool OnEntityTeleport (cEntity &a_Entity, const Vector3d &a_OldPosition, const Vector3d &a_NewPosition) override
 
virtual bool OnExecuteCommand (cPlayer *a_Player, const AStringVector &a_Split, const AString &a_EntireCommand, cPluginManager::CommandResult &a_Result) override
 
virtual bool OnExploded (cWorld &a_World, double a_ExplosionSize, bool a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void *a_SourceData) override
 
virtual bool OnExploding (cWorld &a_World, double &a_ExplosionSize, bool &a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void *a_SourceData) override
 
virtual bool OnHandshake (cClientHandle &a_Client, const AString &a_Username) override
 
virtual bool OnHopperPullingItem (cWorld &a_World, cHopperEntity &a_Hopper, int a_DstSlotNum, cBlockEntityWithItems &a_SrcEntity, int a_SrcSlotNum) override
 
virtual bool OnHopperPushingItem (cWorld &a_World, cHopperEntity &a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems &a_DstEntity, int a_DstSlotNum) override
 
virtual bool OnKilled (cEntity &a_Victim, TakeDamageInfo &a_TDI, AString &a_DeathMessage) override
 
virtual bool OnKilling (cEntity &a_Victim, cEntity *a_Killer, TakeDamageInfo &a_TDI) override
 
virtual bool OnLogin (cClientHandle &a_Client, UInt32 a_ProtocolVersion, const AString &a_Username) override
 
virtual bool OnLoginForge (cClientHandle &a_Client, const AStringMap &a_Mods) override
 
virtual bool OnPlayerAnimation (cPlayer &a_Player, int a_Animation) override
 
virtual bool OnPlayerBreakingBlock (cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override
 
virtual bool OnPlayerBrokenBlock (cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override
 
virtual bool OnPlayerCrouched (cPlayer &a_Player) override
 
virtual bool OnPlayerDestroyed (cPlayer &a_Player) override
 
virtual bool OnPlayerEating (cPlayer &a_Player) override
 
virtual bool OnPlayerFished (cPlayer &a_Player, const cItems &a_Reward, const int ExperienceAmount) override
 
virtual bool OnPlayerFishing (cPlayer &a_Player, cItems &a_Reward, int &ExperienceAmount) override
 
virtual bool OnPlayerFoodLevelChange (cPlayer &a_Player, int a_NewFoodLevel) override
 
virtual bool OnPlayerJoined (cPlayer &a_Player) override
 
virtual bool OnPlayerLeftClick (cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, char a_Status) override
 
virtual bool OnPlayerMoving (cPlayer &a_Player, const Vector3d &a_OldPosition, const Vector3d &a_NewPosition, bool a_PreviousIsOnGround) override
 
virtual bool OnPlayerOpeningWindow (cPlayer &a_Player, cWindow &a_Window) override
 
virtual bool OnPlayerPlacedBlock (cPlayer &a_Player, const sSetBlock &a_BlockChange) override
 
virtual bool OnPlayerPlacingBlock (cPlayer &a_Player, const sSetBlock &a_BlockChange) override
 
virtual bool OnPlayerRightClick (cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
 
virtual bool OnPlayerRightClickingEntity (cPlayer &a_Player, cEntity &a_Entity) override
 
virtual bool OnPlayerShooting (cPlayer &a_Player) override
 
virtual bool OnPlayerSpawned (cPlayer &a_Player) override
 
virtual bool OnPlayerTossingItem (cPlayer &a_Player) override
 
virtual bool OnPlayerUsedBlock (cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override
 
virtual bool OnPlayerUsedItem (cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
 
virtual bool OnPlayerUsingBlock (cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override
 
virtual bool OnPlayerUsingItem (cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
 
virtual bool OnPluginMessage (cClientHandle &a_Client, const AString &a_Channel, ContiguousByteBufferView a_Message) override
 
virtual bool OnPluginsLoaded (void) override
 
virtual bool OnPostCrafting (cPlayer &a_Player, cCraftingGrid &a_Grid, cCraftingRecipe &a_Recipe) override
 
virtual bool OnPreCrafting (cPlayer &a_Player, cCraftingGrid &a_Grid, cCraftingRecipe &a_Recipe) override
 
virtual bool OnProjectileHitBlock (cProjectileEntity &a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d &a_BlockHitPos) override
 
virtual bool OnProjectileHitEntity (cProjectileEntity &a_Projectile, cEntity &a_HitEntity) override
 
virtual bool OnServerPing (cClientHandle &a_ClientHandle, AString &a_ServerDescription, int &a_OnlinePlayersCount, int &a_MaxPlayersCount, AString &a_Favicon) override
 
virtual bool OnSpawnedEntity (cWorld &a_World, cEntity &a_Entity) override
 
virtual bool OnSpawnedMonster (cWorld &a_World, cMonster &a_Monster) override
 
virtual bool OnSpawningEntity (cWorld &a_World, cEntity &a_Entity) override
 
virtual bool OnSpawningMonster (cWorld &a_World, cMonster &a_Monster) override
 
virtual bool OnTakeDamage (cEntity &a_Receiver, TakeDamageInfo &a_TakeDamageInfo) override
 
virtual bool 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, cPlayer *a_Player) override
 
virtual bool OnUpdatingSign (cWorld &a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString &a_Line1, AString &a_Line2, AString &a_Line3, AString &a_Line4, cPlayer *a_Player) override
 
virtual bool OnWeatherChanged (cWorld &a_World) override
 
virtual bool OnWeatherChanging (cWorld &a_World, eWeather &a_NewWeather) override
 
virtual bool OnWorldStarted (cWorld &a_World) override
 
virtual bool OnWorldTick (cWorld &a_World, std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_LastTickDurationMSec) override
 
virtual void Tick (float a_Dt) override
 
virtual void Unload (void) override
 Unloads the plugin. More...
 
virtual ~cPluginLua () override
 
- Public Member Functions inherited from cPlugin
 cPlugin (const AString &a_FolderName)
 Creates a new instance. More...
 
const AStringGetFolderName (void) const
 Returns the name of the folder (in the Plugins folder) from which the plugin is loaded. More...
 
const AStringGetLoadError (void) const
 Returns the error encountered while loading the plugin. More...
 
AString GetLocalFolder (void) const
 Returns the folder relative to the MCS Executable, from which the plugin is loaded. More...
 
const AStringGetName (void) const
 
cPluginManager::ePluginStatus GetStatus (void) const
 
int GetVersion (void) const
 
bool IsLoaded (void) const
 
void SetName (const AString &a_Name)
 
void SetVersion (int a_Version)
 
virtual ~cPlugin ()
 

Static Public Member Functions

static const char * GetHookFnName (int a_HookType)
 Returns the name of Lua function that should handle the specified hook type in the older (#121) API. More...
 
- Static Public Member Functions inherited from cPlugin
static const char * GetClassStatic (void)
 

Protected Types

typedef std::map< int, cLuaCallbackscHookMap
 Maps hook types into arrays of Lua function references to call for each hook type. More...
 
typedef std::vector< cLuaState::cCallbackPtrcLuaCallbacks
 Provides an array of Lua function references. More...
 

Protected Member Functions

template<typename... Args>
bool CallSimpleHooks (int a_HookType, Args &&... a_Args)
 Calls a hook that has the simple format - single bool return value specifying whether the chain should continue. More...
 
void ClearWebTabs (void)
 Removes all WebTabs currently registered for this plugin from the WebAdmin. More...
 
void Close (void)
 Releases all Lua references, notifies and removes all m_Resettables[] and closes the m_LuaState. More...
 
- Protected Member Functions inherited from cPlugin
void SetLoadError (const AString &a_LoadError)
 Sets m_LoadError to the specified string and m_Status to psError. More...
 

Protected Attributes

cDeadlockDetectm_DeadlockDetect
 The DeadlockDetect object to which the plugin's CS is tracked. More...
 
cHookMap m_HookMap
 Hooks that the plugin has registered. More...
 
cLuaState m_LuaState
 The plugin's Lua state. More...
 
- Protected Attributes inherited from cPlugin
AString m_FolderName
 Name of the folder (in the Plugins folder) from which the plugin is loaded. More...
 
AString m_LoadError
 The error encountered while loading the plugin. More...
 
AString m_Name
 The name of the plugin, used to identify the plugin in the system and for inter-plugin calls. More...
 
cPluginManager::ePluginStatus m_Status
 
int m_Version
 

Private Types

using Super = cPlugin
 

Detailed Description

Definition at line 22 of file PluginLua.h.

Member Typedef Documentation

◆ cHookMap

typedef std::map<int, cLuaCallbacks> cPluginLua::cHookMap
protected

Maps hook types into arrays of Lua function references to call for each hook type.

Definition at line 170 of file PluginLua.h.

◆ cLuaCallbacks

typedef std::vector<cLuaState::cCallbackPtr> cPluginLua::cLuaCallbacks
protected

Provides an array of Lua function references.

Definition at line 167 of file PluginLua.h.

◆ Super

using cPluginLua::Super = cPlugin
private

Definition at line 27 of file PluginLua.h.

Constructor & Destructor Documentation

◆ cPluginLua()

cPluginLua::cPluginLua ( const AString a_PluginDirectory,
cDeadlockDetect a_DeadlockDetect 
)

Definition at line 38 of file PluginLua.cpp.

◆ ~cPluginLua()

cPluginLua::~cPluginLua ( )
overridevirtual

Definition at line 50 of file PluginLua.cpp.

Member Function Documentation

◆ AddHookCallback()

bool cPluginLua::AddHookCallback ( int  a_HookType,
cLuaState::cCallbackPtr &&  a_Callback 
)

Adds a Lua callback to be called for the specified hook.

Returns true if the hook was added successfully.

Definition at line 1160 of file PluginLua.cpp.

◆ Call()

template<typename FnT , typename... Args>
bool cPluginLua::Call ( FnT  a_Fn,
Args &&...  a_Args 
)
inline

Call a Lua function residing in the plugin.

Definition at line 160 of file PluginLua.h.

◆ CallFunctionFromForeignState()

int cPluginLua::CallFunctionFromForeignState ( const AString a_FunctionName,
cLuaState a_ForeignState,
int  a_ParamStart,
int  a_ParamEnd 
)

Calls a function in this plugin's LuaState with parameters copied over from a_ForeignState.

The values that the function returns are placed onto a_ForeignState. Returns the number of values returned, if successful, or negative number on failure.

Definition at line 1170 of file PluginLua.cpp.

◆ CallSimpleHooks()

template<typename... Args>
bool cPluginLua::CallSimpleHooks ( int  a_HookType,
Args &&...  a_Args 
)
inlineprotected

Calls a hook that has the simple format - single bool return value specifying whether the chain should continue.

The advanced hook types that need more processing implement a similar loop manually instead. Returns true if any of hook calls wants to abort the hook (returned true), false if all hook calls returned false.

Definition at line 193 of file PluginLua.h.

◆ CanAddOldStyleHook()

bool cPluginLua::CanAddOldStyleHook ( int  a_HookType)

Returns true if the plugin contains the function for the specified hook type, using the old-style registration (#121)

Definition at line 1053 of file PluginLua.cpp.

◆ ClearWebTabs()

void cPluginLua::ClearWebTabs ( void  )
protected

Removes all WebTabs currently registered for this plugin from the WebAdmin.

Definition at line 1204 of file PluginLua.cpp.

◆ Close()

void cPluginLua::Close ( void  )
protected

Releases all Lua references, notifies and removes all m_Resettables[] and closes the m_LuaState.

Definition at line 60 of file PluginLua.cpp.

◆ GetHookFnName()

const char * cPluginLua::GetHookFnName ( int  a_HookType)
static

Returns the name of Lua function that should handle the specified hook type in the older (#121) API.

Definition at line 1083 of file PluginLua.cpp.

◆ Load()

bool cPluginLua::Load ( void  )
overridevirtual

Loads and initializes the plugin.

Sets m_Status to psLoaded or psError accordingly. Returns true if the initialization succeeded, false otherwise.

Implements cPlugin.

Definition at line 84 of file PluginLua.cpp.

◆ OnBlockSpread()

bool cPluginLua::OnBlockSpread ( cWorld a_World,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
eSpreadSource  a_Source 
)
overridevirtual

Calls the specified hook with the params given.

Returns the bool that the hook callback returns.

Implements cPlugin.

Definition at line 221 of file PluginLua.cpp.

◆ OnBlockToPickups()

bool cPluginLua::OnBlockToPickups ( cWorld a_World,
Vector3i  a_BlockPos,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta,
const cBlockEntity a_BlockEntity,
const cEntity a_Digger,
const cItem a_Tool,
cItems a_Pickups 
)
overridevirtual

Implements cPlugin.

Definition at line 230 of file PluginLua.cpp.

◆ OnBrewingCompleted()

bool cPluginLua::OnBrewingCompleted ( cWorld a_World,
cBrewingstandEntity a_BrewingstandEntity 
)
overridevirtual

Implements cPlugin.

Definition at line 254 of file PluginLua.cpp.

◆ OnBrewingCompleting()

bool cPluginLua::OnBrewingCompleting ( cWorld a_World,
cBrewingstandEntity a_BrewingstandEntity 
)
overridevirtual

Implements cPlugin.

Definition at line 263 of file PluginLua.cpp.

◆ OnChat()

bool cPluginLua::OnChat ( cPlayer a_Player,
AString a_Message 
)
overridevirtual

Implements cPlugin.

Definition at line 272 of file PluginLua.cpp.

◆ OnChunkAvailable()

bool cPluginLua::OnChunkAvailable ( cWorld a_World,
int  a_ChunkX,
int  a_ChunkZ 
)
overridevirtual

Implements cPlugin.

Definition at line 296 of file PluginLua.cpp.

◆ OnChunkGenerated()

bool cPluginLua::OnChunkGenerated ( cWorld a_World,
int  a_ChunkX,
int  a_ChunkZ,
cChunkDesc a_ChunkDesc 
)
overridevirtual

Implements cPlugin.

Definition at line 305 of file PluginLua.cpp.

◆ OnChunkGenerating()

bool cPluginLua::OnChunkGenerating ( cWorld a_World,
int  a_ChunkX,
int  a_ChunkZ,
cChunkDesc a_ChunkDesc 
)
overridevirtual

Implements cPlugin.

Definition at line 314 of file PluginLua.cpp.

◆ OnChunkUnloaded()

bool cPluginLua::OnChunkUnloaded ( cWorld a_World,
int  a_ChunkX,
int  a_ChunkZ 
)
overridevirtual

Implements cPlugin.

Definition at line 323 of file PluginLua.cpp.

◆ OnChunkUnloading()

bool cPluginLua::OnChunkUnloading ( cWorld a_World,
int  a_ChunkX,
int  a_ChunkZ 
)
overridevirtual

Implements cPlugin.

Definition at line 332 of file PluginLua.cpp.

◆ OnCollectingPickup()

bool cPluginLua::OnCollectingPickup ( cPlayer a_Player,
cPickup a_Pickup 
)
overridevirtual

Implements cPlugin.

Definition at line 341 of file PluginLua.cpp.

◆ OnCraftingNoRecipe()

bool cPluginLua::OnCraftingNoRecipe ( cPlayer a_Player,
cCraftingGrid a_Grid,
cCraftingRecipe a_Recipe 
)
overridevirtual

Implements cPlugin.

Definition at line 350 of file PluginLua.cpp.

◆ OnDisable()

void cPluginLua::OnDisable ( void  )
overridevirtual

Called as the last call into the plugin before it is unloaded.

Reimplemented from cPlugin.

Definition at line 198 of file PluginLua.cpp.

◆ OnDisconnect()

bool cPluginLua::OnDisconnect ( cClientHandle a_Client,
const AString a_Reason 
)
overridevirtual

Implements cPlugin.

Definition at line 359 of file PluginLua.cpp.

◆ OnDropSpense()

bool cPluginLua::OnDropSpense ( cWorld a_World,
cDropSpenserEntity a_DropSpenser,
int  a_SlotNum 
)
overridevirtual

Implements cPlugin.

Definition at line 528 of file PluginLua.cpp.

◆ OnEntityAddEffect()

bool cPluginLua::OnEntityAddEffect ( cEntity a_Entity,
int  a_EffectType,
int  a_EffectDurationTicks,
int  a_EffectIntensity,
double  a_DistanceModifier 
)
overridevirtual

Implements cPlugin.

Definition at line 368 of file PluginLua.cpp.

◆ OnEntityChangedWorld()

bool cPluginLua::OnEntityChangedWorld ( cEntity a_Entity,
cWorld a_World 
)
overridevirtual

Implements cPlugin.

Definition at line 386 of file PluginLua.cpp.

◆ OnEntityChangingWorld()

bool cPluginLua::OnEntityChangingWorld ( cEntity a_Entity,
cWorld a_World 
)
overridevirtual

Implements cPlugin.

Definition at line 377 of file PluginLua.cpp.

◆ OnEntityTeleport()

bool cPluginLua::OnEntityTeleport ( cEntity a_Entity,
const Vector3d a_OldPosition,
const Vector3d a_NewPosition 
)
overridevirtual

Implements cPlugin.

Definition at line 688 of file PluginLua.cpp.

◆ OnExecuteCommand()

bool cPluginLua::OnExecuteCommand ( cPlayer a_Player,
const AStringVector a_Split,
const AString a_EntireCommand,
cPluginManager::CommandResult a_Result 
)
overridevirtual

Implements cPlugin.

Definition at line 395 of file PluginLua.cpp.

◆ OnExploded()

bool cPluginLua::OnExploded ( cWorld a_World,
double  a_ExplosionSize,
bool  a_CanCauseFire,
double  a_X,
double  a_Y,
double  a_Z,
eExplosionSource  a_Source,
void *  a_SourceData 
)
overridevirtual

Implements cPlugin.

Definition at line 419 of file PluginLua.cpp.

◆ OnExploding()

bool cPluginLua::OnExploding ( cWorld a_World,
double &  a_ExplosionSize,
bool &  a_CanCauseFire,
double  a_X,
double  a_Y,
double  a_Z,
eExplosionSource  a_Source,
void *  a_SourceData 
)
overridevirtual

Implements cPlugin.

Definition at line 460 of file PluginLua.cpp.

◆ OnHandshake()

bool cPluginLua::OnHandshake ( cClientHandle a_Client,
const AString a_Username 
)
overridevirtual

Implements cPlugin.

Definition at line 501 of file PluginLua.cpp.

◆ OnHopperPullingItem()

bool cPluginLua::OnHopperPullingItem ( cWorld a_World,
cHopperEntity a_Hopper,
int  a_DstSlotNum,
cBlockEntityWithItems a_SrcEntity,
int  a_SrcSlotNum 
)
overridevirtual

Implements cPlugin.

Definition at line 510 of file PluginLua.cpp.

◆ OnHopperPushingItem()

bool cPluginLua::OnHopperPushingItem ( cWorld a_World,
cHopperEntity a_Hopper,
int  a_SrcSlotNum,
cBlockEntityWithItems a_DstEntity,
int  a_DstSlotNum 
)
overridevirtual

Implements cPlugin.

Definition at line 519 of file PluginLua.cpp.

◆ OnKilled()

bool cPluginLua::OnKilled ( cEntity a_Victim,
TakeDamageInfo a_TDI,
AString a_DeathMessage 
)
overridevirtual

Implements cPlugin.

Definition at line 537 of file PluginLua.cpp.

◆ OnKilling()

bool cPluginLua::OnKilling ( cEntity a_Victim,
cEntity a_Killer,
TakeDamageInfo a_TDI 
)
overridevirtual

Implements cPlugin.

Definition at line 561 of file PluginLua.cpp.

◆ OnLogin()

bool cPluginLua::OnLogin ( cClientHandle a_Client,
UInt32  a_ProtocolVersion,
const AString a_Username 
)
overridevirtual

Implements cPlugin.

Definition at line 570 of file PluginLua.cpp.

◆ OnLoginForge()

bool cPluginLua::OnLoginForge ( cClientHandle a_Client,
const AStringMap a_Mods 
)
overridevirtual

Implements cPlugin.

Definition at line 579 of file PluginLua.cpp.

◆ OnPlayerAnimation()

bool cPluginLua::OnPlayerAnimation ( cPlayer a_Player,
int  a_Animation 
)
overridevirtual

Implements cPlugin.

Definition at line 588 of file PluginLua.cpp.

◆ OnPlayerBreakingBlock()

bool cPluginLua::OnPlayerBreakingBlock ( cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
eBlockFace  a_BlockFace,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)
overridevirtual

Implements cPlugin.

Definition at line 597 of file PluginLua.cpp.

◆ OnPlayerBrokenBlock()

bool cPluginLua::OnPlayerBrokenBlock ( cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
eBlockFace  a_BlockFace,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)
overridevirtual

Implements cPlugin.

Definition at line 606 of file PluginLua.cpp.

◆ OnPlayerCrouched()

bool cPluginLua::OnPlayerCrouched ( cPlayer a_Player)
overridevirtual

Implements cPlugin.

Definition at line 732 of file PluginLua.cpp.

◆ OnPlayerDestroyed()

bool cPluginLua::OnPlayerDestroyed ( cPlayer a_Player)
overridevirtual

Implements cPlugin.

Definition at line 615 of file PluginLua.cpp.

◆ OnPlayerEating()

bool cPluginLua::OnPlayerEating ( cPlayer a_Player)
overridevirtual

Implements cPlugin.

Definition at line 624 of file PluginLua.cpp.

◆ OnPlayerFished()

bool cPluginLua::OnPlayerFished ( cPlayer a_Player,
const cItems a_Reward,
const int  ExperienceAmount 
)
overridevirtual

Implements cPlugin.

Definition at line 642 of file PluginLua.cpp.

◆ OnPlayerFishing()

bool cPluginLua::OnPlayerFishing ( cPlayer a_Player,
cItems a_Reward,
int &  ExperienceAmount 
)
overridevirtual

Implements cPlugin.

Definition at line 652 of file PluginLua.cpp.

◆ OnPlayerFoodLevelChange()

bool cPluginLua::OnPlayerFoodLevelChange ( cPlayer a_Player,
int  a_NewFoodLevel 
)
overridevirtual

Implements cPlugin.

Definition at line 633 of file PluginLua.cpp.

◆ OnPlayerJoined()

bool cPluginLua::OnPlayerJoined ( cPlayer a_Player)
overridevirtual

Implements cPlugin.

Definition at line 661 of file PluginLua.cpp.

◆ OnPlayerLeftClick()

bool cPluginLua::OnPlayerLeftClick ( cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
eBlockFace  a_BlockFace,
char  a_Status 
)
overridevirtual

Implements cPlugin.

Definition at line 670 of file PluginLua.cpp.

◆ OnPlayerMoving()

bool cPluginLua::OnPlayerMoving ( cPlayer a_Player,
const Vector3d a_OldPosition,
const Vector3d a_NewPosition,
bool  a_PreviousIsOnGround 
)
overridevirtual

Implements cPlugin.

Definition at line 679 of file PluginLua.cpp.

◆ OnPlayerOpeningWindow()

bool cPluginLua::OnPlayerOpeningWindow ( cPlayer a_Player,
cWindow a_Window 
)
overridevirtual

Implements cPlugin.

Definition at line 697 of file PluginLua.cpp.

◆ OnPlayerPlacedBlock()

bool cPluginLua::OnPlayerPlacedBlock ( cPlayer a_Player,
const sSetBlock a_BlockChange 
)
overridevirtual

Implements cPlugin.

Definition at line 706 of file PluginLua.cpp.

◆ OnPlayerPlacingBlock()

bool cPluginLua::OnPlayerPlacingBlock ( cPlayer a_Player,
const sSetBlock a_BlockChange 
)
overridevirtual

Implements cPlugin.

Definition at line 719 of file PluginLua.cpp.

◆ OnPlayerRightClick()

bool cPluginLua::OnPlayerRightClick ( cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
eBlockFace  a_BlockFace,
int  a_CursorX,
int  a_CursorY,
int  a_CursorZ 
)
overridevirtual

Implements cPlugin.

Definition at line 742 of file PluginLua.cpp.

◆ OnPlayerRightClickingEntity()

bool cPluginLua::OnPlayerRightClickingEntity ( cPlayer a_Player,
cEntity a_Entity 
)
overridevirtual

Implements cPlugin.

Definition at line 751 of file PluginLua.cpp.

◆ OnPlayerShooting()

bool cPluginLua::OnPlayerShooting ( cPlayer a_Player)
overridevirtual

Implements cPlugin.

Definition at line 760 of file PluginLua.cpp.

◆ OnPlayerSpawned()

bool cPluginLua::OnPlayerSpawned ( cPlayer a_Player)
overridevirtual

Implements cPlugin.

Definition at line 769 of file PluginLua.cpp.

◆ OnPlayerTossingItem()

bool cPluginLua::OnPlayerTossingItem ( cPlayer a_Player)
overridevirtual

Implements cPlugin.

Definition at line 778 of file PluginLua.cpp.

◆ OnPlayerUsedBlock()

bool cPluginLua::OnPlayerUsedBlock ( cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
eBlockFace  a_BlockFace,
int  a_CursorX,
int  a_CursorY,
int  a_CursorZ,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)
overridevirtual

Implements cPlugin.

Definition at line 787 of file PluginLua.cpp.

◆ OnPlayerUsedItem()

bool cPluginLua::OnPlayerUsedItem ( cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
eBlockFace  a_BlockFace,
int  a_CursorX,
int  a_CursorY,
int  a_CursorZ 
)
overridevirtual

Implements cPlugin.

Definition at line 796 of file PluginLua.cpp.

◆ OnPlayerUsingBlock()

bool cPluginLua::OnPlayerUsingBlock ( cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
eBlockFace  a_BlockFace,
int  a_CursorX,
int  a_CursorY,
int  a_CursorZ,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)
overridevirtual

Implements cPlugin.

Definition at line 805 of file PluginLua.cpp.

◆ OnPlayerUsingItem()

bool cPluginLua::OnPlayerUsingItem ( cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
eBlockFace  a_BlockFace,
int  a_CursorX,
int  a_CursorY,
int  a_CursorZ 
)
overridevirtual

Implements cPlugin.

Definition at line 814 of file PluginLua.cpp.

◆ OnPluginMessage()

bool cPluginLua::OnPluginMessage ( cClientHandle a_Client,
const AString a_Channel,
ContiguousByteBufferView  a_Message 
)
overridevirtual

Implements cPlugin.

Definition at line 823 of file PluginLua.cpp.

◆ OnPluginsLoaded()

bool cPluginLua::OnPluginsLoaded ( void  )
overridevirtual

Implements cPlugin.

Definition at line 832 of file PluginLua.cpp.

◆ OnPostCrafting()

bool cPluginLua::OnPostCrafting ( cPlayer a_Player,
cCraftingGrid a_Grid,
cCraftingRecipe a_Recipe 
)
overridevirtual

Implements cPlugin.

Definition at line 854 of file PluginLua.cpp.

◆ OnPreCrafting()

bool cPluginLua::OnPreCrafting ( cPlayer a_Player,
cCraftingGrid a_Grid,
cCraftingRecipe a_Recipe 
)
overridevirtual

Implements cPlugin.

Definition at line 863 of file PluginLua.cpp.

◆ OnProjectileHitBlock()

bool cPluginLua::OnProjectileHitBlock ( cProjectileEntity a_Projectile,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
eBlockFace  a_Face,
const Vector3d a_BlockHitPos 
)
overridevirtual

Implements cPlugin.

Definition at line 872 of file PluginLua.cpp.

◆ OnProjectileHitEntity()

bool cPluginLua::OnProjectileHitEntity ( cProjectileEntity a_Projectile,
cEntity a_HitEntity 
)
overridevirtual

Implements cPlugin.

Definition at line 881 of file PluginLua.cpp.

◆ OnServerPing()

bool cPluginLua::OnServerPing ( cClientHandle a_ClientHandle,
AString a_ServerDescription,
int &  a_OnlinePlayersCount,
int &  a_MaxPlayersCount,
AString a_Favicon 
)
overridevirtual

Implements cPlugin.

Definition at line 890 of file PluginLua.cpp.

◆ OnSpawnedEntity()

bool cPluginLua::OnSpawnedEntity ( cWorld a_World,
cEntity a_Entity 
)
overridevirtual

Implements cPlugin.

Definition at line 914 of file PluginLua.cpp.

◆ OnSpawnedMonster()

bool cPluginLua::OnSpawnedMonster ( cWorld a_World,
cMonster a_Monster 
)
overridevirtual

Implements cPlugin.

Definition at line 923 of file PluginLua.cpp.

◆ OnSpawningEntity()

bool cPluginLua::OnSpawningEntity ( cWorld a_World,
cEntity a_Entity 
)
overridevirtual

Implements cPlugin.

Definition at line 932 of file PluginLua.cpp.

◆ OnSpawningMonster()

bool cPluginLua::OnSpawningMonster ( cWorld a_World,
cMonster a_Monster 
)
overridevirtual

Implements cPlugin.

Definition at line 941 of file PluginLua.cpp.

◆ OnTakeDamage()

bool cPluginLua::OnTakeDamage ( cEntity a_Receiver,
TakeDamageInfo a_TakeDamageInfo 
)
overridevirtual

Implements cPlugin.

Definition at line 950 of file PluginLua.cpp.

◆ OnUpdatedSign()

bool cPluginLua::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,
cPlayer a_Player 
)
overridevirtual

Implements cPlugin.

Definition at line 959 of file PluginLua.cpp.

◆ OnUpdatingSign()

bool cPluginLua::OnUpdatingSign ( cWorld a_World,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
AString a_Line1,
AString a_Line2,
AString a_Line3,
AString a_Line4,
cPlayer a_Player 
)
overridevirtual

Implements cPlugin.

Definition at line 973 of file PluginLua.cpp.

◆ OnWeatherChanged()

bool cPluginLua::OnWeatherChanged ( cWorld a_World)
overridevirtual

Implements cPlugin.

Definition at line 1002 of file PluginLua.cpp.

◆ OnWeatherChanging()

bool cPluginLua::OnWeatherChanging ( cWorld a_World,
eWeather a_NewWeather 
)
overridevirtual

Implements cPlugin.

Definition at line 1011 of file PluginLua.cpp.

◆ OnWorldStarted()

bool cPluginLua::OnWorldStarted ( cWorld a_World)
overridevirtual

Implements cPlugin.

Definition at line 1035 of file PluginLua.cpp.

◆ OnWorldTick()

bool cPluginLua::OnWorldTick ( cWorld a_World,
std::chrono::milliseconds  a_Dt,
std::chrono::milliseconds  a_LastTickDurationMSec 
)
overridevirtual

Implements cPlugin.

Definition at line 1044 of file PluginLua.cpp.

◆ Tick()

void cPluginLua::Tick ( float  a_Dt)
overridevirtual

Implements cPlugin.

Definition at line 212 of file PluginLua.cpp.

◆ Unload()

void cPluginLua::Unload ( void  )
overridevirtual

Unloads the plugin.

Sets m_Status to psDisabled. The default implementation removes the plugin's associations with cPluginManager, descendants should call it as well.

Reimplemented from cPlugin.

Definition at line 187 of file PluginLua.cpp.

Member Data Documentation

◆ m_DeadlockDetect

cDeadlockDetect& cPluginLua::m_DeadlockDetect
protected

The DeadlockDetect object to which the plugin's CS is tracked.

Definition at line 180 of file PluginLua.h.

◆ m_HookMap

cHookMap cPluginLua::m_HookMap
protected

Hooks that the plugin has registered.

Definition at line 177 of file PluginLua.h.

◆ m_LuaState

cLuaState cPluginLua::m_LuaState
protected

The plugin's Lua state.

Definition at line 174 of file PluginLua.h.


The documentation for this class was generated from the following files: