Skip to content

Commit 121a6ea

Browse files
committed
Create OnTryDelete.cs
1 parent 5baf120 commit 121a6ea

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.Text.RegularExpressions;
2+
using BrokeProtocol.API;
3+
using BrokeProtocol.LiteDB;
4+
using BrokeProtocol.Managers;
5+
using BrokeProtocol.Utility;
6+
7+
namespace BPEssentials.Events
8+
{
9+
public class OnDelete : IScript
10+
{
11+
[Target(GameSourceEvent.ManagerTryDelete, ExecutionMode.PreEvent)]
12+
public bool OnTryDelete(ConnectData connectionData)
13+
{
14+
if (SvManager.Instance.TryGetUserData(connectionData.username, out User user) && Core.Instance.Settings.General.DisableAccountOverwrite)
15+
{
16+
SvManager.Instance.RegisterFail(connectionData.connection, "This name has already been registered and this server has disabled overwriting accounts!");
17+
return false;
18+
}
19+
20+
return true;
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)