Skip to content

Commit

Permalink
Fix Compile error and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre601 committed May 10, 2021
1 parent 782b7d6 commit 8f84790
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions bungeecord/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/versions/16/</exclude>
</excludes>
</filter>
</filters>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package com.andre601.oneversionremake.core.files;

import com.andre601.oneversionremake.core.OneVersionRemake;
import com.andre601.oneversionremake.core.interfaces.ProxyLogger;
import org.spongepowered.configurate.ConfigurationNode;
import org.spongepowered.configurate.serialize.SerializationException;
import org.spongepowered.configurate.yaml.YamlConfigurationLoader;
Expand All @@ -34,6 +35,7 @@
public class ConfigHandler{

private final OneVersionRemake core;
private final ProxyLogger logger;

private final File config;
private final File path;
Expand All @@ -42,22 +44,28 @@ public class ConfigHandler{

public ConfigHandler(OneVersionRemake core, Path path){
this.core = core;
logger = core.getProxyLogger();

this.config = new File(path.toFile(), "config.yml");
this.path = path.toFile();
}

public boolean loadConfig(){
if(!path.isDirectory() && !path.mkdirs()){
core.getProxyLogger().warn("Could not create folder for plugin!");
logger.warn("Could not create folder for plugin!");
return false;
}

if(!config.exists()){
try(InputStream is = core.getClass().getResourceAsStream("/config.yml")){
if(is == null){
logger.warn("Unable to create config file! InputStream was null.");
return false;
}

Files.copy(is, config.toPath());
}catch(IOException ex){
core.getProxyLogger().warn("Unable to create config file!", ex);
logger.warn("Unable to create config file!", ex);
return false;
}
}
Expand All @@ -69,7 +77,7 @@ public boolean loadConfig(){
try{
node = loader.load();
}catch(IOException ex){
core.getProxyLogger().warn("There was an issue while attempting to load the config.", ex);
logger.warn("There was an issue while attempting to load the config.", ex);
return false;
}

Expand All @@ -85,7 +93,7 @@ public boolean reload(){
node = loader.load();
return true;
}catch(IOException ex){
core.getProxyLogger().warn("There was an issue while attempting to reload the config", ex);
logger.warn("There was an issue while attempting to reload the config", ex);
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<plugin.version>3.4.0</plugin.version>
<plugin.version>3.4.1</plugin.version>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
Expand Down
1 change: 1 addition & 0 deletions velocity/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/versions/16/</exclude>
</excludes>
</filter>
</filters>
Expand Down

0 comments on commit 8f84790

Please sign in to comment.