-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from BPEssentials/DeleteEvent
Create OnTryDelete.cs
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Text.RegularExpressions; | ||
using BrokeProtocol.API; | ||
using BrokeProtocol.LiteDB; | ||
using BrokeProtocol.Managers; | ||
using BrokeProtocol.Utility; | ||
|
||
namespace BPEssentials.Events | ||
{ | ||
public class OnDelete : IScript | ||
{ | ||
[Target(GameSourceEvent.ManagerTryDelete, ExecutionMode.PreEvent)] | ||
public bool OnTryDelete(ConnectData connectionData) | ||
{ | ||
if (SvManager.Instance.TryGetUserData(connectionData.username, out User user) && Core.Instance.Settings.General.DisableAccountOverwrite) | ||
{ | ||
SvManager.Instance.RegisterFail(connectionData.connection, "This name has already been registered and this server has disabled overwriting accounts!"); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
} |
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