}
}
if(successfulLoad)
{
temp.setZone(new ZoneCuboid(x[0], x[1], y[0], y[1], minZ, maxZ));
}
else
{
continue;
}
}
else if(zoneShape.equals("NPoly"))
{
FastList<Integer> fl_x = new FastList<Integer>(), fl_y = new FastList<Integer>();
// Load the rest
while(rset.next())
{
fl_x.add(rset.getInt("x"));
fl_y.add(rset.getInt("y"));
}
// An nPoly needs to have at least 3 vertices
if(fl_x.size() == fl_y.size() && fl_x.size() > 2)
{
// Create arrays
int[] aX = new int[fl_x.size()];
int[] aY = new int[fl_y.size()];
// This runs only at server startup so dont complain :>
for(int i = 0; i < fl_x.size(); i++)
{
aX[i] = fl_x.get(i);
aY[i] = fl_y.get(i);
}
// Create the zone
temp.setZone(new ZoneNPoly(aX, aY, minZ, maxZ));
}
else
{
_log.warning("ZoneData: Bad sql data for zone: " + zoneId);
statement.close();
rset.close();
continue;
}
fl_x = null;
}
else
{
_log.warning("ZoneData: Unknown shape: " + zoneShape);
statement.close();
rset.close();
continue;
}
statement.close();
rset.close();
statement = null;
rset = null;
}
catch(Exception e)
{
if(Config.ENABLE_ALL_EXCEPTIONS)
e.printStackTrace();
_log.warning("ZoneData: Failed to load zone coordinates: " + e);
}
}else{ //use file one
// Create this zone. Parsing for cuboids is a
// bit different than for other polygons
// cuboids need exactly 2 points to be defined.
// Other polygons need at least 3 (one per
// vertex)
if (zoneShape.equalsIgnoreCase("Cuboid"))
{
if (coords.length == 2)
temp.setZone(new ZoneCuboid(coords[0][0], coords[1][0], coords[0][1], coords[1][1], minZ, maxZ));
else
{
_log.warning("ZoneData: Missing cuboid vertex in sql data for zone: " + zoneId);
continue;
}