Update support for new Residence configuration file layout
This commit is contained in:
parent
d023abc68f
commit
a0531f99ab
2 changed files with 38 additions and 2 deletions
|
|
@ -55,6 +55,25 @@ public class RegionHandler extends FileHandler {
|
||||||
else if(regiontype.equals("Factions")) {
|
else if(regiontype.equals("Factions")) {
|
||||||
regionData = factions.getRegionData(worldname);
|
regionData = factions.getRegionData(worldname);
|
||||||
}
|
}
|
||||||
|
else if(regiontype.equals("Residence")) {
|
||||||
|
File f = new File("plugins/Residence/Save/Worlds", "res_" + worldname + ".yml");
|
||||||
|
if(f.exists()) {
|
||||||
|
regionConfig = new org.bukkit.util.config.Configuration(f);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
f = new File("plugins/Residence", "res.yml");
|
||||||
|
if(f.exists()) {
|
||||||
|
regionConfig = new org.bukkit.util.config.Configuration(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(regionConfig == null) return null;
|
||||||
|
regionConfig.load();
|
||||||
|
regionData = (Map<?, ?>) regionConfig.getProperty("Residences");
|
||||||
|
if(regionData == null) {
|
||||||
|
Log.severe("Region data from " + f.getPath() + " does not include basenode 'Residences'");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
/* If using worldpath, format is either plugins/<plugin>/<worldname>/<filename> OR
|
/* If using worldpath, format is either plugins/<plugin>/<worldname>/<filename> OR
|
||||||
* plugins/<plugin>/worlds/<worldname>/<filename>
|
* plugins/<plugin>/worlds/<worldname>/<filename>
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ public class RegionsComponent extends ClientComponent {
|
||||||
{
|
{
|
||||||
File outputFile;
|
File outputFile;
|
||||||
org.bukkit.util.config.Configuration regionConfig = null;
|
org.bukkit.util.config.Configuration regionConfig = null;
|
||||||
Map<?, ?> regionData;
|
Map<?, ?> regionData = null;
|
||||||
File webWorldPath;
|
File webWorldPath;
|
||||||
|
|
||||||
if(regiontype.equals("Towny")) {
|
if(regiontype.equals("Towny")) {
|
||||||
|
|
@ -86,10 +86,27 @@ public class RegionsComponent extends ClientComponent {
|
||||||
outputFileName = "factions_" + wname + ".json";
|
outputFileName = "factions_" + wname + ".json";
|
||||||
webWorldPath = new File(plugin.getWebPath()+"/standalone/", outputFileName);
|
webWorldPath = new File(plugin.getWebPath()+"/standalone/", outputFileName);
|
||||||
}
|
}
|
||||||
|
else if(regiontype.equals("Residence")) {
|
||||||
|
File f = new File("plugins/Residence/Save/Worlds", "res_" + wname + ".yml");
|
||||||
|
if(f.exists()) {
|
||||||
|
regionConfig = new org.bukkit.util.config.Configuration(f);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
f = new File("plugins/Residence", "res.yml");
|
||||||
|
if(f.exists()) {
|
||||||
|
regionConfig = new org.bukkit.util.config.Configuration(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(regionConfig == null) return;
|
||||||
|
outputFileName = "res_" + wname + ".json";
|
||||||
|
webWorldPath = new File(plugin.getWebPath()+"/standalone/", outputFileName);
|
||||||
|
regionConfig.load();
|
||||||
|
regionData = (Map<?, ?>) regionConfig.getProperty("Residences");
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if(configuration.getBoolean("useworldpath", false))
|
if(configuration.getBoolean("useworldpath", false))
|
||||||
{
|
{
|
||||||
if(new File("plugins/"+configuration.getString("name", "WorldGuard"), regionFile).exists())
|
if(new File("plugins/"+regiontype, regionFile).exists())
|
||||||
regionConfig = new org.bukkit.util.config.Configuration(new File("plugins/"+regiontype, regionFile));
|
regionConfig = new org.bukkit.util.config.Configuration(new File("plugins/"+regiontype, regionFile));
|
||||||
else if(new File("plugins/"+regiontype+"/worlds", regionFile).exists())
|
else if(new File("plugins/"+regiontype+"/worlds", regionFile).exists())
|
||||||
regionConfig = new org.bukkit.util.config.Configuration(new File("plugins/"+regiontype+"/worlds", regionFile));
|
regionConfig = new org.bukkit.util.config.Configuration(new File("plugins/"+regiontype+"/worlds", regionFile));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue