Skip to content

Commit

Permalink
fix and re-enable multi-plugin detection
Browse files Browse the repository at this point in the history
  • Loading branch information
PrincessRTFM committed Nov 4, 2023
1 parent e7f8b04 commit a46b972
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
22 changes: 17 additions & 5 deletions XIVComboVX/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ namespace PrincessRTFM.XIVComboVX;
public sealed class Plugin: IDalamudPlugin {
private bool disposed = false;

private static readonly string[] nonConflictingPluginIds = Array.Empty<string>();
private static readonly string[] conflictingPluginNameSubstrings = new string[] {
"combo",
};
private static readonly string[] conflictingPluginIdSubstrings = new string[] {
"combo",
};

internal const string commandBase = "/pcombo";
internal const string commandCustom = commandBase + "vx";

Expand Down Expand Up @@ -131,10 +139,17 @@ public Plugin(DalamudPluginInterface pluginInterface) {

public static int CheckForOtherComboPlugins() {
string[] otherComboPlugins = Service.Interface.InstalledPlugins
// ignore unloaded plugins, they have no effect
.Where(p => p.IsLoaded)
// ignore us, we don't conflict with ourselves
.Where(p => p.InternalName != Service.Interface.InternalName)
// any false positives reported go in here to be ignored
.Where(p => !nonConflictingPluginIds.Any(s => p.InternalName == s))
// check the internal and display names for any (case-insensitive) substrings that look like problems
.Where(p => conflictingPluginIdSubstrings.Any(s => p.InternalName.Contains(s, StringComparison.OrdinalIgnoreCase)))
.Where(p => conflictingPluginNameSubstrings.Any(s => p.Name.Contains(s, StringComparison.OrdinalIgnoreCase)))
// the list is used for user-facing display, so we only need the display name
.Select(p => p.Name)
.Where(n => n != Service.Interface.InternalName)
.Where(n => n.Contains("combo", StringComparison.OrdinalIgnoreCase))
.ToArray();

if (otherComboPlugins.Length > 0) {
Expand All @@ -146,9 +161,6 @@ public static int CheckForOtherComboPlugins() {
}

private static void otherComboPluginsDetected(params string[] otherComboPluginNames) {
#if !DEBUG
return; // I fucked something up somewhere
#endif
Service.Configuration.Active = false;
Service.Configuration.RegisterCommonCommand = false;
if (AcquiredBaseCommand)
Expand Down
2 changes: 1 addition & 1 deletion XIVComboVX/XIVComboVX.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Product>XIVComboVX</Product>
<Authors>attick, daemitus, VariableVixen</Authors>
<Version>9.12.1</Version>
<Version>9.12.2</Version>
<Description>This plugin condenses various abilities onto single buttons.</Description>
<PackageProjectUrl>https://github.com/PrincessRTFM/XIVComboPlugin</PackageProjectUrl>
<Copyright>Copyleft attick 2020 baybeeee</Copyright>
Expand Down

0 comments on commit a46b972

Please sign in to comment.