Add interfaces to non public/sealed classes referenced in public interfaces (#1808)

* Add interfaces to non public/sealed classes referenced in public interfaces

* Fixed inheritdocs + made most classes internal

* Add missing properties to IFate and Fate, fix documentation

---------

Co-authored-by: goat <16760685+goaaats@users.noreply.github.com>
This commit is contained in:
Blair 2024-06-29 07:05:34 +10:00 committed by GitHub
parent 3994f528b8
commit 7947b896ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
55 changed files with 1466 additions and 584 deletions

View file

@ -71,10 +71,11 @@ internal static class PluginValidator
problems.Add(new NoMainUiProblem());
var cmdManager = Service<CommandManager>.Get();
foreach (var cmd in cmdManager.Commands.Where(x => x.Value.LoaderAssemblyName == plugin.InternalName && x.Value.ShowInHelp))
foreach (var cmd in cmdManager.GetHandlersByAssemblyName(plugin.InternalName).Where(c => c.Key.Item2.ShowInHelp))
{
if (string.IsNullOrEmpty(cmd.Value.HelpMessage))
problems.Add(new CommandWithoutHelpTextProblem(cmd.Key));
if (string.IsNullOrEmpty(cmd.Key.Item2.HelpMessage))
problems.Add(new CommandWithoutHelpTextProblem(cmd.Value));
}
if (plugin.Manifest.Tags == null || plugin.Manifest.Tags.Count == 0)

View file

@ -7,7 +7,7 @@ namespace Dalamud.Plugin.Services;
/// <summary>
/// This collection represents the list of available Aetherytes in the Teleport window.
/// </summary>
public interface IAetheryteList : IReadOnlyCollection<AetheryteEntry>
public interface IAetheryteList : IReadOnlyCollection<IAetheryteEntry>
{
/// <summary>
/// Gets the amount of Aetherytes the local player has unlocked.
@ -19,5 +19,5 @@ public interface IAetheryteList : IReadOnlyCollection<AetheryteEntry>
/// </summary>
/// <param name="index">Index.</param>
/// <returns>A <see cref="AetheryteEntry"/> at the specified index.</returns>
public AetheryteEntry? this[int index] { get; }
public IAetheryteEntry? this[int index] { get; }
}

View file

@ -8,7 +8,7 @@ namespace Dalamud.Plugin.Services;
/// This collection represents the buddies present in your squadron or trust party.
/// It does not include the local player.
/// </summary>
public interface IBuddyList : IReadOnlyCollection<BuddyMember>
public interface IBuddyList : IReadOnlyCollection<IBuddyMember>
{
/// <summary>
/// Gets the amount of battle buddies the local player has.
@ -18,19 +18,19 @@ public interface IBuddyList : IReadOnlyCollection<BuddyMember>
/// <summary>
/// Gets the active companion buddy.
/// </summary>
public BuddyMember? CompanionBuddy { get; }
public IBuddyMember? CompanionBuddy { get; }
/// <summary>
/// Gets the active pet buddy.
/// </summary>
public BuddyMember? PetBuddy { get; }
public IBuddyMember? PetBuddy { get; }
/// <summary>
/// Gets a battle buddy at the specified spawn index.
/// </summary>
/// <param name="index">Spawn index.</param>
/// <returns>A <see cref="BuddyMember"/> at the specified spawn index.</returns>
public BuddyMember? this[int index] { get; }
public IBuddyMember? this[int index] { get; }
/// <summary>
/// Gets the address of the companion buddy.
@ -56,5 +56,5 @@ public interface IBuddyList : IReadOnlyCollection<BuddyMember>
/// </summary>
/// <param name="address">The address of the buddy in memory.</param>
/// <returns><see cref="BuddyMember"/> object containing the requested data.</returns>
public BuddyMember? CreateBuddyMemberReference(nint address);
public IBuddyMember? CreateBuddyMemberReference(nint address);
}

View file

@ -56,7 +56,7 @@ public interface IClientState
/// <summary>
/// Gets the local player character, if one is present.
/// </summary>
public PlayerCharacter? LocalPlayer { get; }
public IPlayerCharacter? LocalPlayer { get; }
/// <summary>
/// Gets the content ID of the local character.

View file

@ -12,7 +12,7 @@ public interface ICommandManager
/// <summary>
/// Gets a read-only list of all registered commands.
/// </summary>
public ReadOnlyDictionary<string, CommandInfo> Commands { get; }
public ReadOnlyDictionary<string, ICommandInfo> Commands { get; }
/// <summary>
/// Process a command in full.
@ -27,7 +27,7 @@ public interface ICommandManager
/// <param name="command">The command to dispatch.</param>
/// <param name="argument">The provided arguments.</param>
/// <param name="info">A <see cref="CommandInfo"/> object describing this command.</param>
public void DispatchCommand(string command, string argument, CommandInfo info);
public void DispatchCommand(string command, string argument, ICommandInfo info);
/// <summary>
/// Add a command handler, which you can use to add your own custom commands to the in-game chat.
@ -35,7 +35,7 @@ public interface ICommandManager
/// <param name="command">The command to register.</param>
/// <param name="info">A <see cref="CommandInfo"/> object describing the command.</param>
/// <returns>If adding was successful.</returns>
public bool AddHandler(string command, CommandInfo info);
public bool AddHandler(string command, ICommandInfo info);
/// <summary>
/// Remove a command from the command handlers.

View file

@ -11,7 +11,7 @@ public interface IContextMenu
/// A delegate type used for the <see cref="OnMenuOpened"/> event.
/// </summary>
/// <param name="args">Information about the currently opening menu.</param>
public delegate void OnMenuOpenedDelegate(MenuOpenedArgs args);
public delegate void OnMenuOpenedDelegate(IMenuOpenedArgs args);
/// <summary>
/// Event that gets fired whenever any context menu is opened.
@ -25,7 +25,7 @@ public interface IContextMenu
/// <param name="menuType">The type of context menu to add the item to.</param>
/// <param name="item">The item to add.</param>
/// <remarks>Used to add a context menu entry to <em>all</em> context menus.</remarks>
void AddMenuItem(ContextMenuType menuType, MenuItem item);
void AddMenuItem(ContextMenuType menuType, IMenuItem item);
/// <summary>
/// Removes a menu item from a context menu.
@ -34,5 +34,5 @@ public interface IContextMenu
/// <param name="item">The item to add.</param>
/// <remarks>Used to remove a context menu entry from <em>all</em> context menus.</remarks>
/// <returns><see langword="true"/> if the item was removed, <see langword="false"/> if it was not found.</returns>
bool RemoveMenuItem(ContextMenuType menuType, MenuItem item);
bool RemoveMenuItem(ContextMenuType menuType, IMenuItem item);
}

