feat: Entity.OnEvent now support resubscribing
This commit is contained in:
@@ -179,8 +179,10 @@ namespace Ragon.Client
|
|||||||
|
|
||||||
if (_events.ContainsKey(eventCode))
|
if (_events.ContainsKey(eventCode))
|
||||||
{
|
{
|
||||||
RagonLog.Warn($"Event already {eventCode} subscribed");
|
_events.Remove(eventCode);
|
||||||
return;
|
_localEvents.Remove(eventCode);
|
||||||
|
|
||||||
|
RagonLog.Warn($"Event already {eventCode} subscribed, removed old one!");
|
||||||
}
|
}
|
||||||
|
|
||||||
_localEvents.Add(eventCode, (player, eventData) => { callback.Invoke(player, (TEvent) eventData); });
|
_localEvents.Add(eventCode, (player, eventData) => { callback.Invoke(player, (TEvent) eventData); });
|
||||||
|
|||||||
Reference in New Issue
Block a user