menuentryswapper: remove shift click customisation for a better alternative. (#1391)

* menuentryswapper: remove shift click customisation for a better alternative.

* menuentryswapper: add proper syntax validation, and convert to priority entries.

* menuentryswapper: Migrate old swaps to the new format

* menuentryswapper: finalize

* menuentryswapper: remove redundant splitter.

* runecraft: fix camelCase on Lavas

* runecraft: disable lavas by default
This commit is contained in:
Ganom
2019-08-18 20:11:48 -04:00
committed by GitHub
parent 3cf4491435
commit 45fd48d01d
6 changed files with 136 additions and 356 deletions

View File

@@ -352,7 +352,8 @@ public interface MenuEntrySwapperConfig extends Config
@ConfigItem(
keyName = "customSwaps",
name = "Custom Swaps",
description = "Add custom swaps here, 1 per line. Syntax: option, target : option, target<br>Note that the first entry should be the left click one!",
description = "Add custom swaps here, 1 per line. Syntax: option, target : option, target" +
"<br>Note that the first entry should be the left click one!",
position = 0,
group = "Miscellaneous",
parse = true,
@@ -365,15 +366,20 @@ public interface MenuEntrySwapperConfig extends Config
}
@ConfigItem(
keyName = "shiftClickCustomization",
name = "Customizable Shift-click",
description = "Allows customization of shift-clicks on items.",
keyName = "shiftCustomSwaps",
name = "Shift Swaps",
description = "Add custom swaps here that will only be activated when you press shift" +
"<br>, 1 per line. Syntax: option, target : option, target" +
"<br>Note that the first entry should be the left click one!",
position = 1,
group = "Miscellaneous"
group = "Miscellaneous",
parse = true,
clazz = Parse.class,
method = "parse"
)
default boolean shiftClickCustomization()
default String shiftCustomSwaps()
{
return true;
return "";
}
@ConfigItem(

View File

@@ -35,21 +35,16 @@ import com.google.common.collect.Sets;
import com.google.inject.Provides;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.InventoryID;
import net.runelite.api.Item;
import net.runelite.api.ItemDefinition;
import net.runelite.api.MenuAction;
import static net.runelite.api.MenuAction.MENU_ACTION_DEPRIORITIZE_OFFSET;
import static net.runelite.api.MenuAction.WALK;
@@ -61,26 +56,18 @@ import static net.runelite.api.Varbits.BUILDING_MODE;
import net.runelite.api.WorldType;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.MenuOpened;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.events.PostItemDefinition;
import net.runelite.api.events.VarbitChanged;
import net.runelite.api.events.WidgetMenuOptionClicked;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.ItemVariationMapping;
import net.runelite.client.input.KeyManager;
import net.runelite.client.menus.AbstractComparableEntry;
import static net.runelite.client.menus.ComparableEntries.newBankComparableEntry;
import static net.runelite.client.menus.ComparableEntries.newBaseComparableEntry;
import net.runelite.client.menus.MenuManager;
import net.runelite.client.menus.WidgetMenuOption;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDependency;
import net.runelite.client.plugins.PluginDescriptor;
@@ -124,25 +111,8 @@ import org.apache.commons.lang3.ArrayUtils;
@PluginDependency(PvpToolsPlugin.class)
public class MenuEntrySwapperPlugin extends Plugin
{
private static final String CONFIGURE = "Configure";
private static final String SAVE = "Save";
private static final String RESET = "Reset";
private static final String MENU_TARGET = "Shift-click";
private static final String CONFIG_GROUP = "shiftclick";
private static final String ITEM_KEY_PREFIX = "item_";
private static final int PURO_PURO_REGION_ID = 10307;
private static final WidgetMenuOption FIXED_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE,
MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB);
private static final WidgetMenuOption FIXED_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE,
MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB);
private static final WidgetMenuOption RESIZABLE_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE,
MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB);
private static final WidgetMenuOption RESIZABLE_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE,
MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB);
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE,
MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB);
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE,
MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB);
private static final Set<MenuAction> NPC_MENU_TYPES = ImmutableSet.of(
MenuAction.NPC_FIRST_OPTION, MenuAction.NPC_SECOND_OPTION, MenuAction.NPC_THIRD_OPTION,
MenuAction.NPC_FOURTH_OPTION, MenuAction.NPC_FIFTH_OPTION, MenuAction.EXAMINE_NPC
@@ -159,35 +129,32 @@ public class MenuEntrySwapperPlugin extends Plugin
@Inject
private MenuEntrySwapperConfig config;
@Inject
private ShiftClickInputListener inputListener;
@Inject
private ConfigManager configManager;
@Inject
private PluginManager pluginManager;
@Inject
private KeyManager keyManager;
@Inject
private MenuManager menuManager;
@Inject
private ItemManager itemManager;
private KeyManager keyManager;
@Inject
private ShiftClickInputListener inputListener;
@Inject
private EventBus eventBus;
@Inject
private PvpToolsPlugin pvpTools;
@Inject
private PvpToolsConfig pvpToolsConfig;
/**
* Migrates old custom swaps config
* This should be removed after a reasonable amount of time.
*/
@Inject
private ConfigManager configManager;
private MenuEntry[] entries;
private final Set<String> leftClickConstructionItems = new HashSet<>();
private boolean buildingMode;
private boolean inTobRaid = false;
private boolean inCoxRaid = false;
private final Map<AbstractComparableEntry, AbstractComparableEntry> customSwaps = new HashMap<>();
private final Map<AbstractComparableEntry, Integer> customSwaps = new HashMap<>();
private final Map<AbstractComparableEntry, Integer> customShiftSwaps = new HashMap<>();
private List<String> bankItemNames = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private boolean configuringShiftClick = false;
@Setter(AccessLevel.PACKAGE)
private boolean shiftModifier = false;
private ConstructionMode getConstructionMode;
private BurningAmuletMode getBurningAmuletMode;
private CharterOption charterOption;
@@ -210,6 +177,7 @@ public class MenuEntrySwapperPlugin extends Plugin
private SkillsNecklaceMode getSkillsNecklaceMode;
private SlayerRingMode getSlayerRingMode;
private String configCustomSwaps;
private String configCustomShiftSwaps;
private String getBuyFiftyItems;
private String getBuyFiveItems;
private String getBuyOneItems;
@@ -277,7 +245,6 @@ public class MenuEntrySwapperPlugin extends Plugin
private boolean hideReport;
private boolean hideTradeWith;
private boolean rockCake;
private boolean shiftClickCustomization;
private boolean swapAbyssTeleport;
private boolean swapAdmire;
private boolean swapAssignment;
@@ -322,18 +289,13 @@ public class MenuEntrySwapperPlugin extends Plugin
@Override
public void startUp()
{
migrateConfig();
updateConfig();
addSubscriptions();
addSwaps();
loadConstructionItems();
if (config.shiftClickCustomization())
{
enableCustomization();
}
loadCustomSwaps(config.customSwaps());
loadCustomSwaps(config.customSwaps(), customSwaps);
keyManager.registerKeyListener(inputListener);
if (client.getGameState() == GameState.LOGGED_IN)
{
setCastOptions(true);
@@ -345,10 +307,9 @@ public class MenuEntrySwapperPlugin extends Plugin
{
eventBus.unregister(this);
disableCustomization();
loadCustomSwaps(""); // Removes all custom swaps
loadCustomSwaps("", customSwaps); // Removes all custom swaps
removeSwaps();
keyManager.unregisterKeyListener(inputListener);
if (client.getGameState() == GameState.LOGGED_IN)
{
resetCastOptions();
@@ -358,14 +319,10 @@ public class MenuEntrySwapperPlugin extends Plugin
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(WidgetMenuOptionClicked.class, this, this::onWidgetMenuOptionClicked);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
eventBus.subscribe(MenuOpened.class, this, this::onMenuOpened);
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
eventBus.subscribe(PostItemDefinition.class, this, this::onPostItemDefinition);
eventBus.subscribe(FocusChanged.class, this, this::onFocusChanged);
}
private void onConfigChanged(ConfigChanged event)
@@ -384,26 +341,10 @@ public class MenuEntrySwapperPlugin extends Plugin
{
if (event.getKey().equals("customSwaps"))
{
loadCustomSwaps(this.configCustomSwaps);
loadCustomSwaps(this.configCustomSwaps, customSwaps);
}
}
if (event.getKey().equals("shiftClickCustomization"))
{
if (this.shiftClickCustomization)
{
enableCustomization();
}
else
{
disableCustomization();
}
}
else if (event.getKey().startsWith(ITEM_KEY_PREFIX))
{
clientThread.invoke(this::resetItemDefinitionCache);
}
else if ((event.getKey().equals("hideCastToB") || event.getKey().equals("hideCastIgnoredToB")))
{
if (this.hideCastToB)
@@ -429,62 +370,6 @@ public class MenuEntrySwapperPlugin extends Plugin
}
}
private void resetItemDefinitionCache()
{
itemManager.invalidateItemDefinitionCache();
client.getItemDefinitionCache().reset();
}
private Integer getSwapConfig(int itemId)
{
itemId = ItemVariationMapping.map(itemId);
String config = configManager.getConfiguration(CONFIG_GROUP, ITEM_KEY_PREFIX + itemId);
if (config == null || config.isEmpty())
{
return null;
}
return Integer.parseInt(config);
}
private void setSwapConfig(int itemId, int index)
{
itemId = ItemVariationMapping.map(itemId);
configManager.setConfiguration(CONFIG_GROUP, ITEM_KEY_PREFIX + itemId, index);
}
private void unsetSwapConfig(int itemId)
{
itemId = ItemVariationMapping.map(itemId);
configManager.unsetConfiguration(CONFIG_GROUP, ITEM_KEY_PREFIX + itemId);
}
private void enableCustomization()
{
keyManager.registerKeyListener(inputListener);
refreshShiftClickCustomizationMenus();
clientThread.invoke(this::resetItemDefinitionCache);
}
private void disableCustomization()
{
keyManager.unregisterKeyListener(inputListener);
removeShiftClickCustomizationMenus();
configuringShiftClick = false;
clientThread.invoke(this::resetItemDefinitionCache);
}
private void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
{
if (event.getWidget() == WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB
|| event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB
|| event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB)
{
configuringShiftClick = event.getMenuOption().equals(CONFIGURE) && Text.removeTags(event.getMenuTarget()).equals(MENU_TARGET);
refreshShiftClickCustomizationMenus();
}
}
private void onGameStateChanged(GameStateChanged event)
{
if (client.getGameState() != GameState.LOGGED_IN)
@@ -597,121 +482,7 @@ public class MenuEntrySwapperPlugin extends Plugin
MenuEntry[] updated_menu_entries = new MenuEntry[menu_entries.size()];
updated_menu_entries = menu_entries.toArray(updated_menu_entries);
client.setMenuEntries(updated_menu_entries);
if (!configuringShiftClick)
{
return;
}
MenuEntry firstEntry = event.getFirstEntry();
if (firstEntry == null)
{
return;
}
int widgetId = firstEntry.getParam1();
if (widgetId != WidgetInfo.INVENTORY.getId())
{
return;
}
int itemId = firstEntry.getIdentifier();
if (itemId == -1)
{
return;
}
ItemDefinition itemComposition = client.getItemDefinition(itemId);
String itemName = itemComposition.getName();
String option = "Use";
int shiftClickActionIndex = itemComposition.getShiftClickActionIndex();
String[] inventoryActions = itemComposition.getInventoryActions();
if (shiftClickActionIndex >= 0 && shiftClickActionIndex < inventoryActions.length)
{
option = inventoryActions[shiftClickActionIndex];
}
MenuEntry[] entries = event.getMenuEntries();
for (MenuEntry entry : entries)
{
if (itemName.equals(Text.removeTags(entry.getTarget())))
{
entry.setType(MenuAction.RUNELITE.getId());
if (option.equals(entry.getOption()))
{
entry.setOption("* " + option);
}
}
}
final MenuEntry resetShiftClickEntry = new MenuEntry();
resetShiftClickEntry.setOption(RESET);
resetShiftClickEntry.setTarget(MENU_TARGET);
resetShiftClickEntry.setIdentifier(itemId);
resetShiftClickEntry.setParam1(widgetId);
resetShiftClickEntry.setType(MenuAction.RUNELITE.getId());
client.setMenuEntries(ArrayUtils.addAll(entries, resetShiftClickEntry));
}
private void onMenuOptionClicked(MenuOptionClicked event)
{
if (event.getMenuAction() != MenuAction.RUNELITE || event.getActionParam1() != WidgetInfo.INVENTORY.getId())
{
return;
}
int itemId = event.getIdentifier();
if (itemId == -1)
{
return;
}
String option = event.getOption();
String target = event.getTarget();
ItemDefinition itemComposition = client.getItemDefinition(itemId);
if (option.equals(RESET) && target.equals(MENU_TARGET))
{
unsetSwapConfig(itemId);
return;
}
if (!itemComposition.getName().equals(Text.removeTags(target)))
{
return;
}
int index = -1;
boolean valid = false;
if (option.equals("Use")) //because "Use" is not in inventoryActions
{
valid = true;
}
else
{
String[] inventoryActions = itemComposition.getInventoryActions();
for (index = 0; index < inventoryActions.length; index++)
{
if (option.equals(inventoryActions[index]))
{
valid = true;
break;
}
}
}
if (valid)
{
setSwapConfig(itemId, index);
}
}
public void onMenuEntryAdded(MenuEntryAdded event)
@@ -867,71 +638,15 @@ public class MenuEntrySwapperPlugin extends Plugin
break;
}
}
if (this.shiftClickCustomization && shiftModifier && !option.equals("use"))
{
final Integer customOption = getSwapConfig(eventId);
if (customOption != null && customOption == -1)
{
swap(client, "use", option, target, true);
}
}
}
private void onPostItemDefinition(PostItemDefinition event)
private void loadCustomSwaps(String config, Map<AbstractComparableEntry, Integer> map)
{
ItemDefinition itemComposition = event.getItemDefinition();
Integer option = getSwapConfig(itemComposition.getId());
if (option != null)
{
itemComposition.setShiftClickActionIndex(option);
}
}
private void onFocusChanged(FocusChanged event)
{
if (!event.isFocused())
{
shiftModifier = false;
}
}
private void removeShiftClickCustomizationMenus()
{
menuManager.removeManagedCustomMenu(FIXED_INVENTORY_TAB_CONFIGURE);
menuManager.removeManagedCustomMenu(FIXED_INVENTORY_TAB_SAVE);
menuManager.removeManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_CONFIGURE);
menuManager.removeManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE);
menuManager.removeManagedCustomMenu(RESIZABLE_INVENTORY_TAB_CONFIGURE);
menuManager.removeManagedCustomMenu(RESIZABLE_INVENTORY_TAB_SAVE);
}
private void refreshShiftClickCustomizationMenus()
{
removeShiftClickCustomizationMenus();
if (configuringShiftClick)
{
menuManager.addManagedCustomMenu(FIXED_INVENTORY_TAB_SAVE);
menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE);
menuManager.addManagedCustomMenu(RESIZABLE_INVENTORY_TAB_SAVE);
}
else
{
menuManager.addManagedCustomMenu(FIXED_INVENTORY_TAB_CONFIGURE);
menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_CONFIGURE);
menuManager.addManagedCustomMenu(RESIZABLE_INVENTORY_TAB_CONFIGURE);
}
}
private void loadCustomSwaps(String config)
{
Map<AbstractComparableEntry, AbstractComparableEntry> tmp = new HashMap<>();
final Map<AbstractComparableEntry, Integer> tmp = new HashMap<>();
if (!Strings.isNullOrEmpty(config))
{
StringBuilder sb = new StringBuilder();
final StringBuilder sb = new StringBuilder();
for (String str : config.split("\n"))
{
@@ -941,15 +656,23 @@ public class MenuEntrySwapperPlugin extends Plugin
}
}
Map<String, String> split = NEWLINE_SPLITTER.withKeyValueSeparator(':').split(sb);
final Map<String, String> split = NEWLINE_SPLITTER.withKeyValueSeparator(':').split(sb);
for (Map.Entry<String, String> entry : split.entrySet())
{
String from = entry.getKey();
String to = entry.getValue();
String[] splitFrom = Text.standardize(from).split(",");
String optionFrom = splitFrom[0].trim();
String targetFrom;
final String prio = entry.getKey();
int priority;
try
{
priority = Integer.parseInt(entry.getValue().trim());
}
catch (NumberFormatException e)
{
priority = 0;
}
final String[] splitFrom = Text.standardize(prio).split(",");
final String optionFrom = splitFrom[0].trim();
final String targetFrom;
if (splitFrom.length == 1)
{
targetFrom = "";
@@ -959,41 +682,26 @@ public class MenuEntrySwapperPlugin extends Plugin
targetFrom = splitFrom[1].trim();
}
AbstractComparableEntry fromEntry = newBaseComparableEntry(optionFrom, targetFrom);
final AbstractComparableEntry prioEntry = newBaseComparableEntry(optionFrom, targetFrom);
String[] splitTo = Text.standardize(to).split(",");
String optionTo = splitTo[0].trim();
String targetTo;
if (splitTo.length == 1)
{
targetTo = "";
}
else
{
targetTo = splitTo[1].trim();
}
AbstractComparableEntry toEntry = newBaseComparableEntry(optionTo, targetTo);
tmp.put(fromEntry, toEntry);
tmp.put(prioEntry, priority);
}
}
for (Map.Entry<AbstractComparableEntry, AbstractComparableEntry> e : customSwaps.entrySet())
for (Map.Entry<AbstractComparableEntry, Integer> e : map.entrySet())
{
AbstractComparableEntry key = e.getKey();
AbstractComparableEntry value = e.getValue();
menuManager.removeSwap(key, value);
final AbstractComparableEntry key = e.getKey();
menuManager.removePriorityEntry(key);
}
customSwaps.clear();
customSwaps.putAll(tmp);
map.clear();
map.putAll(tmp);
for (Map.Entry<AbstractComparableEntry, AbstractComparableEntry> entry : customSwaps.entrySet())
for (Map.Entry<AbstractComparableEntry, Integer> entry : map.entrySet())
{
AbstractComparableEntry a1 = entry.getKey();
AbstractComparableEntry a2 = entry.getValue();
menuManager.addSwap(a1, a2);
int a2 = entry.getValue();
menuManager.addPriorityEntry(a1).setPriority(a2);
}
}
@@ -1707,6 +1415,8 @@ public class MenuEntrySwapperPlugin extends Plugin
void startShift()
{
loadCustomSwaps(this.configCustomShiftSwaps, customShiftSwaps);
if (!this.swapClimbUpDown)
{
return;
@@ -1718,6 +1428,7 @@ public class MenuEntrySwapperPlugin extends Plugin
void stopShift()
{
menuManager.removePriorityEntry("climb-up");
loadCustomSwaps("", customShiftSwaps);
}
void startControl()
@@ -1813,7 +1524,7 @@ public class MenuEntrySwapperPlugin extends Plugin
this.swapQuestCape = config.swapQuestCape();
this.questCapeMode = config.questCapeMode();
this.configCustomSwaps = config.customSwaps();
this.shiftClickCustomization = config.shiftClickCustomization();
this.configCustomShiftSwaps = config.shiftCustomSwaps();
this.swapCoalBag = config.swapCoalBag();
this.swapBirdhouseEmpty = config.swapBirdhouseEmpty();
this.swapBones = config.swapBones();
@@ -1915,4 +1626,64 @@ public class MenuEntrySwapperPlugin extends Plugin
this.hideCastCoX = config.hideCastCoX();
this.hideCastIgnoredCoX = Sets.newHashSet(Text.fromCSV(config.hideCastIgnoredCoX().toLowerCase()));
}
/**
* Migrates old custom swaps config
* This should be removed after a reasonable amount of time.
*/
private static boolean oldParse(String value)
{
try
{
final StringBuilder sb = new StringBuilder();
for (String str : value.split("\n"))
{
if (!str.startsWith("//"))
{
sb.append(str).append("\n");
}
}
NEWLINE_SPLITTER.withKeyValueSeparator(':').split(sb);
return true;
}
catch (IllegalArgumentException ex)
{
return false;
}
}
/**
* Migrates old custom swaps config
* This should be removed after a reasonable amount of time.
*/
private void migrateConfig()
{
final String customSwaps = config.customSwaps();
if (!Parse.parse(customSwaps) && oldParse(customSwaps))
{
final StringBuilder sb = new StringBuilder();
for (String str : customSwaps.split("\n"))
{
if (!str.startsWith("//"))
{
sb.append(str).append("\n");
}
}
final Map<String, String> split = NEWLINE_SPLITTER.withKeyValueSeparator(':').split(sb);
sb.setLength(0);
for (Map.Entry<String, String> entry : split.entrySet())
{
sb.append(entry.getValue()).append(":0\n");
}
configManager.setConfiguration("menuentryswapper", "customSwaps", sb.toString());
}
}
}

