Add inventory related ChatBot event

Added OnInventoryOpen and OnInventoryClose
Updated some method summary
This commit is contained in:
ReinforceZwei 2020-07-07 13:21:55 +08:00 committed by ORelio
parent 500e7f1bec
commit f2816c3fee
2 changed files with 31 additions and 10 deletions

View file

@ -1511,7 +1511,8 @@ namespace MinecraftClient
/// <summary>
/// When an inventory is opened
/// </summary>
/// <param name="inventory">Location to reach</param>
/// <param name="inventory">The inventory</param>
/// <param name="inventoryID">Inventory ID</param>
public void OnInventoryOpen(int inventoryID, Container inventory)
{
inventories[inventoryID] = inventory;
@ -1520,20 +1521,24 @@ namespace MinecraftClient
{
ConsoleIO.WriteLogLine("Inventory # " + inventoryID + " opened: " + inventory.Title);
ConsoleIO.WriteLogLine("Use /inventory to interact with it.");
DispatchBotEvent(bot => bot.OnInventoryOpen(inventoryID));
}
}
/// <summary>
/// When an inventory is close
/// </summary>
/// <param name="inventoryID">Location to reach</param>
/// <param name="inventoryID">Inventory ID</param>
public void OnInventoryClose(int inventoryID)
{
if (inventories.ContainsKey(inventoryID))
inventories.Remove(inventoryID);
if (inventoryID != 0)
{
ConsoleIO.WriteLogLine("Inventory # " + inventoryID + " closed.");
DispatchBotEvent(bot => bot.OnInventoryClose(inventoryID));
}
}
/// <summary>