Adds Land Banning.

avinationmerge
Careminster Staff 2010-01-13 22:45:17 -06:00 committed by Melanie
parent f0152790cf
commit a87d7a1296
2 changed files with 120 additions and 58 deletions

View File

@ -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<ILandObject> 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<ILandObject> parcelsNear = new List<ILandObject>();
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<ScenePresence> 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<ILandObject> 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);
}

View File

@ -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;