Fix a dumb error
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package net.runelite.client.menus;
|
||||
|
||||
import joptsimple.internal.Strings;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import static net.runelite.client.menus.MenuManager.LEVEL_PATTERN;
|
||||
import net.runelite.client.util.Text;
|
||||
|
||||
@EqualsAndHashCode
|
||||
public class AbstractMenuEntry
|
||||
{
|
||||
@Getter
|
||||
@@ -88,7 +90,7 @@ public class AbstractMenuEntry
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean equals(AbstractMenuEntry other)
|
||||
/*boolean equals(AbstractMenuEntry other)
|
||||
{
|
||||
return target.equals(other.getTarget())
|
||||
&& option.equals(other.getOption())
|
||||
@@ -96,5 +98,5 @@ public class AbstractMenuEntry
|
||||
&& type == other.getType()
|
||||
&& strictOption == other.isStrictOption()
|
||||
&& strictTarget == other.isStrictTarget();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -418,6 +418,29 @@ public class MenuManager
|
||||
priorityEntries.add(entry);
|
||||
}
|
||||
|
||||
public void removePriorityEntry(String option, String target)
|
||||
{
|
||||
option = Text.standardize(option);
|
||||
target = Text.standardize(target);
|
||||
|
||||
AbstractMenuEntry entry = new AbstractMenuEntry(option, target);
|
||||
|
||||
Set<AbstractMenuEntry> toRemove = new HashSet<>();
|
||||
for (AbstractMenuEntry priorityEntry : priorityEntries)
|
||||
{
|
||||
if (entry.equals(priorityEntry))
|
||||
{
|
||||
toRemove.add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
for (AbstractMenuEntry e : toRemove)
|
||||
{
|
||||
priorityEntries.remove(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds to the set of menu entries which when present, will remove all entries except for this one
|
||||
* This method will add one with strict option, but not-strict target (contains for target, equals for option)
|
||||
@@ -431,35 +454,25 @@ public class MenuManager
|
||||
priorityEntries.add(entry);
|
||||
}
|
||||
|
||||
public void removePriorityEntry(String option, String target)
|
||||
{
|
||||
option = Text.standardize(option);
|
||||
target = Text.standardize(target);
|
||||
|
||||
AbstractMenuEntry entry = new AbstractMenuEntry(option, target);
|
||||
|
||||
for (AbstractMenuEntry priorityEntry : priorityEntries)
|
||||
{
|
||||
if (entry.equals(priorityEntry))
|
||||
{
|
||||
priorityEntries.remove(priorityEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removePriorityEntry(String option)
|
||||
{
|
||||
option = Text.standardize(option);
|
||||
|
||||
AbstractMenuEntry entry = new AbstractMenuEntry(option, "", false);
|
||||
|
||||
Set<AbstractMenuEntry> toRemove = new HashSet<>();
|
||||
for (AbstractMenuEntry priorityEntry : priorityEntries)
|
||||
{
|
||||
if (entry.equals(priorityEntry))
|
||||
{
|
||||
priorityEntries.remove(priorityEntry);
|
||||
toRemove.add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
for (AbstractMenuEntry e : toRemove)
|
||||
{
|
||||
priorityEntries.remove(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -515,12 +528,18 @@ public class MenuManager
|
||||
|
||||
public void removeSwap(AbstractMenuEntry swapFrom, AbstractMenuEntry swapTo)
|
||||
{
|
||||
Set<AbstractMenuEntry> toRemove = new HashSet<>();
|
||||
for (Map.Entry<AbstractMenuEntry, AbstractMenuEntry> e : swaps.entrySet())
|
||||
{
|
||||
if (e.getKey().equals(swapFrom) && e.getValue().equals(swapTo))
|
||||
{
|
||||
swaps.remove(e.getKey());
|
||||
toRemove.add(e.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
for (AbstractMenuEntry entry : toRemove)
|
||||
{
|
||||
swaps.remove(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ import net.runelite.client.plugins.PluginType;
|
||||
public class ShiftWalkerPlugin extends Plugin
|
||||
{
|
||||
|
||||
private static final String WALK_HERE = "WALK HERE";
|
||||
private static final String WALK_HERE = "Walk here";
|
||||
|
||||
@Inject
|
||||
private ShiftWalkerConfig config;
|
||||
@@ -91,11 +91,11 @@ public class ShiftWalkerPlugin extends Plugin
|
||||
|
||||
void startPrioritizing()
|
||||
{
|
||||
menuManager.addPriorityEntry(WALK_HERE, "");
|
||||
menuManager.addPriorityEntry(WALK_HERE);
|
||||
}
|
||||
|
||||
void stopPrioritizing()
|
||||
{
|
||||
menuManager.removePriorityEntry(WALK_HERE, "");
|
||||
menuManager.removePriorityEntry(WALK_HERE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.MenuEntry;
|
||||
|
||||
@Deprecated
|
||||
@Slf4j
|
||||
public class MenuUtil
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user