Fix support for Towny outposts
This commit is contained in:
parent
89406aeccb
commit
0bda0d9516
1 changed files with 11 additions and 8 deletions
|
|
@ -4,6 +4,9 @@ import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FilenameFilter;
|
import java.io.FilenameFilter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.LineNumberReader;
|
||||||
|
import java.io.Reader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
@ -49,12 +52,16 @@ public class TownyConfigHandler {
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> getRegionData(String wname) {
|
public Map<String, Object> getRegionData(String wname) {
|
||||||
Map<String, Object> rslt = new HashMap<String, Object>();
|
Map<String, Object> rslt = new HashMap<String, Object>();
|
||||||
Properties p = new Properties();
|
|
||||||
FileInputStream fis = null;
|
FileInputStream fis = null;
|
||||||
/* Read world data for this world */
|
List<String> towns = new LinkedList<String>();
|
||||||
|
/* Get town list */
|
||||||
try {
|
try {
|
||||||
fis = new FileInputStream("plugins/Towny/data/worlds/" + wname + ".txt"); /* Open and load file */
|
fis = new FileInputStream("plugins/Towny/data/towns.txt"); /* Open and load file */
|
||||||
p.load(fis);
|
LineNumberReader rdr = new LineNumberReader(new InputStreamReader(fis));
|
||||||
|
String id;
|
||||||
|
while((id = rdr.readLine()) != null) {
|
||||||
|
towns.add(id);
|
||||||
|
}
|
||||||
} catch (IOException iox) {
|
} catch (IOException iox) {
|
||||||
Log.severe("Error loading Towny world file " + wname + ".txt");
|
Log.severe("Error loading Towny world file " + wname + ".txt");
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -62,9 +69,6 @@ public class TownyConfigHandler {
|
||||||
try { fis.close(); } catch (IOException iox) {}
|
try { fis.close(); } catch (IOException iox) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Get towns list for our world */
|
|
||||||
String t = p.getProperty("towns", "");
|
|
||||||
String towns[] = t.split(","); /* Split on commas */
|
|
||||||
/* List towns directory - process all towns there */
|
/* List towns directory - process all towns there */
|
||||||
for(String town : towns) {
|
for(String town : towns) {
|
||||||
town = town.trim();
|
town = town.trim();
|
||||||
|
|
@ -125,7 +129,6 @@ public class TownyConfigHandler {
|
||||||
TileFlags blks = new TileFlags();
|
TileFlags blks = new TileFlags();
|
||||||
LinkedList<int[]> nodevals = new LinkedList<int[]>();
|
LinkedList<int[]> nodevals = new LinkedList<int[]>();
|
||||||
boolean worldmatch = false;
|
boolean worldmatch = false;
|
||||||
|
|
||||||
for(String n: nodes) {
|
for(String n: nodes) {
|
||||||
/* Is world prefix? */
|
/* Is world prefix? */
|
||||||
int idx = n.indexOf(':');
|
int idx = n.indexOf(':');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue