forked from CodyScheer/NetherWater
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some optimalizations and code quality boosts
- Loading branch information
Showing
6 changed files
with
106 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.leetzilantonis.netherwater; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
public class ConfigManager { | ||
private final NetherWater plugin; | ||
|
||
public ConfigManager(NetherWater plugin) { | ||
this.plugin = plugin; | ||
|
||
this.loadConfig(); | ||
} | ||
|
||
private void loadConfig() { | ||
if (!this.plugin.getDataFolder().exists()) { | ||
this.plugin.getDataFolder().mkdir(); | ||
} | ||
|
||
if (!new File(this.plugin.getDataFolder(), "config.yml").exists()) { | ||
this.plugin.saveDefaultConfig(); | ||
} else { | ||
this.reloadConfig(); | ||
} | ||
} | ||
|
||
public void reloadConfig() { | ||
this.plugin.reloadConfig(); | ||
} | ||
|
||
public List<String> getDisabledWorlds() { | ||
return this.plugin.getConfig().getStringList("disabledWorlds"); | ||
} | ||
|
||
public String getMessage(String name) { | ||
return this.plugin.getConfig().getString("messages." + name); | ||
} | ||
|
||
public int getMinHeight() { | ||
return plugin.getConfig().getInt("minHeight"); | ||
} | ||
|
||
public int getMaxHeight() { | ||
return plugin.getConfig().getInt("maxHeight"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
disabledWorlds: | ||
- noWaterWorld | ||
- nether_without_water | ||
maxHeight: 999 | ||
minHeight: 0 | ||
messages: | ||
permissions: "You do not have permission to do that!" | ||
config-reload: "Nether Water configuration reloaded!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters