@@ -36,8 +36,6 @@ import java.awt.Rectangle;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
@@ -468,9 +466,8 @@ public class ConfigPanel extends PluginPanel
|
||||
try
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -506,7 +503,7 @@ public class ConfigPanel extends PluginPanel
|
||||
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;
|
||||
|
||||
@@ -773,25 +770,22 @@ public class ConfigPanel extends PluginPanel
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
if (cid.getItem().parse())
|
||||
{
|
||||
JLabel parsingLabel = new JLabel();
|
||||
parsingLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
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();
|
||||
if (item.parse())
|
||||
{
|
||||
parseLabel(item, parsingLabel, textField.getText());
|
||||
}
|
||||
parseLabel(cid.getItem(), parsingLabel, textField.getText());
|
||||
}
|
||||
});
|
||||
textField.getDocument().addDocumentListener(listener);
|
||||
|
||||
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;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
|
||||
@@ -24,22 +24,33 @@
|
||||
|
||||
package net.runelite.client.plugins.pileindicators;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.config.Range;
|
||||
|
||||
import java.awt.*;
|
||||
import net.runelite.client.config.Stub;
|
||||
|
||||
@ConfigGroup("pileindicators")
|
||||
public interface PileIndicatorsConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "enablePlayers",
|
||||
name = "Enable Player Piling",
|
||||
description = "Enable the option to highlight players when they pile.",
|
||||
group = "1. Player Piles"
|
||||
keyName = "playerPilesStub",
|
||||
name = "Player Piles",
|
||||
description = "",
|
||||
position = 0
|
||||
)
|
||||
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()
|
||||
{
|
||||
@@ -47,11 +58,11 @@ public interface PileIndicatorsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "wildyOnlyPlayer",
|
||||
name = "Wilderness Only",
|
||||
description = "Show player piling only when in the Wilderness.",
|
||||
group = "1. Player Piles"
|
||||
position = 2,
|
||||
keyName = "wildyOnlyPlayer",
|
||||
name = "Wilderness Only",
|
||||
description = "Show player piling only when in the Wilderness.",
|
||||
parent = "playerPilesStub"
|
||||
)
|
||||
default boolean wildyOnlyPlayer()
|
||||
{
|
||||
@@ -59,11 +70,34 @@ public interface PileIndicatorsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "enableNPCS",
|
||||
name = "Enable NPC Piling",
|
||||
description = "Enable the option to highlight NPCs when they pile.",
|
||||
group = "2. NPC Piles"
|
||||
position = 3,
|
||||
keyName = "playerPileColor",
|
||||
name = "Player Pile Color",
|
||||
description = "Color used for player piles.",
|
||||
parent = "playerPilesStub"
|
||||
)
|
||||
default Color playerPileColor()
|
||||
{
|
||||
return Color.RED;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "npcPilesStub",
|
||||
name = "NPC Piles",
|
||||
description = "",
|
||||
position = 4
|
||||
)
|
||||
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()
|
||||
{
|
||||
@@ -71,23 +105,11 @@ public interface PileIndicatorsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "playerPileColor",
|
||||
name = "Player Pile Color",
|
||||
description = "Color used for player piles.",
|
||||
group = "1. Player Piles"
|
||||
)
|
||||
default Color playerPileColor()
|
||||
{
|
||||
return Color.RED;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "npcPileColor",
|
||||
name = "NPC Pile Color",
|
||||
description = "Color used for NPC piles.",
|
||||
group = "2. NPC Piles"
|
||||
position = 6,
|
||||
keyName = "npcPileColor",
|
||||
name = "NPC Pile Color",
|
||||
description = "Color used for NPC piles.",
|
||||
parent = "npcPilesStub"
|
||||
)
|
||||
default Color npcPileColor()
|
||||
{
|
||||
@@ -95,26 +117,48 @@ public interface PileIndicatorsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "mixedPileColor",
|
||||
name = "Mixed Pile Color",
|
||||
description = "Color used for mixed piles.",
|
||||
group = "3. Mixed Piles"
|
||||
keyName = "mixedPilesStub",
|
||||
name = "Mixed Piles",
|
||||
description = "",
|
||||
position = 7
|
||||
)
|
||||
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()
|
||||
{
|
||||
return new Color(255, 0, 255);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "pilesSizeStub",
|
||||
name = "Pile size",
|
||||
description = "",
|
||||
position = 9
|
||||
)
|
||||
default Stub pilesSizeStub()
|
||||
{
|
||||
return new Stub();
|
||||
}
|
||||
|
||||
@Range(
|
||||
min = 2
|
||||
min = 2
|
||||
)
|
||||
@ConfigItem(
|
||||
position = 6,
|
||||
keyName = "minimumPileSize",
|
||||
name = "Minimum Pile Size",
|
||||
description = "Any pile under this size will not show up. (Minimum: 2)",
|
||||
group = "4. Pile Size"
|
||||
position = 10,
|
||||
keyName = "minimumPileSize",
|
||||
name = "Minimum Pile Size",
|
||||
description = "Any pile under this size will not show up. (Minimum: 2)",
|
||||
parent = "pilesSizeStub"
|
||||
)
|
||||
default int minimumPileSize()
|
||||
{
|
||||
@@ -122,11 +166,22 @@ public interface PileIndicatorsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 7,
|
||||
keyName = "numberOnly",
|
||||
name = "Display Number Only",
|
||||
description = "Shorten \"PILE SIZE: 1\" to \"1\"",
|
||||
group = "5. Miscellaneous"
|
||||
keyName = "miscellaneousStub",
|
||||
name = "Miscellaneous",
|
||||
description = "",
|
||||
position = 11
|
||||
)
|
||||
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()
|
||||
{
|
||||
|
||||
@@ -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",
|
||||
keyName = "whitelistedRooms",
|
||||
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()
|
||||
{
|
||||
@@ -347,7 +350,10 @@ public interface RaidsConfig extends Config
|
||||
parent = "roomConfig",
|
||||
keyName = "blacklistedRooms",
|
||||
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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user