use of xyz.derkades.ublisk.utils.settings.Setting in project Ublisk by Derkades.
the class SettingsMenu method onOptionClick.
@Override
public boolean onOptionClick(OptionClickEvent event) {
String name = event.getName();
final UPlayer player = new UPlayer(event.getPlayer());
if (name.equalsIgnoreCase("back")) {
new MainMenu(player).open();
return false;
}
Setting setting = Setting.fromName(name);
// If setting is set to true, set to false and if set to false, set to true
player.setSetting(setting, !player.getSetting(setting));
String enabledDisabled;
if (player.getSetting(setting))
enabledDisabled = "enabled";
else
enabledDisabled = "disabled";
player.sendMessage(Ublisk.getPrefix("Settings") + name + " has been " + enabledDisabled + ".");
// Re-open menu to refresh settings
this.open();
return false;
}