Skip to content

Commit

Permalink
NoMoreRespawnOfCustomItem
Browse files Browse the repository at this point in the history
  • Loading branch information
louis1706 committed Jan 20, 2025
1 parent 806bab5 commit f87ffa7
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions EXILED/Exiled.CustomItems/API/Features/CustomItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace Exiled.CustomItems.API.Features
using Exiled.API.Features.Attributes;
using Exiled.API.Features.Pickups;
using Exiled.API.Features.Pools;
using Exiled.API.Features.Roles;
using Exiled.API.Features.Spawn;
using Exiled.API.Interfaces;
using Exiled.CustomItems.API.EventArgs;
Expand Down Expand Up @@ -1001,12 +1002,6 @@ private void OnInternalOwnerChangingRole(ChangingRoleEventArgs ev)
continue;

OnOwnerChangingRole(new OwnerChangingRoleEventArgs(item.Base, ev));

TrackedSerials.Remove(item.Serial);

ev.Player.RemoveItem(item);

Spawn(ev.Player, item, ev.Player);
}

MirrorExtensions.ResyncSyncVar(ev.Player.ReferenceHub.networkIdentity, typeof(NicknameSync), nameof(NicknameSync.Network_myNickSync));
Expand All @@ -1024,12 +1019,6 @@ private void OnInternalOwnerDying(DyingEventArgs ev)
if (!ev.IsAllowed)
continue;

ev.Player.RemoveItem(item);

TrackedSerials.Remove(item.Serial);

Spawn(ev.Player, item, ev.Player);

MirrorExtensions.ResyncSyncVar(ev.Player.ReferenceHub.networkIdentity, typeof(NicknameSync), nameof(NicknameSync.Network_myNickSync));
}

Expand All @@ -1048,12 +1037,6 @@ private void OnInternalOwnerEscaping(EscapingEventArgs ev)
if (!ev.IsAllowed)
continue;

ev.Player.RemoveItem(item);

TrackedSerials.Remove(item.Serial);

Timing.CallDelayed(1.5f, () => Spawn(ev.Player.Position, item, null));

MirrorExtensions.ResyncSyncVar(ev.Player.ReferenceHub.networkIdentity, typeof(NicknameSync), nameof(NicknameSync.Network_myNickSync));
}

Expand All @@ -1071,12 +1054,6 @@ private void OnInternalOwnerHandcuffing(HandcuffingEventArgs ev)

if (!ev.IsAllowed)
continue;

ev.Target.RemoveItem(item);

TrackedSerials.Remove(item.Serial);

Spawn(ev.Target, item, ev.Target);
}
}

Expand Down Expand Up @@ -1130,7 +1107,7 @@ private void OnInternalChanging(ChangingItemEventArgs ev)

if (ShouldMessageOnGban)
{
foreach (Player player in Player.Get(RoleTypeId.Spectator))
foreach (Player player in Player.Get(x => x.Role is SpectatorRole))
Timing.CallDelayed(0.5f, () => player.SendFakeSyncVar(ev.Player.ReferenceHub.networkIdentity, typeof(NicknameSync), nameof(NicknameSync.Network_displayName), $"{ev.Player.Nickname} (CustomItem: {Name})"));
}

Expand Down

0 comments on commit f87ffa7

Please sign in to comment.