aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorCareminster Staff2010-01-13 22:45:17 -0600
committerMelanie2010-01-14 04:11:17 +0000
commita87d7a12967b50fe83ebbaa7b57e531eb93158a2 (patch)
treec20e4d10db7892218ef31b5b59862ac90029dd4e
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC_OLD-a87d7a12967b50fe83ebbaa7b57e531eb93158a2.zip
opensim-SC_OLD-a87d7a12967b50fe83ebbaa7b57e531eb93158a2.tar.gz
opensim-SC_OLD-a87d7a12967b50fe83ebbaa7b57e531eb93158a2.tar.bz2
opensim-SC_OLD-a87d7a12967b50fe83ebbaa7b57e531eb93158a2.tar.xz
Adds Land Banning.
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs130
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs48
2 files changed, 120 insertions, 58 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 9b39b09..d9b36a5 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -264,20 +264,57 @@ namespace OpenSim.Region.CoreModules.World.Land
264 return parcelsNear; 264 return parcelsNear;
265 } 265 }
266 266
267 public void SendYouAreBannedNotice(ScenePresence avatar) 267 public void KickUserOffOfParcel(ScenePresence avatar)
268 { 268 {
269 if (AllowedForcefulBans) 269 if (avatar.GodLevel == 0)
270 { 270 {
271 avatar.ControllingClient.SendAlertMessage( 271 List<ILandObject> parcelsNear = ParcelsNearPoint(avatar.AbsolutePosition);
272 "You are not allowed on this parcel because you are banned. Please go away."); 272 foreach (ILandObject check in parcelsNear)
273 273 {
274 avatar.PhysicsActor.Position = avatar.lastKnownAllowedPosition; 274 if (check.IsEitherBannedOrRestricted(avatar.UUID) != true)
275 avatar.PhysicsActor.Velocity = Vector3.Zero; 275 {
276 Vector3 target = check.LandData.UserLocation;
277 avatar.TeleportWithMomentum(target);
278 return;
279 }
280 }
276 } 281 }
277 else 282 }
283 public void MoveUserOutOfParcel(ScenePresence avatar)
284 {
285 if (avatar.GodLevel == 0)
278 { 286 {
279 avatar.ControllingClient.SendAlertMessage( 287 ILandObject land = m_scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
280 "You are not allowed on this parcel because you are banned; however, the grid administrator has disabled ban lines globally. Please obey the land owner's requests or you can be banned from the entire sim!"); 288 List<ILandObject> parcelsNear = new List<ILandObject>();
289
290 for (int x = -2; x <= 2; x += 2)
291 {
292 ILandObject check = GetLandObject(avatar.AbsolutePosition.X + x, avatar.AbsolutePosition.Y);
293 if (check != null)
294 {
295 if (check.IsEitherBannedOrRestricted(avatar.UUID) != true)
296 {
297 Vector3 target = new Vector3(avatar.AbsolutePosition.X + x, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z);
298 avatar.TeleportWithMomentum(target);
299 avatar.Velocity = new Vector3(-avatar.Velocity.X - 5, avatar.Velocity.Y, avatar.Velocity.Z);
300 return;
301 }
302 }
303 }
304 for (int y = -2; y <= 2; y += 2)
305 {
306 ILandObject check = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y + y);
307 if (check != null)
308 {
309 if (check.IsEitherBannedOrRestricted(avatar.UUID) != true)
310 {
311 Vector3 target = new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y + y, avatar.AbsolutePosition.Z);
312 avatar.TeleportWithMomentum(target);
313 avatar.Velocity = new Vector3(avatar.Velocity.X, -avatar.Velocity.Y - 5, avatar.Velocity.Z);
314 return;
315 }
316 }
317 }
281 } 318 }
282 } 319 }
283 320
@@ -297,16 +334,7 @@ namespace OpenSim.Region.CoreModules.World.Land
297 { 334 {
298 if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) 335 if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID))
299 { 336 {
300 SendYouAreBannedNotice(avatar); 337 MoveUserOutOfParcel(avatar);
301 }
302 else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID))
303 {
304 avatar.ControllingClient.SendAlertMessage(
305 "You are not allowed on this parcel because the land owner has restricted access. For now, you can enter, but please respect the land owner's decisions (or he can ban you!).");
306 }
307 else
308 {
309 avatar.sentMessageAboutRestrictedParcelFlyingDown = true;
310 } 338 }
311 } 339 }
312 else 340 else
@@ -317,28 +345,47 @@ namespace OpenSim.Region.CoreModules.World.Land
317 } 345 }
318 } 346 }
319 347
320 public void SendOutNearestBanLine(IClientAPI avatar) 348 public void SendOutNearestBanLine(ScenePresence avatar)
321 { 349 {
322 List<ScenePresence> avatars = m_scene.GetAvatars(); 350 ILandObject checkBan = null;
323 foreach (ScenePresence presence in avatars) 351 for (int x = -2; x <= 2; x += 2)
324 { 352 {
325 if (presence.UUID == avatar.AgentId) 353 checkBan = GetLandObject(avatar.AbsolutePosition.X + x, avatar.AbsolutePosition.Y);
354 if (checkBan != null)
326 { 355 {
327 List<ILandObject> checkLandParcels = ParcelsNearPoint(presence.AbsolutePosition); 356 if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT)
328 foreach (ILandObject checkBan in checkLandParcels)
329 { 357 {
330 if (checkBan.IsBannedFromLand(avatar.AgentId)) 358 if (checkBan.IsRestrictedFromLand(avatar.ControllingClient.AgentId))
331 { 359 {
332 checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar); 360 checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar.ControllingClient);
333 return; //Only send one 361 return;
334 } 362 }
335 if (checkBan.IsRestrictedFromLand(avatar.AgentId)) 363 if (checkBan.IsBannedFromLand(avatar.ControllingClient.AgentId))
336 { 364 {
337 checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar); 365 checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar.ControllingClient);
338 return; //Only send one 366 return;
367 }
368 }
369 }
370 }
371 for (int y = -2; y <= 2; y += 2)
372 {
373 checkBan = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y + y);
374 if (checkBan != null)
375 {
376 if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT)
377 {
378 if (checkBan.IsRestrictedFromLand(avatar.ControllingClient.AgentId))
379 {
380 checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar.ControllingClient);
381 return;
382 }
383 if (checkBan.IsBannedFromLand(avatar.ControllingClient.AgentId))
384 {
385 checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar.ControllingClient);
386 return;
339 } 387 }
340 } 388 }
341 return;
342 } 389 }
343 } 390 }
344 } 391 }
@@ -385,25 +432,14 @@ namespace OpenSim.Region.CoreModules.World.Land
385 if (clientAvatar != null) 432 if (clientAvatar != null)
386 { 433 {
387 SendLandUpdate(clientAvatar); 434 SendLandUpdate(clientAvatar);
388 SendOutNearestBanLine(remote_client); 435 SendOutNearestBanLine(clientAvatar);
389 ILandObject parcel = GetLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); 436 ILandObject parcel = GetLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y);
390 if (parcel != null) 437 if (parcel != null)
391 { 438 {
392 if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && 439 if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT &&
393 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown)
394 {
395 EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID,
396 m_scene.RegionInfo.RegionID);
397 //They are going under the safety line!
398 if (!parcel.IsBannedFromLand(clientAvatar.UUID))
399 {
400 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false;
401 }
402 }
403 else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT &&
404 parcel.IsBannedFromLand(clientAvatar.UUID)) 440 parcel.IsBannedFromLand(clientAvatar.UUID))
405 { 441 {
406 SendYouAreBannedNotice(clientAvatar); 442 MoveUserOutOfParcel(clientAvatar);
407 } 443 }
408 } 444 }
409 } 445 }
@@ -451,7 +487,7 @@ namespace OpenSim.Region.CoreModules.World.Land
451 487
452 if (land != null) 488 if (land != null)
453 { 489 {
454 if (agentID == land.LandData.OwnerID) 490 if (m_scene.Permissions.CanEditParcel(agentID, land))
455 { 491 {
456 land.UpdateAccessList(flags, entries, remote_client); 492 land.UpdateAccessList(flags, entries, remote_client);
457 } 493 }
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 1fa8630..1c65965 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -267,11 +267,7 @@ namespace OpenSim.Region.CoreModules.World.Land
267 267
268 public bool IsEitherBannedOrRestricted(UUID avatar) 268 public bool IsEitherBannedOrRestricted(UUID avatar)
269 { 269 {
270 if (IsBannedFromLand(avatar)) 270 if (IsRestrictedFromLand(avatar) || IsBannedFromLand(avatar))
271 {
272 return true;
273 }
274 else if (IsRestrictedFromLand(avatar))
275 { 271 {
276 return true; 272 return true;
277 } 273 }
@@ -280,7 +276,8 @@ namespace OpenSim.Region.CoreModules.World.Land
280 276
281 public bool IsBannedFromLand(UUID avatar) 277 public bool IsBannedFromLand(UUID avatar)
282 { 278 {
283 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) 279 ScenePresence SP = m_scene.GetScenePresence(avatar);
280 if ((LandData.Flags & (uint)ParcelFlags.UseBanList) > 0)
284 { 281 {
285 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 282 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
286 entry.AgentID = avatar; 283 entry.AgentID = avatar;
@@ -288,8 +285,22 @@ namespace OpenSim.Region.CoreModules.World.Land
288 entry.Time = new DateTime(); 285 entry.Time = new DateTime();
289 if (LandData.ParcelAccessList.Contains(entry)) 286 if (LandData.ParcelAccessList.Contains(entry))
290 { 287 {
291 //They are banned, so lets send them a notice about this parcel 288 if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) > 0)
292 return true; 289 {
290 if (LandData.GroupID == SP.ControllingClient.ActiveGroupId)
291 {
292 return false;
293 }
294 else
295 {
296 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
297 return true;
298 }
299 }
300 else
301 {
302 return true;
303 }
293 } 304 }
294 } 305 }
295 return false; 306 return false;
@@ -297,7 +308,8 @@ namespace OpenSim.Region.CoreModules.World.Land
297 308
298 public bool IsRestrictedFromLand(UUID avatar) 309 public bool IsRestrictedFromLand(UUID avatar)
299 { 310 {
300 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) 311 ScenePresence SP = m_scene.GetScenePresence(avatar);
312 if ((LandData.Flags & (uint)ParcelFlags.UseAccessList) > 0)
301 { 313 {
302 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 314 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
303 entry.AgentID = avatar; 315 entry.AgentID = avatar;
@@ -305,8 +317,22 @@ namespace OpenSim.Region.CoreModules.World.Land
305 entry.Time = new DateTime(); 317 entry.Time = new DateTime();
306 if (!LandData.ParcelAccessList.Contains(entry)) 318 if (!LandData.ParcelAccessList.Contains(entry))
307 { 319 {
308 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel 320 if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) > 0)
309 return true; 321 {
322 if (LandData.GroupID == SP.ControllingClient.ActiveGroupId)
323 {
324 return false;
325 }
326 else
327 {
328 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
329 return true;
330 }
331 }
332 else
333 {
334 return true;
335 }
310 } 336 }
311 } 337 }
312 return false; 338 return false;