Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public void onLoad() {
public final void onEnable() {
super.onEnable();
initializeDependencyInjection();
inventoriesConfig.get().load().onFailure(e -> Logging.severe(e.getMessage()));

Logging.setDebugLevel(mvCoreConfig.get().getGlobalDebug());
this.onMVPluginEnable();
Expand Down Expand Up @@ -206,6 +207,10 @@ public PluginServiceLocator getServiceLocator() {
@Override
public void reloadConfig() {
try {
inventoriesConfig.get().load().onFailure(e -> {
Logging.severe("Failed to load config file!");
Logging.severe(e.getMessage());
});
worldGroupManager.get().load().onFailure(e -> {
Logging.severe("Failed to load world groups!");
Logging.severe(e.getMessage());
Expand All @@ -216,7 +221,7 @@ public void reloadConfig() {
profileDataSource.get().clearAllCache();
}

Logging.fine("Loaded config file!");
Logging.fine("Reloaded all config and groups!");
} catch (Exception e) { // Catch errors loading the config file and exit out if found.
Logging.severe(this.getMessager().getMessage(Message.ERROR_CONFIG_LOAD));
Logging.severe(e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,21 @@ void onToggleCommand(
return;
}
boolean foundOpt = false;
Shares optionalShares = inventoriesConfig.getOptionalShares();
for (Sharable sharable : shares) {
if (sharable.isOptional()) {
foundOpt = true;
if (inventoriesConfig.getOptionalShares().contains(sharable)) {
inventoriesConfig.getOptionalShares().remove(sharable);
if (optionalShares.contains(sharable)) {
optionalShares.remove(sharable);
this.plugin.getMessager().normal(Message.NOW_NOT_USING_OPTIONAL, sender, sharable.getNames()[0]);
} else {
inventoriesConfig.getOptionalShares().add(sharable);
optionalShares.add(sharable);
this.plugin.getMessager().normal(Message.NOW_USING_OPTIONAL, sender, sharable.getNames()[0]);
}
}
}
if (foundOpt) {
inventoriesConfig.setOptionalShares(optionalShares);
inventoriesConfig.save();
} else {
this.plugin.getMessager().normal(Message.NO_OPTIONAL_SHARES, sender, shareName);
Expand Down
Loading