This repository has been archived by the owner on Jan 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
233 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,43 @@ | ||
using Synapse.Api.Events.SynapseEventArguments; | ||
using MEC; | ||
using Neuron.Core.Events; | ||
using Neuron.Core.Meta; | ||
using Synapse3.SynapseModule; | ||
using Synapse3.SynapseModule.Events; | ||
using System.Linq; | ||
using System.Text.RegularExpressions; | ||
using System.Xml.Linq; | ||
|
||
namespace RpName | ||
{ | ||
public class EventsHandler | ||
[Automatic] | ||
public class EventsHandler : Listener | ||
{ | ||
public EventsHandler() | ||
private readonly RpNamePlugin _plugin; | ||
|
||
public EventsHandler(RpNamePlugin plugin, PlayerEvents playerEvents) | ||
{ | ||
Synapse.Api.Events.EventHandler.Get.Player.PlayerSetClassEvent += OnSetClass; | ||
SynapseLogger<EventsHandler>.Info("EventsHandler"); | ||
_plugin = plugin; | ||
playerEvents.SetClass.Subscribe(OnSetClass); | ||
} | ||
|
||
private void OnSetClass(PlayerSetClassEventArgs ev) | ||
private void OnSetClass(SetClassEvent ev) | ||
{ | ||
if (PluginClass.Config.RoleName != null && PluginClass.Config.RoleName.Any()) | ||
Timing.CallDelayed(0.1f, () => | ||
{ | ||
var id = ev.Player.RoleID; | ||
if (_plugin.Config.RoleName != null && _plugin.Config.RoleName.Any()) | ||
{ | ||
var id = ev.Player.RoleID; | ||
|
||
var name = PluginClass.GetName(id, ev.Player.NickName); | ||
if (string.IsNullOrEmpty(name)) | ||
ev.Player.name = ev.Player.NickName; | ||
else | ||
ev.Player.name = name; | ||
} | ||
if (id == 56) | ||
id = (uint)ev.Player.RoleType; | ||
var name = _plugin.GetName(id, ev.Player.NickName); | ||
if (string.IsNullOrEmpty(name)) | ||
ev.Player.DisplayName = ev.Player.NickName; | ||
else | ||
ev.Player.DisplayName = name; | ||
} | ||
}); | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.