@@ -36,8 +36,6 @@ import java.awt.Rectangle;
|
|||||||
import java.awt.event.FocusAdapter;
|
import java.awt.event.FocusAdapter;
|
||||||
import java.awt.event.FocusEvent;
|
import java.awt.event.FocusEvent;
|
||||||
import java.awt.event.ItemEvent;
|
import java.awt.event.ItemEvent;
|
||||||
import java.awt.event.KeyAdapter;
|
|
||||||
import java.awt.event.KeyEvent;
|
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
@@ -468,9 +466,8 @@ public class ConfigPanel extends PluginPanel
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Method parse = item.clazz().getMethod(item.method(), String.class);
|
Method parse = item.clazz().getMethod(item.method(), String.class);
|
||||||
boolean result = (boolean) parse.invoke(null, value);
|
|
||||||
|
|
||||||
return result;
|
return (boolean) parse.invoke(null, value);
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex)
|
catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex)
|
||||||
{
|
{
|
||||||
@@ -506,7 +503,7 @@ public class ConfigPanel extends PluginPanel
|
|||||||
openGroupConfigPanel(listItem, config, cd, false);
|
openGroupConfigPanel(listItem, config, cd, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void openGroupConfigPanel(PluginListItem listItem, Config config, ConfigDescriptor cd, boolean refresh)
|
private void openGroupConfigPanel(PluginListItem listItem, Config config, ConfigDescriptor cd, boolean refresh)
|
||||||
{
|
{
|
||||||
showingPluginList = false;
|
showingPluginList = false;
|
||||||
|
|
||||||
@@ -774,24 +771,21 @@ public class ConfigPanel extends PluginPanel
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (cid.getItem().parse())
|
if (cid.getItem().parse())
|
||||||
{
|
{
|
||||||
JLabel parsingLabel = new JLabel();
|
JLabel parsingLabel = new JLabel();
|
||||||
parsingLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
parsingLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
parsingLabel.setPreferredSize(new Dimension(PANEL_WIDTH, 15));
|
parsingLabel.setPreferredSize(new Dimension(PANEL_WIDTH, 15));
|
||||||
|
|
||||||
textField.addKeyListener(new KeyAdapter()
|
DeferredDocumentChangedListener listener = new DeferredDocumentChangedListener();
|
||||||
|
listener.addChangeListener(e ->
|
||||||
{
|
{
|
||||||
public void keyReleased(KeyEvent e)
|
if (cid.getItem().parse())
|
||||||
{
|
{
|
||||||
ConfigItem item = cid.getItem();
|
parseLabel(cid.getItem(), parsingLabel, textField.getText());
|
||||||
if (item.parse())
|
|
||||||
{
|
|
||||||
parseLabel(item, parsingLabel, textField.getText());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
textField.getDocument().addDocumentListener(listener);
|
||||||
|
|
||||||
item.add(textField, BorderLayout.CENTER);
|
item.add(textField, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package net.runelite.client.plugins.config;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.swing.Timer;
|
||||||
|
import javax.swing.event.ChangeEvent;
|
||||||
|
import javax.swing.event.ChangeListener;
|
||||||
|
import javax.swing.event.DocumentEvent;
|
||||||
|
import javax.swing.event.DocumentListener;
|
||||||
|
|
||||||
|
class DeferredDocumentChangedListener implements DocumentListener
|
||||||
|
{
|
||||||
|
private Timer timer;
|
||||||
|
private List<ChangeListener> listeners;
|
||||||
|
|
||||||
|
DeferredDocumentChangedListener()
|
||||||
|
{
|
||||||
|
listeners = new ArrayList<>(25);
|
||||||
|
timer = new Timer(350, e -> fireStateChanged());
|
||||||
|
timer.setRepeats(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void addChangeListener(ChangeListener listener)
|
||||||
|
{
|
||||||
|
listeners.add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fireStateChanged()
|
||||||
|
{
|
||||||
|
if (!listeners.isEmpty())
|
||||||
|
{
|
||||||
|
ChangeEvent evt = new ChangeEvent(this);
|
||||||
|
for (ChangeListener listener : listeners)
|
||||||
|
{
|
||||||
|
listener.stateChanged(evt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertUpdate(DocumentEvent e)
|
||||||
|
{
|
||||||
|
timer.restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeUpdate(DocumentEvent e)
|
||||||
|
{
|
||||||
|
timer.restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changedUpdate(DocumentEvent e)
|
||||||
|
{
|
||||||
|
timer.restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,3 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019, Owain van Brakel <https://github.com/Owain94>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
package net.runelite.client.plugins.menuentryswapper;
|
package net.runelite.client.plugins.menuentryswapper;
|
||||||
|
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
|
|||||||
@@ -24,22 +24,33 @@
|
|||||||
|
|
||||||
package net.runelite.client.plugins.pileindicators;
|
package net.runelite.client.plugins.pileindicators;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
import net.runelite.client.config.Config;
|
import net.runelite.client.config.Config;
|
||||||
import net.runelite.client.config.ConfigGroup;
|
import net.runelite.client.config.ConfigGroup;
|
||||||
import net.runelite.client.config.ConfigItem;
|
import net.runelite.client.config.ConfigItem;
|
||||||
import net.runelite.client.config.Range;
|
import net.runelite.client.config.Range;
|
||||||
|
import net.runelite.client.config.Stub;
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
@ConfigGroup("pileindicators")
|
@ConfigGroup("pileindicators")
|
||||||
public interface PileIndicatorsConfig extends Config
|
public interface PileIndicatorsConfig extends Config
|
||||||
{
|
{
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 0,
|
keyName = "playerPilesStub",
|
||||||
keyName = "enablePlayers",
|
name = "Player Piles",
|
||||||
name = "Enable Player Piling",
|
description = "",
|
||||||
description = "Enable the option to highlight players when they pile.",
|
position = 0
|
||||||
group = "1. Player Piles"
|
)
|
||||||
|
default Stub playerPilesStub()
|
||||||
|
{
|
||||||
|
return new Stub();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 1,
|
||||||
|
keyName = "enablePlayers",
|
||||||
|
name = "Enable Player Piling",
|
||||||
|
description = "Enable the option to highlight players when they pile.",
|
||||||
|
parent = "playerPilesStub"
|
||||||
)
|
)
|
||||||
default boolean enablePlayers()
|
default boolean enablePlayers()
|
||||||
{
|
{
|
||||||
@@ -47,11 +58,11 @@ public interface PileIndicatorsConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 1,
|
position = 2,
|
||||||
keyName = "wildyOnlyPlayer",
|
keyName = "wildyOnlyPlayer",
|
||||||
name = "Wilderness Only",
|
name = "Wilderness Only",
|
||||||
description = "Show player piling only when in the Wilderness.",
|
description = "Show player piling only when in the Wilderness.",
|
||||||
group = "1. Player Piles"
|
parent = "playerPilesStub"
|
||||||
)
|
)
|
||||||
default boolean wildyOnlyPlayer()
|
default boolean wildyOnlyPlayer()
|
||||||
{
|
{
|
||||||
@@ -59,23 +70,11 @@ public interface PileIndicatorsConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 3,
|
position = 3,
|
||||||
keyName = "enableNPCS",
|
keyName = "playerPileColor",
|
||||||
name = "Enable NPC Piling",
|
name = "Player Pile Color",
|
||||||
description = "Enable the option to highlight NPCs when they pile.",
|
description = "Color used for player piles.",
|
||||||
group = "2. NPC Piles"
|
parent = "playerPilesStub"
|
||||||
)
|
|
||||||
default boolean enableNPCS()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ConfigItem(
|
|
||||||
position = 2,
|
|
||||||
keyName = "playerPileColor",
|
|
||||||
name = "Player Pile Color",
|
|
||||||
description = "Color used for player piles.",
|
|
||||||
group = "1. Player Piles"
|
|
||||||
)
|
)
|
||||||
default Color playerPileColor()
|
default Color playerPileColor()
|
||||||
{
|
{
|
||||||
@@ -83,11 +82,34 @@ public interface PileIndicatorsConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 4,
|
keyName = "npcPilesStub",
|
||||||
keyName = "npcPileColor",
|
name = "NPC Piles",
|
||||||
name = "NPC Pile Color",
|
description = "",
|
||||||
description = "Color used for NPC piles.",
|
position = 4
|
||||||
group = "2. NPC Piles"
|
)
|
||||||
|
default Stub npcPilesStub()
|
||||||
|
{
|
||||||
|
return new Stub();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 5,
|
||||||
|
keyName = "enableNPCS",
|
||||||
|
name = "Enable NPC Piling",
|
||||||
|
description = "Enable the option to highlight NPCs when they pile.",
|
||||||
|
parent = "npcPilesStub"
|
||||||
|
)
|
||||||
|
default boolean enableNPCS()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 6,
|
||||||
|
keyName = "npcPileColor",
|
||||||
|
name = "NPC Pile Color",
|
||||||
|
description = "Color used for NPC piles.",
|
||||||
|
parent = "npcPilesStub"
|
||||||
)
|
)
|
||||||
default Color npcPileColor()
|
default Color npcPileColor()
|
||||||
{
|
{
|
||||||
@@ -95,26 +117,48 @@ public interface PileIndicatorsConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 5,
|
keyName = "mixedPilesStub",
|
||||||
keyName = "mixedPileColor",
|
name = "Mixed Piles",
|
||||||
name = "Mixed Pile Color",
|
description = "",
|
||||||
description = "Color used for mixed piles.",
|
position = 7
|
||||||
group = "3. Mixed Piles"
|
)
|
||||||
|
default Stub mixedPilesStub()
|
||||||
|
{
|
||||||
|
return new Stub();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 8,
|
||||||
|
keyName = "mixedPileColor",
|
||||||
|
name = "Mixed Pile Color",
|
||||||
|
description = "Color used for mixed piles.",
|
||||||
|
parent = "mixedPilesStub"
|
||||||
)
|
)
|
||||||
default Color mixedPileColor()
|
default Color mixedPileColor()
|
||||||
{
|
{
|
||||||
return new Color(255, 0, 255);
|
return new Color(255, 0, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "pilesSizeStub",
|
||||||
|
name = "Pile size",
|
||||||
|
description = "",
|
||||||
|
position = 9
|
||||||
|
)
|
||||||
|
default Stub pilesSizeStub()
|
||||||
|
{
|
||||||
|
return new Stub();
|
||||||
|
}
|
||||||
|
|
||||||
@Range(
|
@Range(
|
||||||
min = 2
|
min = 2
|
||||||
)
|
)
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 6,
|
position = 10,
|
||||||
keyName = "minimumPileSize",
|
keyName = "minimumPileSize",
|
||||||
name = "Minimum Pile Size",
|
name = "Minimum Pile Size",
|
||||||
description = "Any pile under this size will not show up. (Minimum: 2)",
|
description = "Any pile under this size will not show up. (Minimum: 2)",
|
||||||
group = "4. Pile Size"
|
parent = "pilesSizeStub"
|
||||||
)
|
)
|
||||||
default int minimumPileSize()
|
default int minimumPileSize()
|
||||||
{
|
{
|
||||||
@@ -122,11 +166,22 @@ public interface PileIndicatorsConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 7,
|
keyName = "miscellaneousStub",
|
||||||
keyName = "numberOnly",
|
name = "Miscellaneous",
|
||||||
name = "Display Number Only",
|
description = "",
|
||||||
description = "Shorten \"PILE SIZE: 1\" to \"1\"",
|
position = 11
|
||||||
group = "5. Miscellaneous"
|
)
|
||||||
|
default Stub miscellaneousStub()
|
||||||
|
{
|
||||||
|
return new Stub();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 12,
|
||||||
|
keyName = "numberOnly",
|
||||||
|
name = "Display Number Only",
|
||||||
|
description = "Shorten \"PILE SIZE: 1\" to \"1\"",
|
||||||
|
parent = "miscellaneousStub"
|
||||||
)
|
)
|
||||||
default boolean numberOnly()
|
default boolean numberOnly()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019, Owain van Brakel <https://github.com/Owain94>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.client.plugins.raids;
|
||||||
|
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class Parse
|
||||||
|
{
|
||||||
|
public static boolean parse(String value)
|
||||||
|
{
|
||||||
|
final ArrayList<String> rooms = new ArrayList<>();
|
||||||
|
Collections.addAll(rooms, "tekton", "muttadiles", "guardians", "vespula", "shamans", "vasa", "vanguards", "mystics", "crabs", "ice demon", "tightrope", "thieving", "unknown");
|
||||||
|
|
||||||
|
List<String> enteredRooms = Splitter
|
||||||
|
.on(",")
|
||||||
|
.trimResults()
|
||||||
|
.omitEmptyStrings()
|
||||||
|
.splitToList(value);
|
||||||
|
|
||||||
|
for (String room : enteredRooms)
|
||||||
|
{
|
||||||
|
if (!rooms.contains(room.toLowerCase()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -335,7 +335,10 @@ public interface RaidsConfig extends Config
|
|||||||
parent = "roomConfig",
|
parent = "roomConfig",
|
||||||
keyName = "whitelistedRooms",
|
keyName = "whitelistedRooms",
|
||||||
name = "Whitelisted rooms",
|
name = "Whitelisted rooms",
|
||||||
description = "Display whitelisted rooms in green on the overlay. Separate with comma (full name)"
|
description = "Display whitelisted rooms in green on the overlay. Separate with comma (full name)",
|
||||||
|
parse = true,
|
||||||
|
clazz = Parse.class,
|
||||||
|
method = "parse"
|
||||||
)
|
)
|
||||||
default String whitelistedRooms()
|
default String whitelistedRooms()
|
||||||
{
|
{
|
||||||
@@ -347,7 +350,10 @@ public interface RaidsConfig extends Config
|
|||||||
parent = "roomConfig",
|
parent = "roomConfig",
|
||||||
keyName = "blacklistedRooms",
|
keyName = "blacklistedRooms",
|
||||||
name = "Blacklisted rooms",
|
name = "Blacklisted rooms",
|
||||||
description = "Display blacklisted rooms in red on the overlay. Separate with comma (full name)"
|
description = "Display blacklisted rooms in red on the overlay. Separate with comma (full name)",
|
||||||
|
parse = true,
|
||||||
|
clazz = Parse.class,
|
||||||
|
method = "parse"
|
||||||
)
|
)
|
||||||
default String blacklistedRooms()
|
default String blacklistedRooms()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user