mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-22 19:18:47 +00:00
Validate lient is in-world before accepting join/invite request
This commit is contained in:
parent
fd52361a5e
commit
b871b8e74c
@ -1,4 +1,5 @@
|
|||||||
using VpSharp.Entities;
|
using VpSharp.Entities;
|
||||||
|
using VpSharp.Exceptions;
|
||||||
using VpSharp.Internal;
|
using VpSharp.Internal;
|
||||||
|
|
||||||
namespace VpSharp;
|
namespace VpSharp;
|
||||||
@ -73,6 +74,11 @@ public sealed class InviteRequest : IEquatable<InviteRequest>
|
|||||||
/// </param>
|
/// </param>
|
||||||
public Task AcceptAsync(bool suppressTeleport = false)
|
public Task AcceptAsync(bool suppressTeleport = false)
|
||||||
{
|
{
|
||||||
|
if (_client.CurrentAvatar is null)
|
||||||
|
{
|
||||||
|
throw new NotInWorldException();
|
||||||
|
}
|
||||||
|
|
||||||
lock (_client.Lock)
|
lock (_client.Lock)
|
||||||
{
|
{
|
||||||
_ = Native.vp_invite_accept(_client.NativeInstanceHandle, _requestId);
|
_ = Native.vp_invite_accept(_client.NativeInstanceHandle, _requestId);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using VpSharp.Entities;
|
using VpSharp.Entities;
|
||||||
|
using VpSharp.Exceptions;
|
||||||
using VpSharp.Extensions;
|
using VpSharp.Extensions;
|
||||||
using VpSharp.Internal;
|
using VpSharp.Internal;
|
||||||
|
|
||||||
@ -67,7 +68,12 @@ public sealed class JoinRequest : IEquatable<JoinRequest>
|
|||||||
ThrowHelper.ThrowNotInWorldException();
|
ThrowHelper.ThrowNotInWorldException();
|
||||||
}
|
}
|
||||||
|
|
||||||
location ??= _client.CurrentAvatar!.Location;
|
if (_client.CurrentAvatar is null)
|
||||||
|
{
|
||||||
|
throw new NotInWorldException();
|
||||||
|
}
|
||||||
|
|
||||||
|
location ??= _client.CurrentAvatar.Location;
|
||||||
string worldName = location.Value.World.Name;
|
string worldName = location.Value.World.Name;
|
||||||
(double x, double y, double z) = location.Value.Position;
|
(double x, double y, double z) = location.Value.Position;
|
||||||
(double pitch, double yaw, double _) = location.Value.Rotation.ToEulerAngles();
|
(double pitch, double yaw, double _) = location.Value.Rotation.ToEulerAngles();
|
||||||
|
Loading…
Reference in New Issue
Block a user