View File

@@ -25,6 +25,7 @@
package net.runelite.client.plugins.menuentryswapper;
import com.google.common.base.Splitter;
import java.util.Map;
public class Parse
{
@@ -32,7 +33,7 @@ public class Parse
{
try
{
StringBuilder sb = new StringBuilder();
final StringBuilder sb = new StringBuilder();
for (String str : value.split("\n"))
{
@@ -42,15 +43,20 @@ public class Parse
}
}
Splitter NEWLINE_SPLITTER = Splitter
final Splitter NEWLINE_SPLITTER = Splitter
.on("\n")
.omitEmptyStrings()
.trimResults();
NEWLINE_SPLITTER.withKeyValueSeparator(':').split(sb);
final Map<String, String> tmp = NEWLINE_SPLITTER.withKeyValueSeparator(':').split(sb);
for (String str : tmp.values())
{
Integer.parseInt(str.trim());
}
return true;
}
catch (IllegalArgumentException ex)
catch (Exception ex)
{
return false;
}

View File

@@ -38,7 +38,6 @@ class ShiftClickInputListener implements KeyListener
@Override
public void keyTyped(KeyEvent event)
{
}
@Override
@@ -46,7 +45,6 @@ class ShiftClickInputListener implements KeyListener
{
if (event.getKeyCode() == KeyEvent.VK_SHIFT)
{
plugin.setShiftModifier(true);
plugin.startShift();
}
if (event.getKeyCode() == KeyEvent.VK_CONTROL)
@@ -60,7 +58,6 @@ class ShiftClickInputListener implements KeyListener
{
if (event.getKeyCode() == KeyEvent.VK_SHIFT)
{
plugin.setShiftModifier(false);
plugin.stopShift();
}
if (event.getKeyCode() == KeyEvent.VK_CONTROL)

View File

@@ -45,7 +45,7 @@ public interface RunecraftConfig extends Config
}
@ConfigItem(
keyName = "Lavas",
keyName = "lavas",
name = "Lavas",
description = "Swaps Ring of dueling menu entry depending on location, requires fire tiara or RC cape to be worn.",
parent = "utilStub",
@@ -53,9 +53,9 @@ public interface RunecraftConfig extends Config
"<br>Expect bugs if you use them together.</html></center>",
position = 2
)
default boolean Lavas()
default boolean lavas()
{
return true;
return false;
}
@ConfigItem(

View File

@@ -319,7 +319,7 @@ public class RunecraftPlugin extends Plugin
private void updateConfig()
{
this.lavas = config.Lavas();
this.lavas = config.lavas();
this.essPouch = config.essPouch();
this.hightlightDarkMage = config.hightlightDarkMage();
this.degradingNotification = config.degradingNotification();