mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Add player join/leave event to ChatBot API (#1181)
* Add player join/leave event to ChatBot API (#1180) * Add method documentation * Dispatch Join/Leave after updating player list Co-authored-by: ORelio <ORelio@users.noreply.github.com>
This commit is contained in:
parent
a17d60047a
commit
4a8fb08f4b
2 changed files with 18 additions and 0 deletions
|
|
@ -299,6 +299,20 @@ namespace MinecraftClient
|
|||
/// <param name="inventoryId"></param>
|
||||
public virtual void OnInventoryClose(int inventoryId) { }
|
||||
|
||||
/// <summary>
|
||||
/// Called when a player joined the game
|
||||
/// </summary>
|
||||
/// <param name="uuid">UUID of the player</param>
|
||||
/// <param name="name">Name of the player</param>
|
||||
public virtual void OnPlayerJoin(Guid uuid, string name) { }
|
||||
|
||||
/// <summary>
|
||||
/// Called when a player left the game
|
||||
/// </summary>
|
||||
/// <param name="uuid">UUID of the player</param>
|
||||
/// <param name="name">Name of the player</param>
|
||||
public virtual void OnPlayerLeave(Guid uuid, string name) { }
|
||||
|
||||
/* =================================================================== */
|
||||
/* ToolBox - Methods below might be useful while creating your bot. */
|
||||
/* You should not need to interact with other classes of the program. */
|
||||
|
|
|
|||
|
|
@ -1759,6 +1759,8 @@ namespace MinecraftClient
|
|||
{
|
||||
onlinePlayers[uuid] = name;
|
||||
}
|
||||
|
||||
DispatchBotEvent(bot => bot.OnPlayerJoin(uuid, name));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1771,6 +1773,8 @@ namespace MinecraftClient
|
|||
{
|
||||
onlinePlayers.Remove(uuid);
|
||||
}
|
||||
|
||||
DispatchBotEvent(bot => bot.OnPlayerLeave(uuid, onlinePlayers[uuid]));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue