Worldhopper: pvp hop restriction (#1397)
* Update WorldHopperPlugin.java remove pvp hop function. annoying when clanning / singles pking and you cant right/left click hop-to. WARNING that you're hopping to a PVP world is still active to avoid luring/scamming. * Update WorldHopperPlugin.java * Update WorldHopperPlugin.java * Update WorldHopperConfig.java * Update WorldHopperPlugin.java
This commit is contained in:
@@ -114,11 +114,22 @@ public interface WorldHopperConfig extends Config
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "removePVPWorld",
|
||||||
|
name = "remove Hop-to menu option (PVP)",
|
||||||
|
description = "removes Hop-to menu option for pvp worlds",
|
||||||
|
position = 7
|
||||||
|
)
|
||||||
|
default boolean removePVPWorld()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "subscriptionFilter",
|
keyName = "subscriptionFilter",
|
||||||
name = "Show subscription types",
|
name = "Show subscription types",
|
||||||
description = "Only show free worlds, member worlds, or both types of worlds in sidebar",
|
description = "Only show free worlds, member worlds, or both types of worlds in sidebar",
|
||||||
position = 7
|
position = 8
|
||||||
)
|
)
|
||||||
default SubscriptionFilterMode subscriptionFilter()
|
default SubscriptionFilterMode subscriptionFilter()
|
||||||
{
|
{
|
||||||
@@ -129,7 +140,7 @@ public interface WorldHopperConfig extends Config
|
|||||||
keyName = "displayPing",
|
keyName = "displayPing",
|
||||||
name = "Display current ping",
|
name = "Display current ping",
|
||||||
description = "Displays ping to current game world",
|
description = "Displays ping to current game world",
|
||||||
position = 7
|
position = 9
|
||||||
)
|
)
|
||||||
default boolean displayPing()
|
default boolean displayPing()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -167,6 +167,8 @@ public class WorldHopperPlugin extends Plugin
|
|||||||
private boolean ping;
|
private boolean ping;
|
||||||
private boolean showWorldHopMessage;
|
private boolean showWorldHopMessage;
|
||||||
private SubscriptionFilterMode subscriptionFilter;
|
private SubscriptionFilterMode subscriptionFilter;
|
||||||
|
private boolean menuOption;
|
||||||
|
private boolean removePVPWorld;
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private boolean displayPing;
|
private boolean displayPing;
|
||||||
|
|
||||||
@@ -230,7 +232,7 @@ public class WorldHopperPlugin extends Plugin
|
|||||||
|
|
||||||
overlayManager.add(worldHopperOverlay);
|
overlayManager.add(worldHopperOverlay);
|
||||||
|
|
||||||
panel.setFilterMode(config.subscriptionFilter());
|
panel.setFilterMode(this.subscriptionFilter);
|
||||||
|
|
||||||
// The plugin has its own executor for pings, as it blocks for a long time
|
// The plugin has its own executor for pings, as it blocks for a long time
|
||||||
hopperExecutorService = new ExecutorServiceExceptionLogger(Executors.newSingleThreadScheduledExecutor());
|
hopperExecutorService = new ExecutorServiceExceptionLogger(Executors.newSingleThreadScheduledExecutor());
|
||||||
@@ -380,7 +382,7 @@ public class WorldHopperPlugin extends Plugin
|
|||||||
|
|
||||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||||
{
|
{
|
||||||
if (!config.menuOption())
|
if (!this.menuOption)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -416,13 +418,14 @@ public class WorldHopperPlugin extends Plugin
|
|||||||
|
|
||||||
World currentWorld = worldResult.findWorld(client.getWorld());
|
World currentWorld = worldResult.findWorld(client.getWorld());
|
||||||
World targetWorld = worldResult.findWorld(player.getWorld());
|
World targetWorld = worldResult.findWorld(player.getWorld());
|
||||||
if (targetWorld == null || currentWorld == null
|
if ((targetWorld == null || currentWorld == null)
|
||||||
|| (!currentWorld.getTypes().contains(WorldType.PVP) && targetWorld.getTypes().contains(WorldType.PVP)))
|
|| (this.removePVPWorld && !currentWorld.getTypes().contains(WorldType.PVP) && targetWorld.getTypes().contains(WorldType.PVP)))
|
||||||
{
|
{
|
||||||
// Disable Hop-to a PVP world from a regular world
|
// Disable Hop-to a PVP world from a regular world
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final MenuEntry hopTo = new MenuEntry();
|
final MenuEntry hopTo = new MenuEntry();
|
||||||
hopTo.setOption(HOP_TO);
|
hopTo.setOption(HOP_TO);
|
||||||
hopTo.setTarget(event.getTarget());
|
hopTo.setTarget(event.getTarget());
|
||||||
@@ -837,6 +840,8 @@ public class WorldHopperPlugin extends Plugin
|
|||||||
this.showWorldHopMessage = config.showWorldHopMessage();
|
this.showWorldHopMessage = config.showWorldHopMessage();
|
||||||
this.subscriptionFilter = config.subscriptionFilter();
|
this.subscriptionFilter = config.subscriptionFilter();
|
||||||
this.displayPing = config.displayPing();
|
this.displayPing = config.displayPing();
|
||||||
|
this.menuOption = config.menuOption();
|
||||||
|
this.removePVPWorld = config.removePVPWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -844,7 +849,7 @@ public class WorldHopperPlugin extends Plugin
|
|||||||
*/
|
*/
|
||||||
private void pingNextWorld()
|
private void pingNextWorld()
|
||||||
{
|
{
|
||||||
if (worldResult == null || !config.showSidebar() || !config.ping())
|
if (worldResult == null || !this.showSidebar || !this.ping)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -864,7 +869,7 @@ public class WorldHopperPlugin extends Plugin
|
|||||||
World world = worlds.get(currentWorld++);
|
World world = worlds.get(currentWorld++);
|
||||||
|
|
||||||
// If we are displaying the ping overlay, there is a separate scheduled task for the current world
|
// If we are displaying the ping overlay, there is a separate scheduled task for the current world
|
||||||
boolean displayPing = config.displayPing() && client.getGameState() == GameState.LOGGED_IN;
|
boolean displayPing = this.displayPing && client.getGameState() == GameState.LOGGED_IN;
|
||||||
if (displayPing && client.getWorld() == world.getId())
|
if (displayPing && client.getWorld() == world.getId())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -881,7 +886,7 @@ public class WorldHopperPlugin extends Plugin
|
|||||||
private void pingCurrentWorld()
|
private void pingCurrentWorld()
|
||||||
{
|
{
|
||||||
// There is no reason to ping the current world if not logged in, as the overlay doesn't draw
|
// There is no reason to ping the current world if not logged in, as the overlay doesn't draw
|
||||||
if (worldResult == null || !config.displayPing() || client.getGameState() != GameState.LOGGED_IN)
|
if (worldResult == null || !this.displayPing || client.getGameState() != GameState.LOGGED_IN)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user