dynmap/web/js/regions.js
Jason Booth 8e59f37995 Initial Support for Regions system on dynmap
Included Worldguard support(default)
Also residence support(incomplete)
2011-04-13 19:58:25 -05:00

36 lines
966 B
JavaScript

// Author: nidefawl. contact me at bukkit.org or irc.esper.net #nide
var regionCfg;
var regionPolygons = {} ;
var regionInfoWindow = new google.maps.InfoWindow();
var regionConstructors = {};
function makeRegionPolygonCube(map, name, region)
{
new regionConstructors['polygon'](map, name, region);
}
function regionInfo(event, name, region)
{
new regionConstructors['info'](event, name, region);
}
componentconstructors['regions'] = function(dynmap, configuration)
{
regionCfg = configuration;
loadjs('js/regions_' + regionCfg.name + '.js', function()
{
var world_info = dynmap.map.mapTypeId.split('.');
new regionConstructors['update'](world_info[0]);
$(dynmap).bind('mapchanged', function() {
var world_info = dynmap.map.mapTypeId.split('.');
new regionConstructors['update'](world_info[0]);
});
});
}
function arrayReplace(replace, by, str)
{
for (var i=0; i<replace.length; i++)
str = str.replace(replace[i], by[i]);
return str;
}