View file

@ -24,8 +24,7 @@ public interface IDtrBar
/// <param name="text">The text the entry shows.</param>
/// <returns>The entry object used to update, hide and remove the entry.</returns>
/// <exception cref="ArgumentException">Thrown when an entry with the specified title exists.</exception>
[Api10ToDo("Return IDtrBarEntry instead of DtrBarEntry")]
public DtrBarEntry Get(string title, SeString? text = null);
public IDtrBarEntry Get(string title, SeString? text = null);
/// <summary>
/// Removes a DTR bar entry from the system.

View file

@ -7,7 +7,7 @@ namespace Dalamud.Plugin.Services;
/// <summary>
/// This collection represents the currently available Fate events.
/// </summary>
public interface IFateTable : IReadOnlyCollection<Fate>
public interface IFateTable : IReadOnlyCollection<IFate>
{
/// <summary>
/// Gets the address of the Fate table.
@ -18,13 +18,20 @@ public interface IFateTable : IReadOnlyCollection<Fate>
/// Gets the amount of currently active Fates.
/// </summary>
public int Length { get; }
/// <summary>
/// Gets a value indicating whether this Fate is still valid in memory.
/// </summary>
/// <param name="fate">The fate to check.</param>
/// <returns>True or false.</returns>
public bool IsValid(IFate fate);
/// <summary>
/// Get an actor at the specified spawn index.
/// </summary>
/// <param name="index">Spawn index.</param>
/// <returns>A <see cref="Fate"/> at the specified spawn index.</returns>
public Fate? this[int index] { get; }
public IFate? this[int index] { get; }
/// <summary>
/// Gets the address of the Fate at the specified index of the fate table.
@ -38,5 +45,5 @@ public interface IFateTable : IReadOnlyCollection<Fate>
/// </summary>
/// <param name="offset">The offset of the actor in memory.</param>
/// <returns><see cref="Fate"/> object containing requested data.</returns>
public Fate? CreateFateReference(nint offset);
public IFate? CreateFateReference(nint offset);
}

