diff --git a/EXILED/Exiled.API/Features/Camera.cs b/EXILED/Exiled.API/Features/Camera.cs
index 0c949f124b..4379ae1e2e 100644
--- a/EXILED/Exiled.API/Features/Camera.cs
+++ b/EXILED/Exiled.API/Features/Camera.cs
@@ -262,6 +262,13 @@ public bool IsBeingUsed
set => Base.IsActive = value;
}
+ ///
+ /// Converts Scp079Camera to Camera.
+ ///
+ /// The Scp079Camera.
+ /// EXILED Camera.
+ public static implicit operator Camera(Scp079Camera scp079Camera) => Get(scp079Camera);
+
///
/// Gets a of which contains all the instances given a of .
///
@@ -274,7 +281,7 @@ public bool IsBeingUsed
///
/// The base .
/// A or if not found.
- public static Camera Get(Scp079Camera camera079) => camera079 != null ? Camera079ToCamera.TryGetValue(camera079, out Camera camera) ? camera : new(camera079) : null;
+ public static Camera Get(Scp079Camera camera079) => camera079 == null ? null : Camera079ToCamera.TryGetValue(camera079, out Camera camera) ? camera : new(camera079);
///
/// Gets a given the specified .
diff --git a/EXILED/Exiled.API/Features/Doors/Door.cs b/EXILED/Exiled.API/Features/Doors/Door.cs
index 8518be4a9c..20ae0f4161 100644
--- a/EXILED/Exiled.API/Features/Doors/Door.cs
+++ b/EXILED/Exiled.API/Features/Doors/Door.cs
@@ -309,6 +309,13 @@ public Vector3 Scale
///
internal List RoomsValue { get; } = new List();
+ ///
+ /// Converts DoorVariant to Door.
+ ///
+ /// The DoorVariant.
+ /// EXILED Door.
+ public static implicit operator Door(DoorVariant doorVariant) => Get(doorVariant);
+
///
/// Gets the door object associated with a specific , or creates a new one if there isn't one.
///
diff --git a/EXILED/Exiled.API/Features/Generator.cs b/EXILED/Exiled.API/Features/Generator.cs
index e494184cd0..2ec5d20e22 100644
--- a/EXILED/Exiled.API/Features/Generator.cs
+++ b/EXILED/Exiled.API/Features/Generator.cs
@@ -244,6 +244,13 @@ public KeycardPermissions KeycardPermissions
set => Base._requiredPermission = (DoorPermissionFlags)value;
}
+ ///
+ /// Converts Scp079Generator to Generator.
+ ///
+ /// The Scp079Generator.
+ /// EXILED Generator.
+ public static implicit operator Generator(Scp079Generator scp079Generator) => Get(scp079Generator);
+
///
/// Gets the belonging to the , if any.
///
diff --git a/EXILED/Exiled.API/Features/Hazards/Hazard.cs b/EXILED/Exiled.API/Features/Hazards/Hazard.cs
index c0c82a3aea..7e42860f4a 100644
--- a/EXILED/Exiled.API/Features/Hazards/Hazard.cs
+++ b/EXILED/Exiled.API/Features/Hazards/Hazard.cs
@@ -116,12 +116,19 @@ public Vector3 Position
set => Base.SourcePosition = value;
}
+ ///
+ /// Converts EnvironmentalHazard to Hazard.
+ ///
+ /// The EnvironmentalHazard.
+ /// EXILED Hazard.
+ public static implicit operator Hazard(EnvironmentalHazard environmentalHazard) => Get(environmentalHazard);
+
///
/// Gets the by .
///
/// The instance.
/// for .
- public static Hazard Get(EnvironmentalHazard environmentalHazard) =>
+ public static Hazard Get(EnvironmentalHazard environmentalHazard) => environmentalHazard == null ? null :
EnvironmentalHazardToHazard.TryGetValue(environmentalHazard, out Hazard hazard) ? hazard
: environmentalHazard switch
{
diff --git a/EXILED/Exiled.API/Features/Items/Item.cs b/EXILED/Exiled.API/Features/Items/Item.cs
index 6446dd8cf6..f91855c606 100644
--- a/EXILED/Exiled.API/Features/Items/Item.cs
+++ b/EXILED/Exiled.API/Features/Items/Item.cs
@@ -206,6 +206,13 @@ public ItemAddReason AddReason
///
public ItemIdentifier Identifier => Base.ItemId;
+ ///
+ /// Converts ItemBase to Item.
+ ///
+ /// The ItemBase.
+ /// EXILED Item.
+ public static implicit operator Item(ItemBase itemBase) => Get(itemBase);
+
///
/// Gets an existing or creates a new instance of one.
///
diff --git a/EXILED/Exiled.API/Features/Lift.cs b/EXILED/Exiled.API/Features/Lift.cs
index 8e47b7ba04..6d63dd690a 100644
--- a/EXILED/Exiled.API/Features/Lift.cs
+++ b/EXILED/Exiled.API/Features/Lift.cs
@@ -162,9 +162,13 @@ public ElevatorSequence Status
};
///
- /// Gets the .
+ /// Gets or sets the .
///
- public ElevatorGroup Group => Base.AssignedGroup;
+ public ElevatorGroup Group
+ {
+ get => Base.NetworkAssignedGroup;
+ set => Base.NetworkAssignedGroup = value;
+ }
///
/// Gets a value indicating whether the lift is operative.
@@ -220,6 +224,13 @@ public float AnimationTime
///
public Doors.ElevatorDoor CurrentDestination => Door.Get(Base.DestinationDoor);
+ ///
+ /// Converts ElevatorChamber to Lift.
+ ///
+ /// The ElevatorChamber.
+ /// EXILED Lift.
+ public static implicit operator Lift(ElevatorChamber elevatorChamber) => Get(elevatorChamber);
+
///
/// Gets a of which contains all the instances from the specified .
///
@@ -232,7 +243,7 @@ public float AnimationTime
///
/// The instance.
/// A or if not found.
- public static Lift Get(ElevatorChamber elevator) => ElevatorChamberToLift.TryGetValue(elevator, out Lift lift) ? lift : new(elevator);
+ public static Lift Get(ElevatorChamber elevator) => elevator == null ? null : ElevatorChamberToLift.TryGetValue(elevator, out Lift lift) ? lift : new(elevator);
///
/// Gets the corresponding to the specified , if any.
diff --git a/EXILED/Exiled.API/Features/Lockers/Chamber.cs b/EXILED/Exiled.API/Features/Lockers/Chamber.cs
index 980f5df9f6..a2462e4732 100644
--- a/EXILED/Exiled.API/Features/Lockers/Chamber.cs
+++ b/EXILED/Exiled.API/Features/Lockers/Chamber.cs
@@ -192,6 +192,13 @@ public bool IsOpen
///
public bool CanInteract => Base.CanInteract;
+ ///
+ /// Converts LockerChamber to Chamber.
+ ///
+ /// The LockerChamber.
+ /// EXILED Chamber.
+ public static implicit operator Chamber(LockerChamber lockerChamber) => Get(lockerChamber);
+
///
/// Adds an item to the current chamber.
///
diff --git a/EXILED/Exiled.API/Features/Lockers/Locker.cs b/EXILED/Exiled.API/Features/Lockers/Locker.cs
index f4b4164adb..9ca197fc6d 100644
--- a/EXILED/Exiled.API/Features/Lockers/Locker.cs
+++ b/EXILED/Exiled.API/Features/Lockers/Locker.cs
@@ -123,7 +123,7 @@ public Quaternion Rotation
///
public ushort OpenedChambers
{
- get => Base.OpenedChambers;
+ get => Base.NetworkOpenedChambers;
set => Base.NetworkOpenedChambers = value;
}
@@ -148,6 +148,13 @@ public Vector3 RandomChamberPosition
}
}
+ ///
+ /// Converts BaseLocker to Locker.
+ ///
+ /// The BaseLocker.
+ /// EXILED Locker.
+ public static implicit operator Locker?(BaseLocker baseLocker) => Get(baseLocker);
+
///
/// Gets the belonging to the , if any.
///
diff --git a/EXILED/Exiled.API/Features/Pickups/Pickup.cs b/EXILED/Exiled.API/Features/Pickups/Pickup.cs
index 4c49efbd70..29c6519636 100644
--- a/EXILED/Exiled.API/Features/Pickups/Pickup.cs
+++ b/EXILED/Exiled.API/Features/Pickups/Pickup.cs
@@ -294,6 +294,13 @@ public Quaternion Rotation
///
public bool IsSpawned => NetworkServer.spawned.ContainsValue(Base.netIdentity);
+ ///
+ /// Converts ItemPickupBase to Pickup.
+ ///
+ /// The ItemPickupBase.
+ /// EXILED Pickup.
+ public static implicit operator Pickup(ItemPickupBase itemPickupBase) => Get(itemPickupBase);
+
///
/// Gets an existing or creates a new instance of one.
///
diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs
index 936a82c4c6..b8561ed4f7 100644
--- a/EXILED/Exiled.API/Features/Player.cs
+++ b/EXILED/Exiled.API/Features/Player.cs
@@ -1312,17 +1312,24 @@ public bool IsSpawnProtected
protected HealthStat CustomHealthStat { get; set; }
///
- /// Converts LabApi player to EXILED player.
+ /// Converts ReferenceHub to Player.
///
- /// The LabApi player.
+ /// The ReferenceHub.
/// EXILED player.
- public static implicit operator Player(LabApi.Features.Wrappers.Player player) => Get(player);
+ public static implicit operator Player(ReferenceHub hub) => Get(hub);
///
/// Converts LabApi player to EXILED player.
///
/// The LabApi player.
/// EXILED player.
+ public static implicit operator Player(LabApi.Features.Wrappers.Player player) => Get(player);
+
+ ///
+ /// Converts EXILED player to LabApi player.
+ ///
+ /// The EXILED player.
+ /// LabApi player.
public static implicit operator LabApi.Features.Wrappers.Player(Player player) => LabApi.Features.Wrappers.Player.Get(player?.ReferenceHub);
///
@@ -1518,7 +1525,7 @@ public static Player Get(string args)
///
/// The class.
/// A or if not found.
- public static Player Get(LabApi.Features.Wrappers.Player apiPlayer) => Get(apiPlayer.ReferenceHub);
+ public static Player Get(LabApi.Features.Wrappers.Player apiPlayer) => Get(apiPlayer?.ReferenceHub);
///
/// Try-get a player given a .
diff --git a/EXILED/Exiled.API/Features/Ragdoll.cs b/EXILED/Exiled.API/Features/Ragdoll.cs
index e743ad4ea2..bb30a9865a 100644
--- a/EXILED/Exiled.API/Features/Ragdoll.cs
+++ b/EXILED/Exiled.API/Features/Ragdoll.cs
@@ -306,6 +306,13 @@ public Vector3 RagdollScale
///
internal static HashSet IgnoredRagdolls { get; set; } = new();
+ ///
+ /// Converts BasicRagdoll to Ragdoll.
+ ///
+ /// The BasicRagdoll.
+ /// EXILED Ragdoll.
+ public static implicit operator Ragdoll(BasicRagdoll basicRagdoll) => Get(basicRagdoll);
+
///
/// Gets the last ragdoll of the player.
///
diff --git a/EXILED/Exiled.API/Features/Room.cs b/EXILED/Exiled.API/Features/Room.cs
index bee30fa96c..7d42ebe285 100644
--- a/EXILED/Exiled.API/Features/Room.cs
+++ b/EXILED/Exiled.API/Features/Room.cs
@@ -235,6 +235,13 @@ public bool AreLightsOff
///
internal List NearestRoomsValue { get; } = new();
+ ///
+ /// Converts RoomIdentifier to Room.
+ ///
+ /// The RoomIdentifier.
+ /// EXILED Room.
+ public static implicit operator Room(RoomIdentifier roomIdentifier) => Get(roomIdentifier);
+
///
/// Gets a given the specified .
///
diff --git a/EXILED/Exiled.API/Features/Scp559.cs b/EXILED/Exiled.API/Features/Scp559.cs
index 4cfc434eda..ee258bb24b 100644
--- a/EXILED/Exiled.API/Features/Scp559.cs
+++ b/EXILED/Exiled.API/Features/Scp559.cs
@@ -90,7 +90,7 @@ public static Vector3 PedestalOffset
///
public byte RemainingSlices
{
- get => Base._remainingSlices;
+ get => Base.Network_remainingSlices;
set => Base.Network_remainingSlices = value;
}
@@ -99,7 +99,7 @@ public byte RemainingSlices
///
public bool IsSpawned
{
- get => Base._isSpawned;
+ get => Base.Network_isSpawned;
set => Base.Network_isSpawned = value;
}
@@ -124,16 +124,23 @@ public float RespawnTime
///
public Vector3 Position
{
- get => Base._position;
+ get => Base.Network_position;
set => Base.Network_position = value;
}
+ ///
+ /// Converts Scp559Cake to Scp559.
+ ///
+ /// The Scp559Cake.
+ /// EXILED Scp559.
+ public static implicit operator Scp559(Scp559Cake scp559Cake) => Get(scp559Cake);
+
///
/// Gets the by it's game instance.
///
/// Game instance.
/// .
- public static Scp559 Get(Scp559Cake cake) => CakeToWrapper.TryGetValue(cake, out Scp559 scp559) ? scp559 : new Scp559(cake);
+ public static Scp559 Get(Scp559Cake cake) => cake == null ? null : CakeToWrapper.TryGetValue(cake, out Scp559 scp559) ? scp559 : new Scp559(cake);
///
/// Gets the of SCP-559 which matches the predicate.
diff --git a/EXILED/Exiled.API/Features/TeslaGate.cs b/EXILED/Exiled.API/Features/TeslaGate.cs
index dd9893e929..e46ad4a702 100644
--- a/EXILED/Exiled.API/Features/TeslaGate.cs
+++ b/EXILED/Exiled.API/Features/TeslaGate.cs
@@ -199,12 +199,19 @@ public bool UseInstantBurst
///
public IEnumerable PlayersInTriggerRange => Player.List.Where(IsPlayerInTriggerRange);
+ ///
+ /// Converts BaseTeslaGate to TeslaGate.
+ ///
+ /// The BaseTeslaGate.
+ /// EXILED TeslaGate.
+ public static implicit operator TeslaGate(BaseTeslaGate baseTeslaGate) => Get(baseTeslaGate);
+
///
/// Gets the belonging to the .
///
/// The instance.
/// The corresponding instance.
- public static TeslaGate Get(BaseTeslaGate baseTeslaGate) => BaseTeslaGateToTeslaGate.TryGetValue(baseTeslaGate, out TeslaGate teslagate) ?
+ public static TeslaGate Get(BaseTeslaGate baseTeslaGate) => baseTeslaGate == null ? null : BaseTeslaGateToTeslaGate.TryGetValue(baseTeslaGate, out TeslaGate teslagate) ?
teslagate :
new(baseTeslaGate, Room.FindParentRoom(baseTeslaGate.gameObject));
diff --git a/EXILED/Exiled.API/Features/Toys/AdminToy.cs b/EXILED/Exiled.API/Features/Toys/AdminToy.cs
index 9c58b1df82..42f8aaf758 100644
--- a/EXILED/Exiled.API/Features/Toys/AdminToy.cs
+++ b/EXILED/Exiled.API/Features/Toys/AdminToy.cs
@@ -174,6 +174,13 @@ public bool IsStatic
set => AdminToyBase.NetworkIsStatic = value;
}
+ ///
+ /// Converts AdminToyBase to AdminToy.
+ ///
+ /// The AdminToyBase.
+ /// EXILED AdminToy.
+ public static implicit operator AdminToy(AdminToyBase adminToyBase) => Get(adminToyBase);
+
///
/// Gets the belonging to the .
///
diff --git a/EXILED/Exiled.API/Features/Toys/CameraToy.cs b/EXILED/Exiled.API/Features/Toys/CameraToy.cs
index f71e460d9a..3938148651 100644
--- a/EXILED/Exiled.API/Features/Toys/CameraToy.cs
+++ b/EXILED/Exiled.API/Features/Toys/CameraToy.cs
@@ -103,6 +103,13 @@ public string Name
set => Base.NetworkLabel = value;
}
+ ///
+ /// Converts Scp079CameraToy to CameraToy.
+ ///
+ /// The Scp079CameraToy.
+ /// EXILED CameraToy.
+ public static implicit operator CameraToy(Scp079CameraToy scp079CameraToy) => (CameraToy)Get(scp079CameraToy);
+
///
/// Creates a new with a specified type.
///
diff --git a/EXILED/Exiled.API/Features/Toys/Capybara.cs b/EXILED/Exiled.API/Features/Toys/Capybara.cs
index 6d901f1a8d..16c8b75345 100644
--- a/EXILED/Exiled.API/Features/Toys/Capybara.cs
+++ b/EXILED/Exiled.API/Features/Toys/Capybara.cs
@@ -46,6 +46,13 @@ public bool Collidable
set => Base.NetworkCollisionsEnabled = value;
}
+ ///
+ /// Converts CapybaraToy to Capybara.
+ ///
+ /// The CapybaraToy.
+ /// EXILED Capybara.
+ public static implicit operator Capybara(CapybaraToy capybaraToy) => (Capybara)Get(capybaraToy);
+
///
/// Creates a new at the specified position.
///
diff --git a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs
index 033c52faff..c12f282fc7 100644
--- a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs
+++ b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs
@@ -65,6 +65,13 @@ public bool IsLocked
set => Base.NetworkIsLocked = value;
}
+ ///
+ /// Converts InvisibleInteractableToy to InteractableToy.
+ ///
+ /// The InvisibleInteractableToy.
+ /// EXILED InteractableToy.
+ public static implicit operator InteractableToy(InvisibleInteractableToy invisibleInteractableToy) => (InteractableToy)Get(invisibleInteractableToy);
+
///
/// Creates a new .
///
diff --git a/EXILED/Exiled.API/Features/Toys/Light.cs b/EXILED/Exiled.API/Features/Toys/Light.cs
index e65387ba3e..b4d6d4d36e 100644
--- a/EXILED/Exiled.API/Features/Toys/Light.cs
+++ b/EXILED/Exiled.API/Features/Toys/Light.cs
@@ -8,7 +8,6 @@
namespace Exiled.API.Features.Toys
{
using System;
- using System.Linq;
using AdminToys;
@@ -127,6 +126,13 @@ public LightShadows ShadowType
set => Base.NetworkShadowType = value;
}
+ ///
+ /// Converts LightSourceToy to Light.
+ ///
+ /// The LightSourceToy.
+ /// EXILED Light.
+ public static implicit operator Light(LightSourceToy lightSourceToy) => (Light)Get(lightSourceToy);
+
///
/// Creates a new .
///
@@ -188,16 +194,5 @@ public static Light Create(Transform parent = null, Vector3? position = null, Qu
return toy;
}
-
- ///
- /// Gets the belonging to the .
- ///
- /// The instance.
- /// The corresponding instance.
- public static Light Get(LightSourceToy lightSourceToy)
- {
- AdminToy adminToy = List.FirstOrDefault(x => x.AdminToyBase == lightSourceToy);
- return adminToy is not null ? adminToy as Light : new(lightSourceToy);
- }
}
}
\ No newline at end of file
diff --git a/EXILED/Exiled.API/Features/Toys/Primitive.cs b/EXILED/Exiled.API/Features/Toys/Primitive.cs
index 984c248a63..56a67256f8 100644
--- a/EXILED/Exiled.API/Features/Toys/Primitive.cs
+++ b/EXILED/Exiled.API/Features/Toys/Primitive.cs
@@ -7,8 +7,6 @@
namespace Exiled.API.Features.Toys
{
- using System.Linq;
-
using AdminToys;
using Enums;
@@ -87,6 +85,13 @@ public PrimitiveFlags Flags
set => Base.NetworkPrimitiveFlags = value;
}
+ ///
+ /// Converts PrimitiveObjectToy to Primitive.
+ ///
+ /// The PrimitiveObjectToy.
+ /// EXILED Primitive.
+ public static implicit operator Primitive(PrimitiveObjectToy primitiveObjectToy) => (Primitive)Get(primitiveObjectToy);
+
///
/// Creates a new .
///
@@ -148,16 +153,5 @@ public static Primitive Create(PrimitiveSettings primitiveSettings)
return toy;
}
-
- ///
- /// Gets the belonging to the .
- ///
- /// The instance.
- /// The corresponding instance.
- public static Primitive Get(PrimitiveObjectToy primitiveObjectToy)
- {
- AdminToy adminToy = List.FirstOrDefault(x => x.AdminToyBase == primitiveObjectToy);
- return adminToy is not null ? adminToy as Primitive : new(primitiveObjectToy);
- }
}
}
\ No newline at end of file
diff --git a/EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs b/EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs
index 7fd2cc6391..2e3f983308 100644
--- a/EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs
+++ b/EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs
@@ -9,7 +9,6 @@ namespace Exiled.API.Features.Toys
{
using System;
using System.Collections.Generic;
- using System.Linq;
using Enums;
@@ -146,6 +145,13 @@ public bool IsSynced
///
public ShootingTargetType Type { get; }
+ ///
+ /// Converts ShootingTarget to ShootingTargetToy.
+ ///
+ /// The ShootingTarget.
+ /// EXILED ShootingTargetToy.
+ public static implicit operator ShootingTargetToy(ShootingTarget shootingTarget) => (ShootingTargetToy)Get(shootingTarget);
+
///
/// Creates a new .
///
@@ -186,20 +192,6 @@ public static ShootingTargetToy Create(Transform parent = null, Vector3? positio
return toy;
}
- ///
- /// Gets the belonging to the .
- ///
- /// The instance.
- /// The corresponding instance.
- public static ShootingTargetToy Get(ShootingTarget shootingTarget)
- {
- if (shootingTarget == null)
- return null;
-
- AdminToy adminToy = List.FirstOrDefault(x => x.AdminToyBase == shootingTarget);
- return adminToy is not null ? adminToy as ShootingTargetToy : new(shootingTarget);
- }
-
///
/// Clears the target and resets its health.
///
diff --git a/EXILED/Exiled.API/Features/Toys/Speaker.cs b/EXILED/Exiled.API/Features/Toys/Speaker.cs
index 5edb538af2..d86822defe 100644
--- a/EXILED/Exiled.API/Features/Toys/Speaker.cs
+++ b/EXILED/Exiled.API/Features/Toys/Speaker.cs
@@ -419,6 +419,13 @@ public byte ControllerId
}
}
+ ///
+ /// Converts SpeakerToy to Speaker.
+ ///
+ /// The SpeakerToy.
+ /// EXILED Speaker.
+ public static implicit operator Speaker(SpeakerToy speakerToy) => (Speaker)Get(speakerToy);
+
///
/// Creates a new .
///
diff --git a/EXILED/Exiled.API/Features/Toys/Text.cs b/EXILED/Exiled.API/Features/Toys/Text.cs
index 2ff586952d..ef3ca0eb9b 100644
--- a/EXILED/Exiled.API/Features/Toys/Text.cs
+++ b/EXILED/Exiled.API/Features/Toys/Text.cs
@@ -54,6 +54,13 @@ public Vector2 DisplaySize
set => Base.Network_displaySize = value;
}
+ ///
+ /// Converts TextToy to Text.
+ ///
+ /// The TextToy.
+ /// EXILED Text.
+ public static implicit operator Text(TextToy textToy) => (Text)Get(textToy);
+
///
/// Creates a new .
///
diff --git a/EXILED/Exiled.API/Features/Toys/Waypoint.cs b/EXILED/Exiled.API/Features/Toys/Waypoint.cs
index ce5def9898..f6631e34c3 100644
--- a/EXILED/Exiled.API/Features/Toys/Waypoint.cs
+++ b/EXILED/Exiled.API/Features/Toys/Waypoint.cs
@@ -81,6 +81,13 @@ public Vector3 BoundsSize
///
public byte WaypointId => Base._waypointId;
+ ///
+ /// Converts WaypointToy to Waypoint.
+ ///
+ /// The WaypointToy.
+ /// EXILED Waypoint.
+ public static implicit operator Waypoint(WaypointToy waypointToy) => (Waypoint)Get(waypointToy);
+
///
/// Creates a new .
///
diff --git a/EXILED/Exiled.API/Features/Window.cs b/EXILED/Exiled.API/Features/Window.cs
index a1f92bc26f..2ba7bd3e0d 100644
--- a/EXILED/Exiled.API/Features/Window.cs
+++ b/EXILED/Exiled.API/Features/Window.cs
@@ -151,12 +151,19 @@ public Player LastAttacker
set => Base.LastAttacker = value.Footprint;
}
+ ///
+ /// Converts BreakableWindow to Window.
+ ///
+ /// The BreakableWindow.
+ /// EXILED Window.
+ public static implicit operator Window(BreakableWindow breakableWindow) => Get(breakableWindow);
+
///
/// Gets the window object associated with a specific , or creates a new one if there isn't one.
///
/// The base-game .
/// A wrapper object.
- public static Window Get(BreakableWindow breakableWindow) => BreakableWindowToWindow.TryGetValue(breakableWindow, out Window window)
+ public static Window Get(BreakableWindow breakableWindow) => breakableWindow == null ? null : BreakableWindowToWindow.TryGetValue(breakableWindow, out Window window)
? window
: new(breakableWindow, breakableWindow.GetComponentInParent());
diff --git a/EXILED/Exiled.API/Features/Workstation.cs b/EXILED/Exiled.API/Features/Workstation.cs
index 2bc63e1e5e..edf2d290de 100644
--- a/EXILED/Exiled.API/Features/Workstation.cs
+++ b/EXILED/Exiled.API/Features/Workstation.cs
@@ -127,12 +127,19 @@ public Player KnownUser
set => Base.KnownUser = value.ReferenceHub;
}
+ ///
+ /// Converts WorkstationController to Workstation.
+ ///
+ /// The WorkstationController.
+ /// EXILED Workstation.
+ public static implicit operator Workstation(WorkstationController workstationController) => Get(workstationController);
+
///
/// Gets a given a instance.
///
/// The instance.
/// The instance.
- public static Workstation Get(WorkstationController workstationController) => WorkstationControllerToWorkstation.TryGetValue(workstationController, out Workstation workstation) ? workstation : new(workstationController);
+ public static Workstation Get(WorkstationController workstationController) => workstationController == null ? null : WorkstationControllerToWorkstation.TryGetValue(workstationController, out Workstation workstation) ? workstation : new(workstationController);
///
/// Gets all instances that match the specified predicate.
diff --git a/EXILED/Exiled.Events/EventArgs/Player/DamagingShootingTargetEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/DamagingShootingTargetEventArgs.cs
index 891e669d57..f625e99dd9 100644
--- a/EXILED/Exiled.Events/EventArgs/Player/DamagingShootingTargetEventArgs.cs
+++ b/EXILED/Exiled.Events/EventArgs/Player/DamagingShootingTargetEventArgs.cs
@@ -53,7 +53,7 @@ public DamagingShootingTargetEventArgs(Player player, float damage, float distan
Player = player;
Amount = damage;
Distance = distance;
- ShootingTarget = ShootingTargetToy.Get(shootingTarget);
+ ShootingTarget = shootingTarget;
Item = player?.CurrentItem;
DamageHandler = damageHandler as AttackerDamageHandler;
HitLocation = hitLocation;
diff --git a/EXILED/Exiled.Events/EventArgs/Player/InteractingShootingTargetEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/InteractingShootingTargetEventArgs.cs
index c27974716c..79baafd857 100644
--- a/EXILED/Exiled.Events/EventArgs/Player/InteractingShootingTargetEventArgs.cs
+++ b/EXILED/Exiled.Events/EventArgs/Player/InteractingShootingTargetEventArgs.cs
@@ -46,7 +46,7 @@ public class InteractingShootingTargetEventArgs : IPlayerEvent, IDeniableEvent
public InteractingShootingTargetEventArgs(Player player, ShootingTarget shootingTarget, ShootingTargetButton targetButton, int maxHp, int autoResetTime, bool isAllowed = true)
{
Player = player;
- ShootingTarget = ShootingTargetToy.Get(shootingTarget);
+ ShootingTarget = shootingTarget;
TargetButton = targetButton;
IsAllowed = isAllowed;
NewMaxHp = maxHp;