Skip to content

Commit

Permalink
chore: modify some logs and invert storage type check
Browse files Browse the repository at this point in the history
  • Loading branch information
aivruu authored Jan 29, 2024
1 parent 34a20c8 commit 578f3d1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions plugin/src/main/java/com/aivruu/homes/HomesPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public final class HomesPlugin extends JavaPlugin implements Homes {
public void onLoad() {
Provider.load(this);
this.logger = getComponentLogger();
this.logger.info(ComponentUtils.parse("<green>Prepare plugin internal components, loading service models."));
this.logger.info(ComponentUtils.parse("<yellow>Loading service manager."));
this.logger.info(ComponentUtils.parse("<green>Prepare plugin internal components."));
this.logger.info(ComponentUtils.parse("<yellow>Loading configuration models."));
final Path pluginFolder = this.getDataFolder().toPath();
final ValueObjectConfigResult<ConfigModel> configStatus = ValueObjectConfigManager.INSTANCE.loadConfig(pluginFolder);
final ValueObjectConfigResult<MessageConfigModel> messageStatus = ValueObjectConfigManager.INSTANCE.loadMessages(pluginFolder);
Expand All @@ -49,12 +49,14 @@ public void onLoad() {
this.repository = new PlayerModelRepository();
this.homeAggregate = new HomeAggregate(this.repository);
this.homeTeleportManager = new HomeTeleportManager(this.homeAggregate);
if (!this.config.dataFormat.equals("JSON")) {
if (this.config.dataFormat.equals("JSON")) {
this.data = new JsonModelData(this.getDataFolder(), this.config);
this.logger.info(ComponentUtils.parse("<green>JSON storage initialized."));
} else if (this.config.dataFormat.equals("MONGODB")) {
this.data = new MongoDBModelData();
this.logger.info(ComponentUtils.parse("<green>MongoDB storage initialized."));
} else {
this.logger.error(ComponentUtils.parse("<red>Unknown storage type detected in configuration. Illegal type <data-type>", Placeholder.parsed("data-type", this.config.dataFormat)));
this.logger.error(ComponentUtils.parse("<red>Unknown storage type detected in configuration. Illegal type '<data-type>'", Placeholder.parsed("data-type", this.config.dataFormat)));
this.setEnabled(false);
}
}
Expand Down

0 comments on commit 578f3d1

Please sign in to comment.