View file

@ -7,7 +7,7 @@ namespace Dalamud.Plugin.Services;
/// <summary>
/// This collection represents the currently spawned FFXIV game objects.
/// </summary>
public interface IObjectTable : IEnumerable<GameObject>
public interface IObjectTable : IEnumerable<IGameObject>
{
/// <summary>
/// Gets the address of the object table.
@ -24,14 +24,14 @@ public interface IObjectTable : IEnumerable<GameObject>
/// </summary>
/// <param name="index">Spawn index.</param>
/// <returns>An <see cref="GameObject"/> at the specified spawn index.</returns>
public GameObject? this[int index] { get; }
public IGameObject? this[int index] { get; }
/// <summary>
/// Search for a game object by their Object ID.
/// </summary>
/// <param name="gameObjectId">Object ID to find.</param>
/// <returns>A game object or null.</returns>
public GameObject? SearchById(ulong gameObjectId);
public IGameObject? SearchById(ulong gameObjectId);
/// <summary>
/// Gets the address of the game object at the specified index of the object table.
@ -45,5 +45,5 @@ public interface IObjectTable : IEnumerable<GameObject>
/// </summary>
/// <param name="address">The address of the object in memory.</param>
/// <returns><see cref="GameObject"/> object or inheritor containing the requested data.</returns>
public GameObject? CreateObjectReference(nint address);
public IGameObject? CreateObjectReference(nint address);
}

View file

@ -13,7 +13,7 @@ public interface IPartyFinderGui
/// </summary>
/// <param name="listing">The listings received.</param>
/// <param name="args">Additional arguments passed by the game.</param>
public delegate void PartyFinderListingEventDelegate(PartyFinderListing listing, PartyFinderListingEventArgs args);
public delegate void PartyFinderListingEventDelegate(IPartyFinderListing listing, IPartyFinderListingEventArgs args);
/// <summary>
/// Event fired each time the game receives an individual Party Finder listing.

View file

@ -7,7 +7,7 @@ namespace Dalamud.Plugin.Services;
/// <summary>
/// This collection represents the actors present in your party or alliance.
/// </summary>
public interface IPartyList : IReadOnlyCollection<PartyMember>
public interface IPartyList : IReadOnlyCollection<IPartyMember>
{
/// <summary>
/// Gets the amount of party members the local player has.
@ -49,7 +49,7 @@ public interface IPartyList : IReadOnlyCollection<PartyMember>
/// </summary>
/// <param name="index">Spawn index.</param>
/// <returns>A <see cref="PartyMember"/> at the specified spawn index.</returns>
public PartyMember? this[int index] { get; }
public IPartyMember? this[int index] { get; }
/// <summary>
/// Gets the address of the party member at the specified index of the party list.
@ -63,7 +63,7 @@ public interface IPartyList : IReadOnlyCollection<PartyMember>
/// </summary>
/// <param name="address">The address of the party member in memory.</param>
/// <returns>The party member object containing the requested data.</returns>
public PartyMember? CreatePartyMemberReference(nint address);
public IPartyMember? CreatePartyMemberReference(nint address);
/// <summary>
/// Gets the address of the alliance member at the specified index of the alliance list.
@ -77,5 +77,5 @@ public interface IPartyList : IReadOnlyCollection<PartyMember>
/// </summary>
/// <param name="address">The address of the alliance member in memory.</param>
/// <returns>The party member object containing the requested data.</returns>
public PartyMember? CreateAllianceMemberReference(nint address);
public IPartyMember? CreateAllianceMemberReference(nint address);
}

