Merge pull request #315 from eswick/master

Convert region ID to lowercase when saving polygon points to MySQL database.
This commit is contained in:
TomyLobo 2014-06-23 19:14:47 +02:00
commit fb5ae838d9

View File

@ -433,6 +433,12 @@ private void loadPoly2d() {
poly2dVectorResultSet.getInt("z") poly2dVectorResultSet.getInt("z")
)); ));
} }
if (points.size() < 3) {
logger.warning(String.format("Invalid polygonal region '%s': region only has %d point(s). Ignoring.", id, points.size()));
continue;
}
ProtectedRegion region = new ProtectedPolygonalRegion(id, points, minY, maxY); ProtectedRegion region = new ProtectedPolygonalRegion(id, points, minY, maxY);
region.setPriority(poly2dResultSet.getInt("priority")); region.setPriority(poly2dResultSet.getInt("priority"));
@ -932,7 +938,7 @@ private void updatePoly2dPoints(ProtectedPolygonalRegion region) throws SQLExcep
") VALUES (null, ?, " + this.worldDbId + ", ?, ?)" ") VALUES (null, ?, " + this.worldDbId + ", ?, ?)"
); );
String lowerId = region.getId(); String lowerId = region.getId().toLowerCase();
for (BlockVector2D point : region.getPoints()) { for (BlockVector2D point : region.getPoints()) {
insertPoly2dPointStatement.setString(1, lowerId); insertPoly2dPointStatement.setString(1, lowerId);
insertPoly2dPointStatement.setInt(2, point.getBlockZ()); insertPoly2dPointStatement.setInt(2, point.getBlockZ());