mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
feat: add support for unsupported container type in inventory TUI
- Implemented a check in the Inventory command to log a warning and return a failure status if the container type is not PlayerInventory. - Added a new localized string for the warning message to inform users about unsupported container types. These changes improve user feedback and error handling in the inventory management system.
This commit is contained in:
parent
dcfff3f1ba
commit
e5b81fe428
3 changed files with 18 additions and 0 deletions
|
|
@ -435,6 +435,12 @@ namespace MinecraftClient.Commands
|
|||
return r.SetAndReturn(CmdResult.Status.Fail, msg);
|
||||
}
|
||||
|
||||
if (container.Type != ContainerType.PlayerInventory)
|
||||
{
|
||||
handler.Log.Warn(string.Format(Translations.cmd_inventory_tui_unsupported_container, inventoryId));
|
||||
return r.SetAndReturn(CmdResult.Status.Fail);
|
||||
}
|
||||
|
||||
handler.Log.Info(string.Format(Translations.cmd_inventory_tui_opening, inventoryId));
|
||||
|
||||
bool success = InventoryTuiHost.Launch(handler, inventoryId);
|
||||
|
|
|
|||
|
|
@ -6332,6 +6332,15 @@ namespace MinecraftClient {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to TUI viewer does not support this container type (Inventory #{0}). Use '/inventory {0} list' to view its contents..
|
||||
/// </summary>
|
||||
internal static string cmd_inventory_tui_unsupported_container {
|
||||
get {
|
||||
return ResourceManager.GetString("cmd.inventory.tui_unsupported_container", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Hold Shift + Left-click to select and copy text..
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -2229,6 +2229,9 @@ Logging in...</value>
|
|||
<data name="cmd.inventory.tui_launch_failed" xml:space="preserve">
|
||||
<value>Failed to launch TUI inventory viewer.</value>
|
||||
</data>
|
||||
<data name="cmd.inventory.tui_unsupported_container" xml:space="preserve">
|
||||
<value>TUI viewer does not support this container type (Inventory #{0}). Use '/inventory {0} list' to view its contents.</value>
|
||||
</data>
|
||||
<data name="tui.select_copy_hint" xml:space="preserve">
|
||||
<value>Hold Shift + Left-click to select and copy text.</value>
|
||||
</data>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue