mirror of
https://github.com/webbukkit/dynmap.git
synced 2025-01-01 13:37:40 +01:00
Handle Factions on worlds with no faction data properly
This commit is contained in:
parent
b9170db1c1
commit
85a564aa45
@ -39,11 +39,12 @@ public class FactionsConfigHandler {
|
|||||||
* Get map of attributes for given world
|
* Get map of attributes for given world
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> getRegionData(String wname) {
|
public Map<String, Object> getRegionData(String wname) {
|
||||||
|
Map<String, Object> rslt = new HashMap<String, Object>();
|
||||||
/* Load factions.json file */
|
/* Load factions.json file */
|
||||||
File faction = new File("plugins/Factions/factions.json");
|
File faction = new File("plugins/Factions/factions.json");
|
||||||
if(faction.canRead() == false) { /* Can't read config */
|
if(faction.canRead() == false) { /* Can't read config */
|
||||||
Log.severe("Cannot find Faction file - " + faction.getPath());
|
Log.severe("Cannot find Faction file - " + faction.getPath());
|
||||||
return null;
|
return rslt;
|
||||||
}
|
}
|
||||||
JSONObject fact = null;
|
JSONObject fact = null;
|
||||||
try {
|
try {
|
||||||
@ -56,12 +57,12 @@ public class FactionsConfigHandler {
|
|||||||
Log.severe("Exception while parsing factions.json.", ex);
|
Log.severe("Exception while parsing factions.json.", ex);
|
||||||
}
|
}
|
||||||
if(fact == null)
|
if(fact == null)
|
||||||
return null;
|
return rslt;
|
||||||
/* Load board.json */
|
/* Load board.json */
|
||||||
File board = new File("plugins/Factions/board.json");
|
File board = new File("plugins/Factions/board.json");
|
||||||
if(board.canRead() == false) { /* Can't read config */
|
if(board.canRead() == false) { /* Can't read config */
|
||||||
Log.severe("Cannot find Faction file - " + board.getPath());
|
Log.severe("Cannot find Faction file - " + board.getPath());
|
||||||
return null;
|
return rslt;
|
||||||
}
|
}
|
||||||
JSONObject blocks = null;
|
JSONObject blocks = null;
|
||||||
try {
|
try {
|
||||||
@ -74,14 +75,13 @@ public class FactionsConfigHandler {
|
|||||||
Log.severe("Exception while parsing board.json.", ex);
|
Log.severe("Exception while parsing board.json.", ex);
|
||||||
}
|
}
|
||||||
if(blocks == null)
|
if(blocks == null)
|
||||||
return null;
|
return rslt;
|
||||||
/* Get value from board.json for requested world */
|
/* Get value from board.json for requested world */
|
||||||
Object wb = blocks.get(wname);
|
Object wb = blocks.get(wname);
|
||||||
if((wb == null) || (!(wb instanceof JSONObject))) {
|
if((wb == null) || (!(wb instanceof JSONObject))) {
|
||||||
return null;
|
return rslt;
|
||||||
}
|
}
|
||||||
JSONObject wblocks = (JSONObject)wb;
|
JSONObject wblocks = (JSONObject)wb;
|
||||||
Map<String, Object> rslt = new HashMap<String, Object>();
|
|
||||||
/* Now go through the factions list, and find outline */
|
/* Now go through the factions list, and find outline */
|
||||||
for(Object factid : fact.keySet()) {
|
for(Object factid : fact.keySet()) {
|
||||||
int fid = 0;
|
int fid = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user