Skip to content

Commit

Permalink
Add profile module toggle in profiles/settings.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Travja committed Dec 21, 2023
1 parent c349cda commit ab11538
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/su/nightexpress/quantumrpg/QuantumRPG.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import mc.promcteam.engine.NexDataPlugin;
import mc.promcteam.engine.NexEngine;
import mc.promcteam.engine.commands.api.IGeneralCommand;
import mc.promcteam.engine.config.api.JYML;
import mc.promcteam.engine.hooks.Hooks;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPluginLoader;
Expand Down Expand Up @@ -93,6 +94,8 @@ public void enable() {

String coreVersion = NexEngine.getEngine().getDescription().getVersion();
boolean minCoreVersionMet = DependencyRequirement.meetsVersion(DependencyRequirement.MIN_CORE_VERSION, coreVersion);
JYML profileConfig = JYML.loadOrExtract(this, "/profiles/settings.yml");
boolean useProfiles = profileConfig.getBoolean("enabled", true);

if (this.pms.get() == null || !minCoreVersionMet) {
if (!minCoreVersionMet) {
Expand All @@ -115,8 +118,10 @@ public void enable() {
this.listenerManager = new ListenerManager(this);
this.listenerManager.setup();

this.profileManager = new ProfileManager(this);
this.profileManager.setup();
if (useProfiles) {
this.profileManager = new ProfileManager(this);
this.profileManager.setup();
}

this.moduleCache = new ModuleCache(this);
this.moduleCache.initialize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public void setup() {
this.plugin.getCommandManager().registerCommand(this.profileCommand = new ProfileCommand(this));

this.registerListeners();
this.plugin.getLogger().info("Profile Manager has been enabled");
}

@Override
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/profiles/settings.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
enabled: true

profile:
select-on-join: false
change-cooldown: 60
Expand Down

0 comments on commit ab11538

Please sign in to comment.