Search in sources :

Example 1 with BooleanSetting

use of me.earth.earthhack.api.setting.settings.BooleanSetting in project 3arthh4ck by 3arthqu4ke.

the class AntiPackets method registerSettings.

private void registerSettings(Iterable<BooleanSetting> settings, AntiPacketData data) {
    for (BooleanSetting s : settings) {
        register(s);
        data.register(s.getName(), "Cancels " + s.getName() + " packets.");
    }
}
Also used : BooleanSetting(me.earth.earthhack.api.setting.settings.BooleanSetting)

Example 2 with BooleanSetting

use of me.earth.earthhack.api.setting.settings.BooleanSetting in project 3arthh4ck by 3arthqu4ke.

the class Notifications method createSettings.

private void createSettings() {
    announceMap.clear();
    Visibilities.VISIBILITY_MANAGER.registerVisibility(categories, configure::getValue);
    for (Module module : Managers.MODULES.getRegistered()) {
        Setting<Boolean> enabled = module.getSetting("Enabled", BooleanSetting.class);
        if (enabled == null) {
            continue;
        }
        enabled.addObserver(event -> {
            if (isEnabled() && !event.isCancelled() && modules.getValue() && announceMap.get(module).getValue()) {
                onToggleModule((Module) event.getSetting().getContainer(), event.getValue());
            }
        });
        String name = module.getName();
        if (this.getSetting(name) != null) {
            name = "Show" + name;
        }
        Setting<Boolean> setting = register(new BooleanSetting(name, false));
        announceMap.put(module, setting);
        Visibilities.VISIBILITY_MANAGER.registerVisibility(setting, () -> configure.getValue() && categories.getValue() == module.getCategory());
        this.getData().settingDescriptions().put(setting, "Announce Toggling of " + name + "?");
    }
}
Also used : BooleanSetting(me.earth.earthhack.api.setting.settings.BooleanSetting) Module(me.earth.earthhack.api.module.Module)

Aggregations

BooleanSetting (me.earth.earthhack.api.setting.settings.BooleanSetting)2 Module (me.earth.earthhack.api.module.Module)1