|
@@ -33,12 +33,12 @@ public class PlotMap {
|
|
private String name = "";
|
|
private String name = "";
|
|
|
|
|
|
public Plot(int id, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) {
|
|
public Plot(int id, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) {
|
|
- minX = Math.min(16000, Math.max(-16000, minX));
|
|
|
|
- minY = Math.min(16000, Math.max(-16000, minY));
|
|
|
|
- minZ = Math.min(16000, Math.max(-16000, minZ));
|
|
|
|
- maxX = Math.min(16000, Math.max(-16000, maxX));
|
|
|
|
- maxY = Math.min(16000, Math.max(-16000, maxY));
|
|
|
|
- maxZ = Math.min(16000, Math.max(-16000, maxZ));
|
|
|
|
|
|
+ minX = Math.min(32000, Math.max(-32000, minX));
|
|
|
|
+ minY = Math.min(32000, Math.max(-32000, minY));
|
|
|
|
+ minZ = Math.min(32000, Math.max(-32000, minZ));
|
|
|
|
+ maxX = Math.min(32000, Math.max(-32000, maxX));
|
|
|
|
+ maxY = Math.min(32000, Math.max(-32000, maxY));
|
|
|
|
+ maxZ = Math.min(32000, Math.max(-32000, maxZ));
|
|
|
|
|
|
this.id = id;
|
|
this.id = id;
|
|
if(minX < maxX) {
|
|
if(minX < maxX) {
|
|
@@ -146,8 +146,7 @@ public class PlotMap {
|
|
private ArrayList<Plot>[] plots = new ArrayList[PRIMES[primeIndex]];
|
|
private ArrayList<Plot>[] plots = new ArrayList[PRIMES[primeIndex]];
|
|
private Plot last = null;
|
|
private Plot last = null;
|
|
|
|
|
|
- public PlotMap() {
|
|
|
|
- }
|
|
|
|
|
|
+ public PlotMap() {}
|
|
|
|
|
|
private int hash(int x, int z, int arrayLength) {
|
|
private int hash(int x, int z, int arrayLength) {
|
|
int h = (x + z * 12195263) % arrayLength;
|
|
int h = (x + z * 12195263) % arrayLength;
|
|
@@ -333,7 +332,7 @@ public class PlotMap {
|
|
|
|
|
|
public void save(String path) {
|
|
public void save(String path) {
|
|
File f = new File(path);
|
|
File f = new File(path);
|
|
- try (DataOutputStream out = new DataOutputStream(new FileOutputStream(f))) {
|
|
|
|
|
|
+ try(DataOutputStream out = new DataOutputStream(new FileOutputStream(f))) {
|
|
Iterator<Plot> iter = getIterator();
|
|
Iterator<Plot> iter = getIterator();
|
|
while(iter.hasNext()) {
|
|
while(iter.hasNext()) {
|
|
Plot p = iter.next();
|
|
Plot p = iter.next();
|
|
@@ -354,7 +353,7 @@ public class PlotMap {
|
|
out.writeInt(p.flags);
|
|
out.writeInt(p.flags);
|
|
out.writeUTF(p.name);
|
|
out.writeUTF(p.name);
|
|
}
|
|
}
|
|
- } catch (IOException ex) {
|
|
|
|
|
|
+ } catch(IOException ex) {
|
|
ex.printStackTrace();
|
|
ex.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -363,7 +362,7 @@ public class PlotMap {
|
|
if(!f.exists()) {
|
|
if(!f.exists()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- try (DataInputStream in = new DataInputStream(new FileInputStream(f))) {
|
|
|
|
|
|
+ try(DataInputStream in = new DataInputStream(new FileInputStream(f))) {
|
|
while(true) {
|
|
while(true) {
|
|
int id = in.readInt();
|
|
int id = in.readInt();
|
|
int minX = in.readShort();
|
|
int minX = in.readShort();
|
|
@@ -383,8 +382,8 @@ public class PlotMap {
|
|
p.flags = in.readInt();
|
|
p.flags = in.readInt();
|
|
p.name = in.readUTF();
|
|
p.name = in.readUTF();
|
|
}
|
|
}
|
|
- } catch (EOFException ex) {
|
|
|
|
- } catch (IOException ex) {
|
|
|
|
|
|
+ } catch(EOFException ex) {
|
|
|
|
+ } catch(IOException ex) {
|
|
ex.printStackTrace();
|
|
ex.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|