Rename dumb class
This commit is contained in:
@@ -32,7 +32,7 @@ import static net.runelite.client.menus.MenuManager.LEVEL_PATTERN;
|
|||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
|
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class AbstractMenuEntry
|
public class ComparableEntry
|
||||||
{
|
{
|
||||||
@Getter
|
@Getter
|
||||||
private String option;
|
private String option;
|
||||||
@@ -52,17 +52,17 @@ public class AbstractMenuEntry
|
|||||||
@Getter
|
@Getter
|
||||||
private boolean strictTarget;
|
private boolean strictTarget;
|
||||||
|
|
||||||
public AbstractMenuEntry(String option, String target)
|
public ComparableEntry(String option, String target)
|
||||||
{
|
{
|
||||||
this(option, target, -1, -1, true, true);
|
this(option, target, -1, -1, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractMenuEntry(String option, String target, boolean strictTarget)
|
public ComparableEntry(String option, String target, boolean strictTarget)
|
||||||
{
|
{
|
||||||
this(option, target, -1, -1, true, strictTarget);
|
this(option, target, -1, -1, true, strictTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractMenuEntry(String option, String target, int id, int type, boolean strictOption, boolean strictTarget)
|
public ComparableEntry(String option, String target, int id, int type, boolean strictOption, boolean strictTarget)
|
||||||
{
|
{
|
||||||
this.option = option;
|
this.option = option;
|
||||||
this.target = target;
|
this.target = target;
|
||||||
@@ -113,14 +113,4 @@ public class AbstractMenuEntry
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*boolean equals(AbstractMenuEntry other)
|
|
||||||
{
|
|
||||||
return target.equals(other.getTarget())
|
|
||||||
&& option.equals(other.getOption())
|
|
||||||
&& id == other.getId()
|
|
||||||
&& type == other.getType()
|
|
||||||
&& strictOption == other.isStrictOption()
|
|
||||||
&& strictTarget == other.isStrictTarget();
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
@@ -91,10 +91,10 @@ public class MenuManager
|
|||||||
private final Multimap<Integer, WidgetMenuOption> managedMenuOptions = HashMultimap.create();
|
private final Multimap<Integer, WidgetMenuOption> managedMenuOptions = HashMultimap.create();
|
||||||
private final Set<String> npcMenuOptions = new HashSet<>();
|
private final Set<String> npcMenuOptions = new HashSet<>();
|
||||||
|
|
||||||
private final Set<AbstractMenuEntry> priorityEntries = new HashSet<>();
|
private final Set<ComparableEntry> priorityEntries = new HashSet<>();
|
||||||
private final Set<MenuEntry> currentPriorityEntries = new HashSet<>();
|
private final Set<MenuEntry> currentPriorityEntries = new HashSet<>();
|
||||||
|
|
||||||
private final Map<AbstractMenuEntry, AbstractMenuEntry> swaps = new HashMap<>();
|
private final Map<ComparableEntry, ComparableEntry> swaps = new HashMap<>();
|
||||||
private final Set<MenuEntry> originalTypes = new HashSet<>();
|
private final Set<MenuEntry> originalTypes = new HashSet<>();
|
||||||
private final Set<Integer> leftClickObjects = new HashSet<>();
|
private final Set<Integer> leftClickObjects = new HashSet<>();
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ public class MenuManager
|
|||||||
final MenuEntry newestEntry = menuEntries[menuEntries.length - 1];
|
final MenuEntry newestEntry = menuEntries[menuEntries.length - 1];
|
||||||
|
|
||||||
boolean isPrio = false;
|
boolean isPrio = false;
|
||||||
for (AbstractMenuEntry p : priorityEntries)
|
for (ComparableEntry p : priorityEntries)
|
||||||
{
|
{
|
||||||
if (p.matches(newestEntry))
|
if (p.matches(newestEntry))
|
||||||
{
|
{
|
||||||
@@ -203,8 +203,8 @@ public class MenuManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find the current entry in the swaps map
|
// Find the current entry in the swaps map
|
||||||
AbstractMenuEntry swapEntry = null;
|
ComparableEntry swapEntry = null;
|
||||||
for (AbstractMenuEntry e : swaps.keySet())
|
for (ComparableEntry e : swaps.keySet())
|
||||||
{
|
{
|
||||||
if (e.matches(newestEntry))
|
if (e.matches(newestEntry))
|
||||||
{
|
{
|
||||||
@@ -215,7 +215,7 @@ public class MenuManager
|
|||||||
|
|
||||||
if (swapEntry != null)
|
if (swapEntry != null)
|
||||||
{
|
{
|
||||||
AbstractMenuEntry swapTarget = swaps.get(swapEntry);
|
ComparableEntry swapTarget = swaps.get(swapEntry);
|
||||||
|
|
||||||
// Find the target for the swap in current menu entries
|
// Find the target for the swap in current menu entries
|
||||||
MenuEntry foundSwap = null;
|
MenuEntry foundSwap = null;
|
||||||
@@ -587,7 +587,7 @@ public class MenuManager
|
|||||||
option = Text.standardize(option);
|
option = Text.standardize(option);
|
||||||
target = Text.standardize(target);
|
target = Text.standardize(target);
|
||||||
|
|
||||||
AbstractMenuEntry entry = new AbstractMenuEntry(option, target);
|
ComparableEntry entry = new ComparableEntry(option, target);
|
||||||
|
|
||||||
priorityEntries.add(entry);
|
priorityEntries.add(entry);
|
||||||
}
|
}
|
||||||
@@ -597,10 +597,10 @@ public class MenuManager
|
|||||||
option = Text.standardize(option);
|
option = Text.standardize(option);
|
||||||
target = Text.standardize(target);
|
target = Text.standardize(target);
|
||||||
|
|
||||||
AbstractMenuEntry entry = new AbstractMenuEntry(option, target);
|
ComparableEntry entry = new ComparableEntry(option, target);
|
||||||
|
|
||||||
Set<AbstractMenuEntry> toRemove = new HashSet<>();
|
Set<ComparableEntry> toRemove = new HashSet<>();
|
||||||
for (AbstractMenuEntry priorityEntry : priorityEntries)
|
for (ComparableEntry priorityEntry : priorityEntries)
|
||||||
{
|
{
|
||||||
if (entry.equals(priorityEntry))
|
if (entry.equals(priorityEntry))
|
||||||
{
|
{
|
||||||
@@ -608,7 +608,7 @@ public class MenuManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AbstractMenuEntry e : toRemove)
|
for (ComparableEntry e : toRemove)
|
||||||
{
|
{
|
||||||
priorityEntries.remove(e);
|
priorityEntries.remove(e);
|
||||||
}
|
}
|
||||||
@@ -623,7 +623,7 @@ public class MenuManager
|
|||||||
{
|
{
|
||||||
option = Text.standardize(option);
|
option = Text.standardize(option);
|
||||||
|
|
||||||
AbstractMenuEntry entry = new AbstractMenuEntry(option, "", false);
|
ComparableEntry entry = new ComparableEntry(option, "", false);
|
||||||
|
|
||||||
priorityEntries.add(entry);
|
priorityEntries.add(entry);
|
||||||
}
|
}
|
||||||
@@ -632,10 +632,10 @@ public class MenuManager
|
|||||||
{
|
{
|
||||||
option = Text.standardize(option);
|
option = Text.standardize(option);
|
||||||
|
|
||||||
AbstractMenuEntry entry = new AbstractMenuEntry(option, "", false);
|
ComparableEntry entry = new ComparableEntry(option, "", false);
|
||||||
|
|
||||||
Set<AbstractMenuEntry> toRemove = new HashSet<>();
|
Set<ComparableEntry> toRemove = new HashSet<>();
|
||||||
for (AbstractMenuEntry priorityEntry : priorityEntries)
|
for (ComparableEntry priorityEntry : priorityEntries)
|
||||||
{
|
{
|
||||||
if (entry.equals(priorityEntry))
|
if (entry.equals(priorityEntry))
|
||||||
{
|
{
|
||||||
@@ -643,7 +643,7 @@ public class MenuManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AbstractMenuEntry e : toRemove)
|
for (ComparableEntry e : toRemove)
|
||||||
{
|
{
|
||||||
priorityEntries.remove(e);
|
priorityEntries.remove(e);
|
||||||
}
|
}
|
||||||
@@ -660,8 +660,8 @@ public class MenuManager
|
|||||||
option2 = Text.standardize(option2);
|
option2 = Text.standardize(option2);
|
||||||
target2 = Text.standardize(target2);
|
target2 = Text.standardize(target2);
|
||||||
|
|
||||||
AbstractMenuEntry swapFrom = new AbstractMenuEntry(option, target, -1, -1, strictOption, strictTarget);
|
ComparableEntry swapFrom = new ComparableEntry(option, target, -1, -1, strictOption, strictTarget);
|
||||||
AbstractMenuEntry swapTo = new AbstractMenuEntry(option2, target2, -1, -1, strictOption, strictTarget);
|
ComparableEntry swapTo = new ComparableEntry(option2, target2, -1, -1, strictOption, strictTarget);
|
||||||
|
|
||||||
if (swapTo.equals(swapFrom))
|
if (swapTo.equals(swapFrom))
|
||||||
{
|
{
|
||||||
@@ -681,8 +681,8 @@ public class MenuManager
|
|||||||
option2 = Text.standardize(option2);
|
option2 = Text.standardize(option2);
|
||||||
target2 = Text.standardize(target2);
|
target2 = Text.standardize(target2);
|
||||||
|
|
||||||
AbstractMenuEntry swapFrom = new AbstractMenuEntry(option, target, -1, -1, strictOption, strictTarget);
|
ComparableEntry swapFrom = new ComparableEntry(option, target, -1, -1, strictOption, strictTarget);
|
||||||
AbstractMenuEntry swapTo = new AbstractMenuEntry(option2, target2, -1, -1, strictOption, strictTarget);
|
ComparableEntry swapTo = new ComparableEntry(option2, target2, -1, -1, strictOption, strictTarget);
|
||||||
|
|
||||||
removeSwap(swapFrom, swapTo);
|
removeSwap(swapFrom, swapTo);
|
||||||
}
|
}
|
||||||
@@ -703,7 +703,7 @@ public class MenuManager
|
|||||||
/**
|
/**
|
||||||
* Adds to the map of swaps - Pre-baked Abstract entry
|
* Adds to the map of swaps - Pre-baked Abstract entry
|
||||||
*/
|
*/
|
||||||
public void addSwap(AbstractMenuEntry swapFrom, AbstractMenuEntry swapTo)
|
public void addSwap(ComparableEntry swapFrom, ComparableEntry swapTo)
|
||||||
{
|
{
|
||||||
if (swapTo.equals(swapFrom))
|
if (swapTo.equals(swapFrom))
|
||||||
{
|
{
|
||||||
@@ -726,8 +726,8 @@ public class MenuManager
|
|||||||
option2 = Text.standardize(option2);
|
option2 = Text.standardize(option2);
|
||||||
target2 = Text.standardize(target2);
|
target2 = Text.standardize(target2);
|
||||||
|
|
||||||
AbstractMenuEntry swapFrom = new AbstractMenuEntry(option, target, id, type, false, false);
|
ComparableEntry swapFrom = new ComparableEntry(option, target, id, type, false, false);
|
||||||
AbstractMenuEntry swapTo = new AbstractMenuEntry(option2, target2, id2, type2, false, false);
|
ComparableEntry swapTo = new ComparableEntry(option2, target2, id2, type2, false, false);
|
||||||
|
|
||||||
if (swapTo.equals(swapFrom))
|
if (swapTo.equals(swapFrom))
|
||||||
{
|
{
|
||||||
@@ -746,11 +746,11 @@ public class MenuManager
|
|||||||
option2 = Text.standardize(option2);
|
option2 = Text.standardize(option2);
|
||||||
target2 = Text.standardize(target2);
|
target2 = Text.standardize(target2);
|
||||||
|
|
||||||
AbstractMenuEntry swapFrom = new AbstractMenuEntry(option, target, id, type, false, false);
|
ComparableEntry swapFrom = new ComparableEntry(option, target, id, type, false, false);
|
||||||
AbstractMenuEntry swapTo = new AbstractMenuEntry(option2, target2, id2, type2, false, false);
|
ComparableEntry swapTo = new ComparableEntry(option2, target2, id2, type2, false, false);
|
||||||
|
|
||||||
Set<AbstractMenuEntry> toRemove = new HashSet<>();
|
Set<ComparableEntry> toRemove = new HashSet<>();
|
||||||
for (Map.Entry<AbstractMenuEntry, AbstractMenuEntry> e : swaps.entrySet())
|
for (Map.Entry<ComparableEntry, ComparableEntry> e : swaps.entrySet())
|
||||||
{
|
{
|
||||||
if (e.getKey().equals(swapFrom) && e.getValue().equals(swapTo))
|
if (e.getKey().equals(swapFrom) && e.getValue().equals(swapTo))
|
||||||
{
|
{
|
||||||
@@ -758,16 +758,16 @@ public class MenuManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AbstractMenuEntry entry : toRemove)
|
for (ComparableEntry entry : toRemove)
|
||||||
{
|
{
|
||||||
swaps.remove(entry);
|
swaps.remove(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeSwap(AbstractMenuEntry swapFrom, AbstractMenuEntry swapTo)
|
public void removeSwap(ComparableEntry swapFrom, ComparableEntry swapTo)
|
||||||
{
|
{
|
||||||
Set<AbstractMenuEntry> toRemove = new HashSet<>();
|
Set<ComparableEntry> toRemove = new HashSet<>();
|
||||||
for (Map.Entry<AbstractMenuEntry, AbstractMenuEntry> e : swaps.entrySet())
|
for (Map.Entry<ComparableEntry, ComparableEntry> e : swaps.entrySet())
|
||||||
{
|
{
|
||||||
if (e.getKey().equals(swapFrom) && e.getValue().equals(swapTo))
|
if (e.getKey().equals(swapFrom) && e.getValue().equals(swapTo))
|
||||||
{
|
{
|
||||||
@@ -775,7 +775,7 @@ public class MenuManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AbstractMenuEntry entry : toRemove)
|
for (ComparableEntry entry : toRemove)
|
||||||
{
|
{
|
||||||
swaps.remove(entry);
|
swaps.remove(entry);
|
||||||
}
|
}
|
||||||
@@ -788,9 +788,9 @@ public class MenuManager
|
|||||||
{
|
{
|
||||||
withTarget = Text.standardize(withTarget);
|
withTarget = Text.standardize(withTarget);
|
||||||
|
|
||||||
Set<AbstractMenuEntry> toRemove = new HashSet<>();
|
Set<ComparableEntry> toRemove = new HashSet<>();
|
||||||
|
|
||||||
for (AbstractMenuEntry e : swaps.keySet())
|
for (ComparableEntry e : swaps.keySet())
|
||||||
{
|
{
|
||||||
if (e.getTarget().equals(withTarget))
|
if (e.getTarget().equals(withTarget))
|
||||||
{
|
{
|
||||||
@@ -798,7 +798,7 @@ public class MenuManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AbstractMenuEntry entry : toRemove)
|
for (ComparableEntry entry : toRemove)
|
||||||
{
|
{
|
||||||
swaps.remove(entry);
|
swaps.remove(entry);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ import net.runelite.client.eventbus.Subscribe;
|
|||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.game.ItemVariationMapping;
|
import net.runelite.client.game.ItemVariationMapping;
|
||||||
import net.runelite.client.input.KeyManager;
|
import net.runelite.client.input.KeyManager;
|
||||||
import net.runelite.client.menus.AbstractMenuEntry;
|
import net.runelite.client.menus.ComparableEntry;
|
||||||
import net.runelite.client.menus.MenuManager;
|
import net.runelite.client.menus.MenuManager;
|
||||||
import net.runelite.client.menus.WidgetMenuOption;
|
import net.runelite.client.menus.WidgetMenuOption;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
@@ -110,7 +110,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
.omitEmptyStrings()
|
.omitEmptyStrings()
|
||||||
.trimResults();
|
.trimResults();
|
||||||
|
|
||||||
private final Map<AbstractMenuEntry, AbstractMenuEntry> customSwaps = new HashMap<>();
|
private final Map<ComparableEntry, ComparableEntry> customSwaps = new HashMap<>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
@@ -762,7 +762,7 @@ else if (config.swapOccult() != OccultAltarMode.VENERATE && option.equals("vener
|
|||||||
|
|
||||||
private void loadCustomSwaps(String config)
|
private void loadCustomSwaps(String config)
|
||||||
{
|
{
|
||||||
Map<AbstractMenuEntry, AbstractMenuEntry> tmp = new HashMap<>();
|
Map<ComparableEntry, ComparableEntry> tmp = new HashMap<>();
|
||||||
|
|
||||||
if (!Strings.isNullOrEmpty(config))
|
if (!Strings.isNullOrEmpty(config))
|
||||||
{
|
{
|
||||||
@@ -784,7 +784,7 @@ else if (config.swapOccult() != OccultAltarMode.VENERATE && option.equals("vener
|
|||||||
targetFrom = splitFrom[1].trim();
|
targetFrom = splitFrom[1].trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractMenuEntry fromEntry = new AbstractMenuEntry(optionFrom, targetFrom);
|
ComparableEntry fromEntry = new ComparableEntry(optionFrom, targetFrom);
|
||||||
|
|
||||||
String[] splitTo = Text.standardize(to).split(",");
|
String[] splitTo = Text.standardize(to).split(",");
|
||||||
String optionTo = splitTo[0].trim();
|
String optionTo = splitTo[0].trim();
|
||||||
@@ -798,26 +798,26 @@ else if (config.swapOccult() != OccultAltarMode.VENERATE && option.equals("vener
|
|||||||
targetTo = splitTo[1].trim();
|
targetTo = splitTo[1].trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractMenuEntry toEntry = new AbstractMenuEntry(optionTo, targetTo);
|
ComparableEntry toEntry = new ComparableEntry(optionTo, targetTo);
|
||||||
|
|
||||||
tmp.put(fromEntry, toEntry);
|
tmp.put(fromEntry, toEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<AbstractMenuEntry, AbstractMenuEntry> e : customSwaps.entrySet())
|
for (Map.Entry<ComparableEntry, ComparableEntry> e : customSwaps.entrySet())
|
||||||
{
|
{
|
||||||
AbstractMenuEntry key = e.getKey();
|
ComparableEntry key = e.getKey();
|
||||||
AbstractMenuEntry value = e.getValue();
|
ComparableEntry value = e.getValue();
|
||||||
menuManager.removeSwap(key, value);
|
menuManager.removeSwap(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
customSwaps.clear();
|
customSwaps.clear();
|
||||||
customSwaps.putAll(tmp);
|
customSwaps.putAll(tmp);
|
||||||
|
|
||||||
for (Map.Entry<AbstractMenuEntry, AbstractMenuEntry> entry : customSwaps.entrySet())
|
for (Map.Entry<ComparableEntry, ComparableEntry> entry : customSwaps.entrySet())
|
||||||
{
|
{
|
||||||
AbstractMenuEntry a1 = entry.getKey();
|
ComparableEntry a1 = entry.getKey();
|
||||||
AbstractMenuEntry a2 = entry.getValue();
|
ComparableEntry a2 = entry.getValue();
|
||||||
menuManager.addSwap(a1, a2);
|
menuManager.addSwap(a1, a2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user