Fix staff members getting stuck in both Incognito mode and the Hub Invisibility preference, and not being able to toggle either off them off because Incognito would stop Hub Invisibility from getting toggled (on OR off), and vice versa.

This commit is contained in:
Ben 2016-05-01 10:16:20 +01:00 committed by cnr
parent 6042be2d2f
commit 6760c07e6c
2 changed files with 4 additions and 4 deletions

View File

@ -18,7 +18,7 @@ public class IncognitoToggleCommand extends CommandBase<IncognitoManager>
@Override
public void Execute(Player caller, String[] args)
{
if (Plugin.getPreferences().Get(caller).Invisibility)
if (Plugin.getPreferences().Get(caller).Invisibility && /* Hub Invis & Incognito stuck prevention */ !Plugin.Get(caller).Status)
{
UtilPlayer.message(caller, F.main("Incognito", "You are not allowed to toggle incognito on while Hub Invisibility is enabled."));
return;
@ -26,11 +26,11 @@ public class IncognitoToggleCommand extends CommandBase<IncognitoManager>
if (Plugin.toggle(caller))
{
UtilPlayer.message(caller, F.main("Incognito", "You are now incognito. Your status will only change when you run " + F.elem(AliasUsed) + " again."));
UtilPlayer.message(caller, F.main("Incognito", "You are now incognito. Your status will only change when you run " + F.elem("/" + AliasUsed) + " again."));
}
else
{
UtilPlayer.message(caller, F.main("Incognito", "You are no longer incognito. Your status will only change when you run " + F.elem(AliasUsed) + " again."));
UtilPlayer.message(caller, F.main("Incognito", "You are no longer incognito. Your status will only change when you run " + F.elem("/" + AliasUsed) + " again."));
}
}
}

View File

@ -164,7 +164,7 @@ public class ExclusivePreferencesPage extends ShopPageBase<PreferencesManager, E
private void toggleHubInvisibility(org.bukkit.entity.Player player)
{
if (getPlugin().getIncognitoManager() != null && getPlugin().getIncognitoManager().Get(player).Status)
if (getPlugin().getIncognitoManager() != null && getPlugin().getIncognitoManager().Get(player).Status && /* Hub Invis & Incognito stuck prevention */ !getPlugin().Get(player).Invisibility)
{
UtilPlayer.message(player, F.main("Incognito", "You are not allowed to use Hub Visibility whilst in incognito mode."));
return;