Skip to content

Commit

Permalink
Move GeneralConfig to common
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Aug 12, 2024
1 parent 7383d51 commit 1b9c04a
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 49 deletions.
24 changes: 24 additions & 0 deletions loader-common/src/main/java/org/cyclops/flopper/GeneralConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.cyclops.flopper;

import org.cyclops.cyclopscore.config.ConfigurablePropertyCommon;
import org.cyclops.cyclopscore.config.extendedconfig.DummyConfigCommon;
import org.cyclops.cyclopscore.helper.ModBaseCommon;

/**
* A config with general options for this mod.
* @author rubensworks
*
*/
public class GeneralConfig extends DummyConfigCommon<ModBaseCommon<?>> {

@ConfigurablePropertyCommon(category = "core", comment = "If an anonymous mod startup analytics request may be sent to our analytics service.")
public static boolean analytics = true;

@ConfigurablePropertyCommon(category = "core", comment = "If the version checker should be enabled.")
public static boolean versionChecker = true;

public GeneralConfig(ModBaseCommon<?> mod) {
super(mod, "general");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ protected CreativeModeTab.Builder constructDefaultCreativeModeTab(CreativeModeTa
protected void onConfigsRegister(ConfigHandler configHandler) {
super.onConfigsRegister(configHandler);

configHandler.addConfigurable(new GeneralConfig(this));

configHandler.addConfigurable(new BlockFlopperConfigFabric());
configHandler.addConfigurable(new BlockEntityFlopperConfigFabric());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ protected CreativeModeTab.Builder constructDefaultCreativeModeTab(CreativeModeTa
protected void onConfigsRegister(ConfigHandler configHandler) {
super.onConfigsRegister(configHandler);

configHandler.addConfigurable(new GeneralConfig(this));

configHandler.addConfigurable(new BlockFlopperConfigForge());
configHandler.addConfigurable(new BlockEntityFlopperConfigForge());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected CreativeModeTab.Builder constructDefaultCreativeModeTab(CreativeModeTa
protected void onConfigsRegister(ConfigHandler configHandler) {
super.onConfigsRegister(configHandler);

configHandler.addConfigurable(new GeneralConfig());
configHandler.addConfigurable(new GeneralConfigNeoForge());

configHandler.addConfigurable(new BlockFlopperConfigNeoForge());
configHandler.addConfigurable(new BlockEntityFlopperConfigNeoForge());
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.cyclops.flopper;

import org.cyclops.cyclopscore.init.ModBase;
import org.cyclops.cyclopscore.tracking.Analytics;
import org.cyclops.cyclopscore.tracking.Versions;

/**
* @author rubensworks
*/
public class GeneralConfigNeoForge extends GeneralConfig {
public GeneralConfigNeoForge() {
super(FlopperNeoForge._instance);
}

@Override
public void onRegistered() {
if(analytics) {
Analytics.registerMod((ModBase) getMod(), Reference.GA_TRACKING_ID);
}
if(versionChecker) {
Versions.registerMod((ModBase) getMod(), FlopperNeoForge._instance, "https://raw.githubusercontent.com/CyclopsMC/Versions/master/" + getMod().getModHelpers().getMinecraftHelpers().getMinecraftVersionMajorMinor() + "/Flopper.txt");
}
}
}

0 comments on commit 1b9c04a

Please sign in to comment.