View file

@ -11,41 +11,41 @@ public interface ITargetManager
/// Gets or sets the current target.
/// Set to null to clear the target.
/// </summary>
public GameObject? Target { get; set; }
public IGameObject? Target { get; set; }
/// <summary>
/// Gets or sets the mouseover target.
/// Set to null to clear the target.
/// </summary>
public GameObject? MouseOverTarget { get; set; }
public IGameObject? MouseOverTarget { get; set; }
/// <summary>
/// Gets or sets the focus target.
/// Set to null to clear the target.
/// </summary>
public GameObject? FocusTarget { get; set; }
public IGameObject? FocusTarget { get; set; }
/// <summary>
/// Gets or sets the previous target.
/// Set to null to clear the target.
/// </summary>
public GameObject? PreviousTarget { get; set; }
public IGameObject? PreviousTarget { get; set; }
/// <summary>
/// Gets or sets the soft target.
/// Set to null to clear the target.
/// </summary>
public GameObject? SoftTarget { get; set; }
public IGameObject? SoftTarget { get; set; }
/// <summary>
/// Gets or sets the gpose target.
/// Set to null to clear the target.
/// </summary>
public GameObject? GPoseTarget { get; set; }
public IGameObject? GPoseTarget { get; set; }
/// <summary>
/// Gets or sets the mouseover nameplate target.
/// Set to null to clear the target.
/// </summary>
public GameObject? MouseOverNameplateTarget { get; set; }
public IGameObject? MouseOverNameplateTarget { get; set; }
}

View file

@ -11,9 +11,9 @@ namespace Dalamud.Plugin.Services;
public interface ITitleScreenMenu
{
/// <summary>
/// Gets the list of entries in the title screen menu.
/// Gets the list of read only entries in the title screen menu.
/// </summary>
public IReadOnlyList<TitleScreenMenuEntry> Entries { get; }
public IReadOnlyList<IReadOnlyTitleScreenMenuEntry> Entries { get; }
/// <summary>
/// Adds a new entry to the title screen menu.
@ -21,9 +21,9 @@ public interface ITitleScreenMenu
/// <param name="text">The text to show.</param>
/// <param name="texture">The texture to show.</param>
/// <param name="onTriggered">The action to execute when the option is selected.</param>
/// <returns>A <see cref="TitleScreenMenu"/> object that can be used to manage the entry.</returns>
/// <returns>A <see cref="IReadOnlyTitleScreenMenuEntry"/> object that can be reference the entry.</returns>
/// <exception cref="ArgumentException">Thrown when the texture provided does not match the required resolution(64x64).</exception>
public TitleScreenMenuEntry AddEntry(string text, IDalamudTextureWrap texture, Action onTriggered);
public IReadOnlyTitleScreenMenuEntry AddEntry(string text, IDalamudTextureWrap texture, Action onTriggered);
/// <summary>
/// Adds a new entry to the title screen menu.
@ -32,13 +32,13 @@ public interface ITitleScreenMenu
/// <param name="text">The text to show.</param>
/// <param name="texture">The texture to show.</param>
/// <param name="onTriggered">The action to execute when the option is selected.</param>
/// <returns>A <see cref="TitleScreenMenu"/> object that can be used to manage the entry.</returns>
/// <returns>A <see cref="IReadOnlyTitleScreenMenuEntry"/> object that can be used to reference the entry.</returns>
/// <exception cref="ArgumentException">Thrown when the texture provided does not match the required resolution(64x64).</exception>
public TitleScreenMenuEntry AddEntry(ulong priority, string text, IDalamudTextureWrap texture, Action onTriggered);
public IReadOnlyTitleScreenMenuEntry AddEntry(ulong priority, string text, IDalamudTextureWrap texture, Action onTriggered);
/// <summary>
/// Remove an entry from the title screen menu.
/// </summary>
/// <param name="entry">The entry to remove.</param>
public void RemoveEntry(TitleScreenMenuEntry entry);
public void RemoveEntry(IReadOnlyTitleScreenMenuEntry entry);
}