Skip to content

Commit

Permalink
Merge pull request #582 from UnrealMultiple/iiiiiiac
Browse files Browse the repository at this point in the history
更新(ZHIPM): 修改zban的默认理由,和封禁用户名
  • Loading branch information
ACaiCat authored Nov 23, 2024
2 parents d5ab772 + a3abbe3 commit f0594cf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/ZHIPlayerManager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
## 更新日志

```
v.1.0.0.9
修改zban的默认理由,和封禁用户名
v.1.0.0.8
fix:允许非SSC使用
v.1.0.0.6
Expand Down
22 changes: 11 additions & 11 deletions src/ZHIPlayerManager/ZHIPM.Initialize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3700,7 +3700,7 @@ private void SuperBan(CommandArgs args)
return;
}

var reason = args.Parameters.Count == 4 ? args.Parameters[3] : GetString("检测到违规行为,请联系管理员");
var reason = args.Parameters.Count == 4 ? args.Parameters[3] : GetString("你已被管理员封禁!");
TSPlayer? suspect = null;
foreach (var v in TShock.Players)
{
Expand All @@ -3711,14 +3711,14 @@ private void SuperBan(CommandArgs args)
}
}

if (suspect != null && suspect.Ban(reason, "ZHIPlayerManager by " + args.Player.Name))
if (suspect != null && suspect.Ban(reason, args.Player.Name))
{
args.Player.SendMessage(GetString($"用户 {suspect.Name} 已被 {args.Player.Name} 封禁"), broadcastColor);
TShock.Log.Info(GetString($"用户 {suspect.Name} 已被 {args.Player.Name} 封禁"));
}
else
{
TShock.Bans.InsertBan("uuid:" + args.Parameters[2], reason, "ZHIPlayerManager by " + args.Player.Name, DateTime.UtcNow, DateTime.MaxValue);
TShock.Bans.InsertBan("uuid:" + args.Parameters[2], reason, args.Player.Name, DateTime.UtcNow, DateTime.MaxValue);
TSPlayer.All.SendMessage(GetString($"uuid: {args.Parameters[2]} 已被 {args.Player.Name} 封禁"), broadcastColor);
TShock.Log.Info(GetString($"uuid: {args.Parameters[2]} 已被 {args.Player.Name} 封禁"));
}
Expand All @@ -3731,7 +3731,7 @@ private void SuperBan(CommandArgs args)
return;
}

var reason = args.Parameters.Count == 4 ? args.Parameters[3] : GetString("检测到违规行为,请联系管理员");
var reason = args.Parameters.Count == 4 ? args.Parameters[3] : GetString("你已被管理员封禁!");
TSPlayer? suspect = null;
foreach (var v in TShock.Players)
{
Expand All @@ -3742,14 +3742,14 @@ private void SuperBan(CommandArgs args)
}
}

if (suspect != null && suspect.Ban(reason, "ZHIPlayerManager by " + args.Player.Name))
if (suspect != null && suspect.Ban(reason, args.Player.Name))
{
args.Player.SendMessage(GetString($"用户 {suspect.Name} 已被 {args.Player.Name} 封禁"), broadcastColor);
TShock.Log.Info(GetString($"用户 {suspect.Name} 已被 {args.Player.Name} 封禁"));
}
else
{
TShock.Bans.InsertBan("ip:" + args.Parameters[2], reason, "ZHIPlayerManager by " + args.Player.Name, DateTime.UtcNow, DateTime.MaxValue);
TShock.Bans.InsertBan("ip:" + args.Parameters[2], reason, args.Player.Name, DateTime.UtcNow, DateTime.MaxValue);
TSPlayer.All.SendMessage(GetString($"ip: {args.Parameters[2]} 已被 {args.Player.Name} 封禁"), broadcastColor);
TShock.Log.Info(GetString($"ip: {args.Parameters[2]} 已被 {args.Player.Name} 封禁"));
}
Expand All @@ -3758,10 +3758,10 @@ private void SuperBan(CommandArgs args)
{
var list = this.BestFindPlayerByNameOrIndex(args.Parameters[1]);
//封禁原因,可不填
var reason = args.Parameters.Count == 3 ? args.Parameters[2] : "检测到违规行为,请联系管理员";
var reason = args.Parameters.Count == 3 ? args.Parameters[2] : "你已被管理员封禁!";
if (list.Count == 1)
{
if (list[0].Ban(reason, "ZHIPlayerManager by " + args.Player.Name))
if (list[0].Ban(reason, args.Player.Name))
{
args.Player.SendMessage(GetString($"用户 {list[0].Name} 已被 {args.Player.Name} 封禁"), broadcastColor);
TShock.Log.Info(GetString($"用户 {list[0].Name} 已被 {args.Player.Name} 封禁"));
Expand Down Expand Up @@ -3804,12 +3804,12 @@ private void SuperBan(CommandArgs args)

if (!string.IsNullOrWhiteSpace(user.Name))
{
TShock.Bans.InsertBan("acc:" + user.Name, reason, "ZHIPlayerManager by " + args.Player.Name, DateTime.UtcNow, DateTime.MaxValue);
TShock.Bans.InsertBan("acc:" + user.Name, reason, args.Player.Name, DateTime.UtcNow, DateTime.MaxValue);
}

if (!string.IsNullOrWhiteSpace(user.UUID))
{
TShock.Bans.InsertBan("uuid:" + user.UUID, reason, "ZHIPlayerManager by " + args.Player.Name, DateTime.UtcNow, DateTime.MaxValue);
TShock.Bans.InsertBan("uuid:" + user.UUID, reason, args.Player.Name, DateTime.UtcNow, DateTime.MaxValue);
}

if (!string.IsNullOrWhiteSpace(user.KnownIps))
Expand All @@ -3819,7 +3819,7 @@ private void SuperBan(CommandArgs args)
{
if (!string.IsNullOrWhiteSpace(str))
{
TShock.Bans.InsertBan("ip:" + str, reason, "ZHIPlayerManager by " + args.Player.Name, DateTime.UtcNow, DateTime.MaxValue);
TShock.Bans.InsertBan("ip:" + str, reason, args.Player.Name, DateTime.UtcNow, DateTime.MaxValue);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ZHIPlayerManager/ZHIPM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public partial class ZHIPM : TerrariaPlugin

public override string Name => "ZHIPlayerManager";

public override Version Version => new Version(1, 0, 0, 8);
public override Version Version => new Version(1, 0, 0, 9);

#region 字段或属性
/// <summary>
Expand Down
5 changes: 5 additions & 0 deletions src/ZHIPlayerManager/i18n/template.pot
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,11 @@ msgstr ""
msgid "已打包为{0}/Zhipm/{1}.zip"
msgstr ""


#: ..\..\ZHIPM.Initialize.cs:3703
#: ..\..\ZHIPM.Initialize.cs:3734
msgid "你已被管理员封禁!"

#: ../../ZHIPM.Initialize.cs:2483
msgid "已清理所有射弹,物品,无用NPC"
msgstr ""
Expand Down

0 comments on commit f0594cf

Please sign in to comment.