world hopper: disable Hop-to pvp worlds from regular worlds

This commit is contained in:
Adam
2019-04-29 17:53:20 -04:00
parent 0258260024
commit d960518122

View File

@@ -350,11 +350,21 @@ public class WorldHopperPlugin extends Plugin
// Don't add entry if user is offline
ChatPlayer player = getChatPlayerFromName(event.getTarget());
if (player == null || player.getWorld() == 0 || player.getWorld() == client.getWorld())
if (player == null || player.getWorld() == 0 || player.getWorld() == client.getWorld()
|| worldResult == null)
{
return;
}
World currentWorld = worldResult.findWorld(client.getWorld());
World targetWorld = worldResult.findWorld(player.getWorld());
if (targetWorld == null || currentWorld == null
|| (!currentWorld.getTypes().contains(WorldType.PVP) && targetWorld.getTypes().contains(WorldType.PVP)))
{
// Disable Hop-to a PVP world from a regular world
return;
}
final MenuEntry hopTo = new MenuEntry();
hopTo.setOption(HOP_TO);
hopTo.setTarget(event.getTarget());