mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Fix player inventory being deleted by server (#1430)
* Fix auto drop crash * Fix player inventory being deleted by server
This commit is contained in:
parent
f5f1a22b93
commit
d19764869c
3 changed files with 14 additions and 2 deletions
|
|
@ -200,6 +200,12 @@ namespace MinecraftClient.ChatBots
|
||||||
{
|
{
|
||||||
if (inventoryUpdated != -1)
|
if (inventoryUpdated != -1)
|
||||||
{
|
{
|
||||||
|
if (!GetInventories().ContainsKey(inventoryUpdated))
|
||||||
|
{
|
||||||
|
// Inventory updated but no inventory ?
|
||||||
|
LogDebugToConsoleTranslated("bot.autoDrop.no_inventory", inventoryUpdated);
|
||||||
|
return;
|
||||||
|
}
|
||||||
var inventory = GetInventories()[inventoryUpdated];
|
var inventory = GetInventories()[inventoryUpdated];
|
||||||
var items = inventory.Items.ToDictionary(entry => entry.Key, entry => entry.Value);
|
var items = inventory.Items.ToDictionary(entry => entry.Key, entry => entry.Value);
|
||||||
if (dropMode == Mode.Include)
|
if (dropMode == Mode.Include)
|
||||||
|
|
|
||||||
|
|
@ -1757,8 +1757,13 @@ namespace MinecraftClient
|
||||||
public void OnInventoryClose(int inventoryID)
|
public void OnInventoryClose(int inventoryID)
|
||||||
{
|
{
|
||||||
if (inventories.ContainsKey(inventoryID))
|
if (inventories.ContainsKey(inventoryID))
|
||||||
inventories.Remove(inventoryID);
|
{
|
||||||
|
if (inventoryID == 0)
|
||||||
|
inventories[0].Items.Clear(); // Don't delete player inventory
|
||||||
|
else
|
||||||
|
inventories.Remove(inventoryID);
|
||||||
|
}
|
||||||
|
|
||||||
if (inventoryID != 0)
|
if (inventoryID != 0)
|
||||||
{
|
{
|
||||||
Log.Info(Translations.Get("extra.inventory_close", inventoryID));
|
Log.Info(Translations.Get("extra.inventory_close", inventoryID));
|
||||||
|
|
|
||||||
|
|
@ -388,6 +388,7 @@ bot.autoDrop.list=Total {0} in the list:\n {1}
|
||||||
bot.autoDrop.switched=Switched to {0} mode.
|
bot.autoDrop.switched=Switched to {0} mode.
|
||||||
bot.autoDrop.unknown_mode=Unknwon mode. Available modes: Include, Exclude, Everything
|
bot.autoDrop.unknown_mode=Unknwon mode. Available modes: Include, Exclude, Everything
|
||||||
bot.autoDrop.no_mode=Cannot read drop mode from config. Using include mode.
|
bot.autoDrop.no_mode=Cannot read drop mode from config. Using include mode.
|
||||||
|
bot.autoDrop.no_inventory=Cannot find inventory {0}!
|
||||||
|
|
||||||
# AutoFish
|
# AutoFish
|
||||||
bot.autoFish.throw=Threw a fishing rod
|
bot.autoFish.throw=Threw a fishing rod
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue