menu modifer
removed menu modifier added to menu entry swapper
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,99 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2018, https://runelitepl.us
|
|
||||||
* 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.menumodifier;
|
|
||||||
|
|
||||||
import net.runelite.client.config.Config;
|
|
||||||
import net.runelite.client.config.ConfigGroup;
|
|
||||||
import net.runelite.client.config.ConfigItem;
|
|
||||||
|
|
||||||
@ConfigGroup("menumodifier")
|
|
||||||
public interface MenuModifierConfig extends Config
|
|
||||||
{
|
|
||||||
@ConfigItem(
|
|
||||||
position = 0,
|
|
||||||
keyName = "hideExamine",
|
|
||||||
name = "Hide Examine",
|
|
||||||
description = "Hides the 'examine' option from the right click menu"
|
|
||||||
)
|
|
||||||
default boolean hideExamine()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ConfigItem(
|
|
||||||
position = 1,
|
|
||||||
keyName = "hideTradeWith",
|
|
||||||
name = "Hide Trade With",
|
|
||||||
description = "Hides the 'trade with' option from the right click menu"
|
|
||||||
)
|
|
||||||
default boolean hideTradeWith()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ConfigItem(
|
|
||||||
position = 2,
|
|
||||||
keyName = "hideReport",
|
|
||||||
name = "Hide Report",
|
|
||||||
description = "Hides the 'report' option from the right click menu"
|
|
||||||
)
|
|
||||||
default boolean hideReport()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ConfigItem(
|
|
||||||
position = 3,
|
|
||||||
keyName = "hideLookup",
|
|
||||||
name = "Hide Lookup",
|
|
||||||
description = "Hides the 'lookup' option from the right click menu"
|
|
||||||
)
|
|
||||||
default boolean hideLookup()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ConfigItem(
|
|
||||||
position = 4,
|
|
||||||
keyName = "hideNet",
|
|
||||||
name = "Hide Net",
|
|
||||||
description = "Hides the 'net' option from the right click menu"
|
|
||||||
)
|
|
||||||
default boolean hideNet()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ConfigItem(
|
|
||||||
position = 5,
|
|
||||||
keyName = "hideBait",
|
|
||||||
name = "Hide Bait",
|
|
||||||
description = "Hides the 'Bait' option from the right click menu"
|
|
||||||
)
|
|
||||||
default boolean hideBait()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2018, https://runelitepl.us
|
|
||||||
* 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.menumodifier;
|
|
||||||
|
|
||||||
import java.awt.event.KeyEvent;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import net.runelite.client.input.KeyListener;
|
|
||||||
import net.runelite.client.input.MouseAdapter;
|
|
||||||
|
|
||||||
public class MenuModifierInputListener extends MouseAdapter implements KeyListener
|
|
||||||
{
|
|
||||||
private static final int HOTKEY = KeyEvent.VK_CONTROL;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void keyTyped(KeyEvent e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private MenuModifierPlugin plugin;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void keyPressed(KeyEvent e)
|
|
||||||
{
|
|
||||||
if (e.getKeyCode() == HOTKEY)
|
|
||||||
{
|
|
||||||
plugin.setHotKeyPressed(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void keyReleased(KeyEvent e)
|
|
||||||
{
|
|
||||||
if (e.getKeyCode() == HOTKEY)
|
|
||||||
{
|
|
||||||
plugin.setHotKeyPressed(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,217 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2018, https://runelitepl.us
|
|
||||||
* 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.menumodifier;
|
|
||||||
|
|
||||||
import com.google.inject.Provides;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import lombok.AccessLevel;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import net.runelite.api.Client;
|
|
||||||
import net.runelite.api.MenuEntry;
|
|
||||||
import net.runelite.api.Player;
|
|
||||||
import net.runelite.api.events.MenuOpened;
|
|
||||||
import net.runelite.client.config.ConfigManager;
|
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
|
||||||
import net.runelite.client.input.KeyManager;
|
|
||||||
import net.runelite.client.plugins.Plugin;
|
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
|
||||||
import net.runelite.client.plugins.PluginType;
|
|
||||||
import net.runelite.client.util.MiscUtils;
|
|
||||||
import net.runelite.client.util.Text;
|
|
||||||
|
|
||||||
@PluginDescriptor(
|
|
||||||
name = "Menu Modifier",
|
|
||||||
description = "Changes right click menu for players",
|
|
||||||
tags = {"menu", "modifier", "right", "click", "pk", "bogla"},
|
|
||||||
enabledByDefault = false,
|
|
||||||
type = PluginType.UTILITY
|
|
||||||
)
|
|
||||||
public class MenuModifierPlugin extends Plugin
|
|
||||||
{
|
|
||||||
@Inject
|
|
||||||
private Client client;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private MenuModifierConfig config;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private MenuModifierInputListener inputListener;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private KeyManager keyManager;
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
MenuModifierConfig provideConfig(ConfigManager configManager)
|
|
||||||
{
|
|
||||||
return configManager.getConfig(MenuModifierConfig.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void startUp() throws Exception
|
|
||||||
{
|
|
||||||
keyManager.registerKeyListener(inputListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void shutDown() throws Exception
|
|
||||||
{
|
|
||||||
keyManager.unregisterKeyListener(inputListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Getter(AccessLevel.PACKAGE)
|
|
||||||
@Setter(AccessLevel.PACKAGE)
|
|
||||||
private boolean hotKeyPressed;
|
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void onMenuOpened(MenuOpened event)
|
|
||||||
{
|
|
||||||
Player localPlayer = client.getLocalPlayer();
|
|
||||||
|
|
||||||
if (localPlayer == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(MiscUtils.getWildernessLevelFrom(client, localPlayer.getWorldLocation()) >= 0))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hotKeyPressed)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<MenuEntry> menu_entries = new ArrayList<>();
|
|
||||||
|
|
||||||
for (MenuEntry entry : event.getMenuEntries())
|
|
||||||
{
|
|
||||||
String option = Text.removeTags(entry.getOption()).toLowerCase();
|
|
||||||
|
|
||||||
if (option.contains("trade with") && config.hideTradeWith())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (option.contains("lookup") && config.hideLookup())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (option.contains("report") && config.hideReport())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (option.contains("examine") && config.hideExamine())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (option.contains("net") && config.hideNet())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (option.contains("bait") && config.hideBait())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int identifier = entry.getIdentifier();
|
|
||||||
|
|
||||||
Player[] players = client.getCachedPlayers();
|
|
||||||
Player player = null;
|
|
||||||
|
|
||||||
if (identifier >= 0 && identifier < players.length)
|
|
||||||
{
|
|
||||||
player = players[identifier];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player == null)
|
|
||||||
{
|
|
||||||
menu_entries.add(entry);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((option.contains("attack") || option.contains("cast")) && (player.isFriend() || player.isClanMember()))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
menu_entries.add(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuEntry[] updated_menu_entries = new MenuEntry[menu_entries.size()];
|
|
||||||
updated_menu_entries = menu_entries.toArray(updated_menu_entries);
|
|
||||||
|
|
||||||
client.setMenuEntries(updated_menu_entries);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*@Subscribe
|
|
||||||
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
|
|
||||||
{
|
|
||||||
if (true)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!inWilderness)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (hotKeyPressed)
|
|
||||||
return;
|
|
||||||
|
|
||||||
String option = Text.removeTags(menuEntryAdded.getOption()).toLowerCase();
|
|
||||||
|
|
||||||
if ((option.contains("trade with") && config.hideTradeWith())
|
|
||||||
|| (option.contains("lookup") && config.hideLookup())
|
|
||||||
|| (option.contains("report") && config.hideReport())
|
|
||||||
|| (option.contains("examine") && config.hideExamine())
|
|
||||||
|| (option.contains("cancel") && config.hideCancel()))
|
|
||||||
{
|
|
||||||
int identifier = menuEntryAdded.getIdentifier();
|
|
||||||
|
|
||||||
Player[] players = client.getCachedPlayers();
|
|
||||||
Player player = null;
|
|
||||||
|
|
||||||
if (identifier >= 0 && identifier < players.length)
|
|
||||||
player = players[identifier];
|
|
||||||
|
|
||||||
if (player == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
//allow trading with friends/clanmates
|
|
||||||
if (option.contains("trade with") && (player.isFriend() || player.isClanMember()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
|
||||||
|
|
||||||
if (menuEntries.length > 0)
|
|
||||||
client.setMenuEntries(Arrays.copyOf(menuEntries, menuEntries.length - 1));
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user