Add a default configuration name for cases where it may differ.
This commit is contained in:
parent
7ebd1fcbb2
commit
77fd748c3d
@ -40,12 +40,29 @@ public class ConfigurationFile {
|
|||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the default file in the jar.
|
||||||
|
*/
|
||||||
|
private String defaultName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name The name of this configuration file.
|
||||||
|
* @param defaultName The name of the default file in the jar.
|
||||||
|
*/
|
||||||
|
public ConfigurationFile(String name, String defaultName) {
|
||||||
|
|
||||||
|
// Set name.
|
||||||
|
this.defaultName = defaultName;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name The name of this configuration file.
|
* @param name The name of this configuration file.
|
||||||
*/
|
*/
|
||||||
public ConfigurationFile(String name) {
|
public ConfigurationFile(String name) {
|
||||||
|
|
||||||
// Set name.
|
// Set name.
|
||||||
|
this.defaultName = name;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +102,7 @@ public class ConfigurationFile {
|
|||||||
File outputFile = new File(plugin.getDataFolder(), this.name);
|
File outputFile = new File(plugin.getDataFolder(), this.name);
|
||||||
|
|
||||||
// Attempt to create an input stream of the default file in the jar.
|
// Attempt to create an input stream of the default file in the jar.
|
||||||
InputStream inputStream = plugin.getResource(this.name);
|
InputStream inputStream = plugin.getResource(this.defaultName);
|
||||||
|
|
||||||
// Check if we succeeded.
|
// Check if we succeeded.
|
||||||
if(inputStream == null) {
|
if(inputStream == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user