menuentryswapper: remove early return (#797)

This commit is contained in:
se7enAte9
2019-06-28 15:07:07 -04:00
committed by Kyleeld
parent e7af9222fb
commit 8b3a70d115

View File

@@ -907,26 +907,17 @@ public class MenuEntrySwapperPlugin extends Plugin
} }
} }
//If the option is already to walk there, or cancel we don't need to swap it with anything
if (!pOptionToReplace.equals(CANCEL) && !pOptionToReplace.equals(WALK_HERE))
{
Player[] players = client.getCachedPlayers(); Player[] players = client.getCachedPlayers();
Player player = null;
int identifier = event.getIdentifier(); int identifier = event.getIdentifier();
if (identifier >= 0 && identifier < players.length) if (identifier >= 0 && identifier < players.length)
{ {
player = players[identifier]; Player player = players[identifier];
} if (player != null)
if (player == null)
{ {
return;
}
//If the option is already to walk there, or cancel we don't need to swap it with anything
if (pOptionToReplace.equals(CANCEL) || pOptionToReplace.equals(WALK_HERE))
{
return;
}
if (((config.getRemoveFreezePlayerCoX() && client.getVar(Varbits.IN_RAID) == 1) if (((config.getRemoveFreezePlayerCoX() && client.getVar(Varbits.IN_RAID) == 1)
|| (config.getRemoveFreezePlayerToB() && client.getVar(Varbits.THEATRE_OF_BLOOD) == 2)) || (config.getRemoveFreezePlayerToB() && client.getVar(Varbits.THEATRE_OF_BLOOD) == 2))
&& (player.isFriend() || player.isClanMember()) && (player.isFriend() || player.isClanMember())
@@ -934,6 +925,9 @@ public class MenuEntrySwapperPlugin extends Plugin
{ {
addswap(pOptionToReplace); addswap(pOptionToReplace);
} }
}
}
}
if (option.equals("talk-to")) if (option.equals("talk-to"))
{ {