File tree Expand file tree Collapse file tree 3 files changed +61
-2
lines changed Expand file tree Collapse file tree 3 files changed +61
-2
lines changed Original file line number Diff line number Diff line change
1
+ // -----------------------------------------------------------------------
2
+ // <copyright file="RespawnedTeamEventArgs.cs" company="Exiled Team">
3
+ // Copyright (c) Exiled Team. All rights reserved.
4
+ // Licensed under the CC BY-SA 3.0 license.
5
+ // </copyright>
6
+ // -----------------------------------------------------------------------
7
+
8
+ namespace Exiled . Events . EventArgs . Server
9
+ {
10
+ using System . Collections . Generic ;
11
+ using System . Linq ;
12
+
13
+ using Exiled . API . Features ;
14
+ using Exiled . Events . EventArgs . Interfaces ;
15
+ using Respawning ;
16
+
17
+ /// <summary>
18
+ /// Contains all information after team spawns.
19
+ /// </summary>
20
+ public class RespawnedTeamEventArgs : IExiledEvent
21
+ {
22
+ /// <summary>
23
+ /// Initializes a new instance of the <see cref="RespawnedTeamEventArgs"/> class.
24
+ /// </summary>
25
+ /// <param name="hubs"><inheritdoc cref="Players"/></param>
26
+ /// <param name="team"><inheritdoc cref="Team"/></param>
27
+ public RespawnedTeamEventArgs ( SpawnableTeamType team , IEnumerable < ReferenceHub > hubs )
28
+ {
29
+ Players = hubs . Select ( Player . Get ) ;
30
+ Team = team ;
31
+ }
32
+
33
+ /// <summary>
34
+ /// Gets the list of spawned players.
35
+ /// </summary>
36
+ public IEnumerable < Player > Players { get ; }
37
+
38
+ /// <summary>
39
+ /// Gets the spawned team.
40
+ /// </summary>
41
+ public SpawnableTeamType Team { get ; }
42
+ }
43
+ }
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ namespace Exiled.Events
21
21
using PlayerRoles . Ragdolls ;
22
22
using PlayerRoles . RoleAssign ;
23
23
using PluginAPI . Events ;
24
+ using Respawning ;
24
25
using UnityEngine . SceneManagement ;
25
26
26
27
/// <summary>
@@ -70,7 +71,7 @@ public override void OnEnabled()
70
71
Handlers . Map . ChangedIntoGrenade += Handlers . Internal . ExplodingGrenade . OnChangedIntoGrenade ;
71
72
72
73
CharacterClassManager . OnRoundStarted += Handlers . Server . OnRoundStarted ;
73
-
74
+ RespawnManager . ServerOnRespawned += Handlers . Server . OnRespawnedTeam ;
74
75
InventorySystem . InventoryExtensions . OnItemAdded += Handlers . Player . OnItemAdded ;
75
76
InventorySystem . InventoryExtensions . OnItemRemoved += Handlers . Player . OnItemRemoved ;
76
77
@@ -105,7 +106,7 @@ public override void OnDisabled()
105
106
106
107
InventorySystem . InventoryExtensions . OnItemAdded -= Handlers . Player . OnItemAdded ;
107
108
InventorySystem . InventoryExtensions . OnItemRemoved -= Handlers . Player . OnItemRemoved ;
108
-
109
+ RespawnManager . ServerOnRespawned -= Handlers . Server . OnRespawnedTeam ;
109
110
RagdollManager . OnRagdollSpawned -= Handlers . Internal . RagdollList . OnSpawnedRagdoll ;
110
111
RagdollManager . OnRagdollRemoved -= Handlers . Internal . RagdollList . OnRemovedRagdoll ;
111
112
ItemPickupBase . OnPickupAdded -= Handlers . Internal . PickupEvent . OnSpawnedPickup ;
Original file line number Diff line number Diff line change 7
7
8
8
namespace Exiled . Events . Handlers
9
9
{
10
+ using System . Collections . Generic ;
11
+
12
+ using Respawning ;
10
13
#pragma warning disable SA1623 // Property summary documentation should match accessors
11
14
12
15
using Exiled . Events . EventArgs . Player ;
@@ -53,6 +56,11 @@ public static class Server
53
56
/// </summary>
54
57
public static Event < RespawningTeamEventArgs > RespawningTeam { get ; set ; } = new ( ) ;
55
58
59
+ /// <summary>
60
+ /// Invoked after team spawns.
61
+ /// </summary>
62
+ public static Event < RespawnedTeamEventArgs > RespawnedTeam { get ; set ; } = new ( ) ;
63
+
56
64
/// <summary>
57
65
/// Invoked before adding an unit name.
58
66
/// </summary>
@@ -142,6 +150,13 @@ public static class Server
142
150
/// <param name="ev">The <see cref="RespawningTeamEventArgs"/> instance.</param>
143
151
public static void OnRespawningTeam ( RespawningTeamEventArgs ev ) => RespawningTeam . InvokeSafely ( ev ) ;
144
152
153
+ /// <summary>
154
+ /// Called after team spawns.
155
+ /// </summary>
156
+ /// <param name="teamType"><inheritdoc cref="RespawnedTeamEventArgs.Team"/></param>
157
+ /// <param name="hubs"><inheritdoc cref="RespawnedTeamEventArgs.Players"/></param>
158
+ public static void OnRespawnedTeam ( SpawnableTeamType teamType , List < ReferenceHub > hubs ) => RespawnedTeam . InvokeSafely ( new RespawnedTeamEventArgs ( teamType , hubs ) ) ;
159
+
145
160
/// <summary>
146
161
/// Called before adding an unit name.
147
162
/// </summary>
You can’t perform that action at this time.
0 commit comments