fix option strictness for some swaps (#1277)

This commit is contained in:
Harry
2019-08-15 03:27:23 +01:00
committed by Ganom
parent 2525390203
commit 3f0532b5bf
2 changed files with 27 additions and 5 deletions

View File

@@ -550,6 +550,18 @@ public class MenuManager
return entry;
}
public AbstractComparableEntry addPriorityEntry(String option, boolean strictOption)
{
option = Text.standardize(option);
AbstractComparableEntry entry =
newBaseComparableEntry(option, "", -1, -1, false, strictOption);
priorityEntries.add(entry);
return entry;
}
public AbstractComparableEntry addPriorityEntry(AbstractComparableEntry entry)
{
priorityEntries.add(entry);
@@ -566,6 +578,16 @@ public class MenuManager
priorityEntries.removeIf(entry::equals);
}
public void removePriorityEntry(String option, boolean strictOption)
{
option = Text.standardize(option);
AbstractComparableEntry entry =
newBaseComparableEntry(option, "", -1, -1, false, strictOption);
priorityEntries.removeIf(entry::equals);
}
/**
* Adds to the map of swaps. Strict options, not strict target but target1=target2
*/
@@ -878,4 +900,4 @@ public class MenuManager
return Integer.compare(this.priority, mapping.priority);
}
}
}
}

View File

@@ -1215,7 +1215,7 @@ public class MenuEntrySwapperPlugin extends Plugin
if (this.swapPay)
{
menuManager.addPriorityEntry("Pay");
menuManager.addPriorityEntry("Pay (");
menuManager.addPriorityEntry("Pay (", false);
}
if (this.swapQuick)
@@ -1360,7 +1360,7 @@ public class MenuEntrySwapperPlugin extends Plugin
menuManager.addPriorityEntry("Configure", "Fairy ring");
break;
case LAST_DESTINATION:
menuManager.addPriorityEntry("Last-destination", "Fairy ring");
menuManager.addPriorityEntry("Last-destination", false);
break;
}
@@ -1561,7 +1561,7 @@ public class MenuEntrySwapperPlugin extends Plugin
menuManager.removePriorityEntry("Transport");
menuManager.removePriorityEntry("Teleport", "Mage of zamorak");
menuManager.removePriorityEntry("Pay");
menuManager.removePriorityEntry("Pay (");
menuManager.removePriorityEntry("Pay (", false);
menuManager.removePriorityEntry("Quick-travel");
menuManager.removePriorityEntry("Enchant");
menuManager.removePriorityEntry("Edgeville", "Lever");
@@ -1620,7 +1620,7 @@ public class MenuEntrySwapperPlugin extends Plugin
menuManager.removePriorityEntry("Configure", "Fairy ring");
break;
case LAST_DESTINATION:
menuManager.removePriorityEntry("Last-destination");
menuManager.removePriorityEntry("Last-destination", false);
break;
}