Skip to content

Commit

Permalink
Update config file tri state uses
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBunnyDc committed Sep 27, 2024
1 parent 637d020 commit 7f7b144
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public interface ConfigFile {
* Create a {@link Builder}
* @since 4.0.0-dev2
*/
@NotNull
static Builder createBuilder () {
@NotNull static Builder createBuilder () {
return ConfigFileImpl.createBuilderImpl();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@

public class ConfigFileImpl implements ConfigFile {

@NotNull
public static Builder createBuilderImpl () {
@NotNull public static Builder createBuilderImpl () {
return new BuilderImpl();
}

Expand Down Expand Up @@ -88,10 +87,10 @@ private void tryToLoadFile () {
}
} catch ( IOException pException ) {
LOGGER.error(this.exceptionFactory.createException(this, "Reading the file send an error.. why?",pException));
this.broken = this.broken.turnTrue();
this.broken = TriState.TRUE;
}

this.fileLoaded = this.fileLoaded.turnTrue();
this.fileLoaded = TriState.TRUE;
}

private void tryToAdditionFile () {
Expand All @@ -110,7 +109,7 @@ private void tryToAdditionFile () {
}
} catch (IOException e) {
LOGGER.error(this.exceptionFactory.createException(this, "Reading the keys of the file seems to show an error, weird.",e));
this.broken = this.broken.turnTrue();
this.broken = TriState.TRUE;
}

if (this.broken.isTrue()) return;
Expand Down Expand Up @@ -140,7 +139,7 @@ private void tryToAdditionFile () {
}
} catch (IOException pException) {
LOGGER.error(this.exceptionFactory.createException(this, "Addition of missing keys just send a error? What.", pException));
this.broken = this.broken.turnTrue();
this.broken = TriState.TRUE;
}
}

Expand All @@ -165,7 +164,7 @@ private void createFileIfNeeded () {
}
} catch (IOException pException) {
LOGGER.error(this.exceptionFactory.createException(this, "Some error must happened when creating file! What could it be D:? ", pException));
this.broken = this.broken.turnTrue();
this.broken = TriState.TRUE;
}
}

Expand Down Expand Up @@ -279,8 +278,7 @@ public ConfigSpecGetter ( @NotNull BufferedReader pReader, Collection<ConfigSpec
}

@SuppressWarnings("unchecked")
@Nullable
public <T> ConfigSpec<T> getSpec(String pKey) {
@Nullable public <T> ConfigSpec<T> getSpec(String pKey) {
ConfigSpec<T> providerSpec = (ConfigSpec<T>) this.providerSpecs.stream().filter((spec2) -> spec2.key().equals(pKey)).findFirst().orElse(null);
if (providerSpec == null) return null;

Expand Down

0 comments on commit 7f7b144

Please sign in to comment.