diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 9b39b09f2b..d9b36a50a1 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 return parcelsNear; } - public void SendYouAreBannedNotice(ScenePresence avatar) + public void KickUserOffOfParcel(ScenePresence avatar) { - if (AllowedForcefulBans) + if (avatar.GodLevel == 0) { - avatar.ControllingClient.SendAlertMessage( - "You are not allowed on this parcel because you are banned. Please go away."); - - avatar.PhysicsActor.Position = avatar.lastKnownAllowedPosition; - avatar.PhysicsActor.Velocity = Vector3.Zero; + List parcelsNear = ParcelsNearPoint(avatar.AbsolutePosition); + foreach (ILandObject check in parcelsNear) + { + if (check.IsEitherBannedOrRestricted(avatar.UUID) != true) + { + Vector3 target = check.LandData.UserLocation; + avatar.TeleportWithMomentum(target); + return; + } + } } - else + } + public void MoveUserOutOfParcel(ScenePresence avatar) + { + if (avatar.GodLevel == 0) { - avatar.ControllingClient.SendAlertMessage( - "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!"); + ILandObject land = m_scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); + List parcelsNear = new List(); + + for (int x = -2; x <= 2; x += 2) + { + ILandObject check = GetLandObject(avatar.AbsolutePosition.X + x, avatar.AbsolutePosition.Y); + if (check != null) + { + if (check.IsEitherBannedOrRestricted(avatar.UUID) != true) + { + Vector3 target = new Vector3(avatar.AbsolutePosition.X + x, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); + avatar.TeleportWithMomentum(target); + avatar.Velocity = new Vector3(-avatar.Velocity.X - 5, avatar.Velocity.Y, avatar.Velocity.Z); + return; + } + } + } + for (int y = -2; y <= 2; y += 2) + { + ILandObject check = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y + y); + if (check != null) + { + if (check.IsEitherBannedOrRestricted(avatar.UUID) != true) + { + Vector3 target = new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y + y, avatar.AbsolutePosition.Z); + avatar.TeleportWithMomentum(target); + avatar.Velocity = new Vector3(avatar.Velocity.X, -avatar.Velocity.Y - 5, avatar.Velocity.Z); + return; + } + } + } } } @@ -297,16 +334,7 @@ namespace OpenSim.Region.CoreModules.World.Land { if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) { - SendYouAreBannedNotice(avatar); - } - else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID)) - { - avatar.ControllingClient.SendAlertMessage( - "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!)."); - } - else - { - avatar.sentMessageAboutRestrictedParcelFlyingDown = true; + MoveUserOutOfParcel(avatar); } } else @@ -317,28 +345,47 @@ namespace OpenSim.Region.CoreModules.World.Land } } - public void SendOutNearestBanLine(IClientAPI avatar) + public void SendOutNearestBanLine(ScenePresence avatar) { - List avatars = m_scene.GetAvatars(); - foreach (ScenePresence presence in avatars) + ILandObject checkBan = null; + for (int x = -2; x <= 2; x += 2) { - if (presence.UUID == avatar.AgentId) + checkBan = GetLandObject(avatar.AbsolutePosition.X + x, avatar.AbsolutePosition.Y); + if (checkBan != null) { - List checkLandParcels = ParcelsNearPoint(presence.AbsolutePosition); - foreach (ILandObject checkBan in checkLandParcels) + if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) { - if (checkBan.IsBannedFromLand(avatar.AgentId)) + if (checkBan.IsRestrictedFromLand(avatar.ControllingClient.AgentId)) { - checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar); - return; //Only send one + checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar.ControllingClient); + return; } - if (checkBan.IsRestrictedFromLand(avatar.AgentId)) + if (checkBan.IsBannedFromLand(avatar.ControllingClient.AgentId)) { - checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar); - return; //Only send one + checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar.ControllingClient); + return; + } + } + } + } + for (int y = -2; y <= 2; y += 2) + { + checkBan = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y + y); + if (checkBan != null) + { + if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) + { + if (checkBan.IsRestrictedFromLand(avatar.ControllingClient.AgentId)) + { + checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar.ControllingClient); + return; + } + if (checkBan.IsBannedFromLand(avatar.ControllingClient.AgentId)) + { + checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar.ControllingClient); + return; } } - return; } } } @@ -385,25 +432,14 @@ namespace OpenSim.Region.CoreModules.World.Land if (clientAvatar != null) { SendLandUpdate(clientAvatar); - SendOutNearestBanLine(remote_client); + SendOutNearestBanLine(clientAvatar); ILandObject parcel = GetLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); if (parcel != null) { if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && - clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) - { - EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID, - m_scene.RegionInfo.RegionID); - //They are going under the safety line! - if (!parcel.IsBannedFromLand(clientAvatar.UUID)) - { - clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false; - } - } - else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && parcel.IsBannedFromLand(clientAvatar.UUID)) { - SendYouAreBannedNotice(clientAvatar); + MoveUserOutOfParcel(clientAvatar); } } } @@ -451,7 +487,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (land != null) { - if (agentID == land.LandData.OwnerID) + if (m_scene.Permissions.CanEditParcel(agentID, land)) { land.UpdateAccessList(flags, entries, remote_client); } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 1fa8630cbc..1c659650b5 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 public bool IsEitherBannedOrRestricted(UUID avatar) { - if (IsBannedFromLand(avatar)) - { - return true; - } - else if (IsRestrictedFromLand(avatar)) + if (IsRestrictedFromLand(avatar) || IsBannedFromLand(avatar)) { return true; } @@ -280,7 +276,8 @@ namespace OpenSim.Region.CoreModules.World.Land public bool IsBannedFromLand(UUID avatar) { - if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) + ScenePresence SP = m_scene.GetScenePresence(avatar); + if ((LandData.Flags & (uint)ParcelFlags.UseBanList) > 0) { ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); entry.AgentID = avatar; @@ -288,8 +285,22 @@ namespace OpenSim.Region.CoreModules.World.Land entry.Time = new DateTime(); if (LandData.ParcelAccessList.Contains(entry)) { - //They are banned, so lets send them a notice about this parcel - return true; + if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) > 0) + { + if (LandData.GroupID == SP.ControllingClient.ActiveGroupId) + { + return false; + } + else + { + //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel + return true; + } + } + else + { + return true; + } } } return false; @@ -297,7 +308,8 @@ namespace OpenSim.Region.CoreModules.World.Land public bool IsRestrictedFromLand(UUID avatar) { - if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) + ScenePresence SP = m_scene.GetScenePresence(avatar); + if ((LandData.Flags & (uint)ParcelFlags.UseAccessList) > 0) { ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); entry.AgentID = avatar; @@ -305,8 +317,22 @@ namespace OpenSim.Region.CoreModules.World.Land entry.Time = new DateTime(); if (!LandData.ParcelAccessList.Contains(entry)) { - //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel - return true; + if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) > 0) + { + if (LandData.GroupID == SP.ControllingClient.ActiveGroupId) + { + return false; + } + else + { + //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel + return true; + } + } + else + { + return true; + } } } return false;