private static void ZoneAddCallback( Player player, Vector3I[] marks, object tag )
{
World playerWorld = player.World;
if ( playerWorld == null )
PlayerOpException.ThrowNoWorld( player );
if ( !player.Info.Rank.AllowSecurityCircumvention ) {
SecurityCheckResult buildCheck = playerWorld.BuildSecurity.CheckDetailed( player.Info );
switch ( buildCheck ) {
case SecurityCheckResult.BlackListed:
player.Message( "Cannot add zones to world {0}&S: You are barred from building here.",
playerWorld.ClassyName );
return;
case SecurityCheckResult.RankTooLow:
player.Message( "Cannot add zones to world {0}&S: You are not allowed to build here.",
playerWorld.ClassyName );
return;
//case SecurityCheckResult.RankTooHigh:
}
}
Zone zone = ( Zone )tag;
var zones = player.WorldMap.Zones;
lock ( zones.SyncRoot ) {
Zone dupeZone = zones.FindExact( zone.Name );
if ( dupeZone != null ) {
player.Message( "A zone named \"{0}\" has just been created by {1}",
dupeZone.Name, dupeZone.CreatedBy );
return;
}
zone.Create( new BoundingBox( marks[0], marks[1] ), player.Info );
player.Message( "Zone \"{0}\" created, {1} blocks total.",
zone.Name, zone.Bounds.Volume );
Logger.Log( LogType.UserActivity,
"Player {0} created a new zone \"{1}\" containing {2} blocks.",
player.Name,
zone.Name,
zone.Bounds.Volume );
zones.Add( zone );
}
}