Add report preferences to exclusive preferences.

This commit is contained in:
Keir 2015-12-05 01:05:43 +00:00
parent ef6fd0eaa3
commit 2e72e46242

View File

@ -22,11 +22,13 @@ public class ExclusivePreferencesPage extends ShopPageBase<PreferencesManager, E
private IButton _toggleHubForcefield;
private IButton _toggleHubIgnoreVelocity;
private IButton _toggleMacReports;
private IButton _toggleUserReports;
private boolean _hubInvisibilityToggled;
private boolean _hubForcefieldToggled;
private boolean _hubIgnoreVelocityToggled;
private boolean _macReportsToggled;
private boolean _userReportsToggled;
private PreferencesShop _preferencesShop;
@ -69,6 +71,15 @@ public class ExclusivePreferencesPage extends ShopPageBase<PreferencesManager, E
}
};
_toggleUserReports = new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
toggleUserReports(player);
}
};
_toggleHubIgnoreVelocity = new IButton()
{
@Override
@ -109,20 +120,22 @@ public class ExclusivePreferencesPage extends ShopPageBase<PreferencesManager, E
if (rank.has(Rank.ADMIN) || rank == Rank.JNR_DEV)
{
int[] indices = UtilUI.getIndicesFor(4, 0, 2);
int[] indices = UtilUI.getIndicesFor(5, 0, 2);
buildPreference(indices[0], Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility);
buildPreference(indices[1], Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
buildPreference(indices[2], Material.PAPER, "Mac Reports", userPreferences.ShowMacReports, _toggleMacReports);
buildPreference(indices[3], Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
buildPreference(indices[4], Material.BOOK, "User Reports", userPreferences.ShowUserReports, _toggleUserReports);
}
else if (rank.has(Rank.MODERATOR))
{
int[] indices = UtilUI.getIndicesFor(3, 0, 2);
int[] indices = UtilUI.getIndicesFor(4, 0, 2);
buildPreference(indices[0], Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility);
buildPreference(indices[1], Material.PAPER, "Mac Reports", userPreferences.ShowMacReports, _toggleMacReports);
buildPreference(indices[2], Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
buildPreference(indices[3], Material.BOOK, "User Reports", userPreferences.ShowUserReports, _toggleUserReports);
}
else if (rank == Rank.YOUTUBE || rank == Rank.TWITCH)
{
@ -167,6 +180,13 @@ public class ExclusivePreferencesPage extends ShopPageBase<PreferencesManager, E
buildPage();
}
private void toggleUserReports(org.bukkit.entity.Player player)
{
getPlugin().Get(player).ShowUserReports = !getPlugin().Get(player).ShowUserReports;
_userReportsToggled = !_userReportsToggled;
buildPage();
}
private void toggleHubIgnoreVelocity(org.bukkit.entity.Player player)
{
getPlugin().Get(player).IgnoreVelocity = !getPlugin().Get(player).IgnoreVelocity;
@ -189,6 +209,6 @@ public class ExclusivePreferencesPage extends ShopPageBase<PreferencesManager, E
public boolean preferencesChanged()
{
return _hubInvisibilityToggled || _macReportsToggled || _hubInvisibilityToggled || _hubForcefieldToggled;
return _hubInvisibilityToggled || _macReportsToggled || _hubInvisibilityToggled || _hubForcefieldToggled || _userReportsToggled;
}
}