sk89q/worldguard — pull request #220 by DarthAndroid (2012-08-19 21:42:36+00:00)
Title: Update PRTreeRegionManager and make it the default

The `FlatRegionManager` scales really badly with large region sets (10K+) and many players interacting with the world / chunks loaded in memory. Priority R-Trees give logarithmic runtime (as opposed to `FlatRegionManager`'s linear runtime), and significantly improve performance of WorldGuard on large servers. (We saw our server improve from spending 30% of the main thread in `getApplicableRegions()` down to < 0.1%)

There is already a partial implementation of a Priority R-Tree as a region manager (in `PRTreeRegionManager`), however from the looks of the code it was never put into practice because the library used only supported 2-dimensional rectangles and not cuboids at the time (v1.4). The latest version of the library (1.5) now properly supports n-dimensional objects.

This pull request patches the `PRTreeRegionManager` to work with version 1.5 of the library and properly support 3-dimensional bounding boxes, and then sets `PRTreeRegionManager` as the region manager used when loading worlds instead of `FlatRegionManager`.

To build these changes, you will need to install prtree.jar version 1.5 into your local repository:

1. Download prtree.jar from http://www.khelekore.org/prtree/
2. Add the artifact to maven: `mvn install:install-file -Dpackaging=jar -DgroupId=org.khelekore -DartifactId=prtree -Dfile=prtree.jar -Dversion=1.5 -DgeneratePom=true`

Presumably, once accepted this artifact would be published in the sk89q maven repository like the v1.4 artifact currently is.