Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:修复白名单插件 #703

Merged
merged 4 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/AIChatPlugin/AIChatPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace AIChatPlugin;
public class AIChatPlugin : TerrariaPlugin
{
#region 插件信息
public override Version Version => new Version(2025, 1, 12);
public override Version Version => new Version(2025, 1, 13);
public override string Name => "AIChatPlugin";
public override string Description => GetString("一个提供AI对话的插件");
public override string Author => "忍";
Expand Down
2 changes: 1 addition & 1 deletion src/AdditionalPylons/AdditionalPylonsPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class AdditionalPylonsPlugin : LazyPlugin
{
#region Plugin Properties
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
public override Version Version => new Version(1, 0, 6);
public override Version Version => new Version(1, 0, 7);

public override string Author => "Stealownz,肝帝熙恩优化1449";

Expand Down
2 changes: 1 addition & 1 deletion src/AnnouncementBoxPlus/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class AnnouncementBoxPlus : LazyPlugin
//插件的名称
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
//插件的版本
public override Version Version => new Version(1, 0, 3);
public override Version Version => new Version(1, 0, 4);

//插件的构造器
public AnnouncementBoxPlus(Main game) : base(game)
Expand Down
2 changes: 1 addition & 1 deletion src/AutoAirItem/AutoAirItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class AutoAirItem : LazyPlugin
#region 插件信息
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
public override string Author => "羽学";
public override Version Version => new Version(1, 2, 6);
public override Version Version => new Version(1, 2, 7);
public override string Description => GetString("自动垃圾桶帮助玩家清理自身垃圾");
#endregion

Expand Down
2 changes: 1 addition & 1 deletion src/AutoBroadcast/AutoBroadcast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class AutoBroadcast : LazyPlugin
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
public override string Author => "Scavenger";
public override string Description => GetString("自动广播插件");
public override Version Version => new Version(1, 0, 9);
public override Version Version => new Version(1, 0, 10);

public DateTime LastCheck = DateTime.UtcNow;

Expand Down
2 changes: 1 addition & 1 deletion src/AutoClear/AutoClear.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Autoclear : LazyPlugin
{
public override string Author => "大豆子[Mute适配1447],肝帝熙恩更新";
public override string Description => GetString("智能扫地机");
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!; public override Version Version => new Version(1, 0, 7);
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!; public override Version Version => new Version(1, 0, 8);

private bool _sweepScheduled = false;
private DateTime _sweepScheduledAt;
Expand Down
2 changes: 1 addition & 1 deletion src/AutoFish/AutoFish.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class AutoFish : LazyPlugin

#region 插件信息
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!; public override string Author => "羽学 少司命";
public override Version Version => new Version(1, 3, 5);
public override Version Version => new Version(1, 3, 6);
public override string Description => GetString("自动钓鱼");
#endregion

Expand Down
2 changes: 1 addition & 1 deletion src/AutoPluginManager/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace AutoPluginManager;
public class Plugin : TerrariaPlugin
{
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
public override Version Version => new Version(2, 0, 3, 3);
public override Version Version => new Version(2, 0, 3, 4);

public override string Author => "少司命,Cai,LaoSparrow";

Expand Down
2 changes: 1 addition & 1 deletion src/AutoReset/AutoResetPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public AutoResetPlugin(Main game) : base(game)
}

public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
public override Version Version => new Version(2024, 12, 18, 2);
public override Version Version => new Version(2024, 12, 18, 3);

public override string Author => "cc04 & Leader & 棱镜 & Cai & 肝帝熙恩";

Expand Down
2 changes: 1 addition & 1 deletion src/AutoStoreItems/AutoStoreItems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class AutoStoreItems : LazyPlugin
#region 插件信息
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
public override string Author => "羽学 cmgy雱";
public override Version Version => new Version(1, 3, 4);
public override Version Version => new Version(1, 3, 5);
public override string Description => GetString("持有指定物品根据配置物品ID自动存入存储空间");
#endregion

Expand Down
2 changes: 1 addition & 1 deletion src/AutoTeam/AutoTeamPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace AutoTeam;
public class AutoTeam : LazyPlugin
{
public override string Author => "十七改,肝帝熙恩改";
public override Version Version => new Version(2, 4, 6);
public override Version Version => new Version(2, 4, 7);
public override string Description => GetString("自动分配一个组的玩家到特定队伍");
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
public AutoTeam(Main game) : base(game)
Expand Down
2 changes: 1 addition & 1 deletion src/Back/BackPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class BackPlugin : LazyPlugin

public override string Author => "Megghy,熙恩改";
public override string Description => GetString("允许玩家传送回死亡地点");
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!; public override Version Version => new Version(1, 0, 0, 8);
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!; public override Version Version => new Version(1, 0, 0, 9);

public BackPlugin(Main game) : base(game)
{
Expand Down
2 changes: 1 addition & 1 deletion src/BagPing/BagPing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class BagPing : TerrariaPlugin
public override string Description => GetString("在小地图上标记掉落的宝藏袋");

public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
public override Version Version => new Version(1, 0, 4);
public override Version Version => new Version(1, 0, 5);

public BagPing(Main game)
: base(game)
Expand Down
2 changes: 1 addition & 1 deletion src/BanNpc/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Plugin : LazyPlugin
public override string Description => GetString("禁止指定怪物的出没");

public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
public override Version Version => new Version(1, 0, 0, 5);
public override Version Version => new Version(1, 0, 0, 6);

public Plugin(Main game) : base(game)
{
Expand Down
2 changes: 1 addition & 1 deletion src/BedSet/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Plugin : LazyPlugin
{
public override string Author => "cmgy";
public override string Description => GetString("");
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!; public override Version Version => new Version(1, 0, 0, 5);
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!; public override Version Version => new Version(1, 0, 0, 6);
public Plugin(Main game) : base(game) { }

public override void Initialize()
Expand Down
2 changes: 1 addition & 1 deletion src/BetterWhitelist/BConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class BConfig : JsonConfigBase<BConfig>

[LocalizedPropertyName(CultureType.Chinese, "插件开关", Order = 0)]
[LocalizedPropertyName(CultureType.English, "Enable", Order = 0)]
public bool Disabled { get; set; }
public bool Enable { get; set; }

[LocalizedPropertyName(CultureType.Chinese, "连接时不在白名单提示", Order = 1)]
[LocalizedPropertyName(CultureType.English, "NotInWhiteList", Order = 1)]
Expand Down
52 changes: 33 additions & 19 deletions src/BetterWhitelist/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,40 @@ namespace BetterWhitelist;
[ApiVersion(2, 1)]
public class BetterWhitelist : LazyPlugin
{
public BetterWhitelist(Main game) : base(game)
{
}

public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
public override Version Version => new(2, 6, 1);
public override Version Version => new Version(2, 6, 3);

public override string Author => "豆沙,肝帝熙恩、Cai修改";

public override string Description => GetString("通过检查玩家姓名的玩家白名单");

public BetterWhitelist(Main game) : base(game)
{
}
public override void Initialize()
{
ServerApi.Hooks.ServerJoin.Register(this, this.OnJoin);
Commands.ChatCommands.Add(new Command("bwl.use", this.BetterWhitelistCommand, "bwl"));
}

private void OnJoin(JoinEventArgs args)
{
var player = TShock.Players[args.Who];

if (BConfig.Instance.Enable && !BConfig.Instance.WhitePlayers.Contains(player.Name))
{
player.Disconnect(BConfig.Instance.NotInWhiteList);
}
else if (!BConfig.Instance.Enable)
{
TShock.Log.ConsoleInfo("[BetterWhitelist] 开关已被禁用,请检查配置文件!");
}
}

protected override void Dispose(bool disposing)
{
if (disposing)
{
ServerApi.Hooks.ServerJoin.Deregister(this, this.OnJoin);
Commands.ChatCommands.RemoveAll(c => c.CommandDelegate == this.BetterWhitelistCommand);
}

Expand All @@ -52,8 +67,7 @@ private void BetterWhitelistCommand(CommandArgs args)
GetString("/bwl del {name}, 将玩家移出白名单\n") +
GetString("/bwl list, 显示白名单上的全部玩家\n") +
GetString("/bwl true, 启用插件\n") +
GetString("/bwl false, 关闭插件\n") +
GetString("/bwl reload, 重载插件"));
GetString("/bwl false, 关闭插件\n"));
break;

case "list":
Expand All @@ -65,28 +79,28 @@ private void BetterWhitelistCommand(CommandArgs args)
break;

case "false":
if (BConfig.Instance.Disabled)
if (!BConfig.Instance.Enable)
{
args.Player.SendErrorMessage(GetString("禁用失败! 插件已是关闭状态"));
args.Player.SendErrorMessage(GetString("[BetterWhitelist] 插件已是关闭状态"));
}
else
{
BConfig.Instance.Disabled = true;
args.Player.SendSuccessMessage(GetString("禁用成功!"));
BConfig.Instance.Enable = false;
args.Player.SendSuccessMessage(GetString("[BetterWhitelist] 白名单禁用成功!"));
BConfig.Save();
}

break;

case "true":
if (!BConfig.Instance.Disabled)
if (BConfig.Instance.Enable)
{
args.Player.SendErrorMessage(GetString("启用失败! 插件已是打开状态"));
args.Player.SendErrorMessage(GetString("[BetterWhitelist] 白名单已是打开状态"));
}
else
{
BConfig.Instance.Disabled = false;
args.Player.SendSuccessMessage(GetString("启用成功!"));
BConfig.Instance.Enable = true;
args.Player.SendSuccessMessage(GetString("[BetterWhitelist] 白名单启用成功!"));
foreach (var tsPlayer in TShock.Players.Where(p =>
p != null && !BConfig.Instance.WhitePlayers.Contains(p.Name)))
{
Expand All @@ -99,9 +113,9 @@ private void BetterWhitelistCommand(CommandArgs args)
break;

case "add":
if (BConfig.Instance.Disabled)
if (!BConfig.Instance.Enable)
{
args.Player.SendErrorMessage(GetString("插件开关已被禁用,请检查配置文件!"));
args.Player.SendErrorMessage(GetString("[BetterWhitelist] 开关已被禁用,请检查配置文件!"));
}
else
{
Expand All @@ -127,7 +141,7 @@ private void BetterWhitelistCommand(CommandArgs args)

break;
case "del":
if (BConfig.Instance.Disabled)
if (!BConfig.Instance.Enable)
{
args.Player.SendErrorMessage(GetString("插件开关已被禁用,请检查配置文件!"));
}
Expand Down
1 change: 0 additions & 1 deletion src/BetterWhitelist/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
| `/bwl list` | `bwl.use` | Show all players on the whitelist |
| `/bwl true` | `bwl.use` | Enable the plugin |
| `/bwl false` | `bwl.use` | Disable the plugin |
| `/bwl reload` | `bwl.use` | Reload the plugin |

## Config
> Configuration file location:tshock/BetterWhitelist.en-US.json
Expand Down
3 changes: 2 additions & 1 deletion src/BetterWhitelist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
| `/bwl list` | `bwl.use` | 显示白名单上的全部玩家 |
| `/bwl true` | `bwl.use` | 启用插件 |
| `/bwl false` | `bwl.use` | 关闭插件 |
| `/bwl reload` | `bwl.use` | 重载插件 |

## 配置

Expand All @@ -31,6 +30,8 @@
## 更新日志

```
v2.6.2
修复本插件根本无效的bug
v2.6.1
准备更新TS 5.2.1,修正文档,初始配置内容更改
v2.6
Expand Down
2 changes: 1 addition & 1 deletion src/BridgeBuilder/BridgeBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace BridgeBuilder;
[ApiVersion(2, 1)]
public class BridgeBuilder : LazyPlugin
{
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!; public override Version Version => new Version(1, 1, 2);
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!; public override Version Version => new Version(1, 1, 3);
public override string Author => "Soofa,肝帝熙恩汉化1449";
public override string Description => GetString("铺桥!");

Expand Down
2 changes: 1 addition & 1 deletion src/BuildMaster/MainPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace MainPlugin;
public class MainPlugin : TerrariaPlugin
{
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
public override Version Version => new Version(1, 0, 5);
public override Version Version => new Version(1, 0, 6);

public override string Author => "豆沙 羽学,肝帝熙恩适配";

Expand Down
2 changes: 1 addition & 1 deletion src/CGive/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Main : TerrariaPlugin
public override string Description => GetString("离线give");

public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
public override Version Version => new Version(1, 0, 0, 6);
public override Version Version => new Version(1, 0, 0, 7);

public Main(Terraria.Main game)
: base(game)
Expand Down
2 changes: 1 addition & 1 deletion src/CNPCShop/CNSPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace CNPCShop;
public class CNSPlugin : TerrariaPlugin
{
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!; public override string Author => "Megghy,肝帝熙恩更新1449";
public override Version Version => new Version(1, 0, 3);
public override Version Version => new Version(1, 0, 4);
public override string Description => GetString("自定义NPC商店出售的物品");
public CNSPlugin(Main game) : base(game) { }
public static List<CNSConfig.Shop> AviliableShops { get; internal set; } = new List<CNSConfig.Shop>();
Expand Down
2 changes: 1 addition & 1 deletion src/CaiBot/EconomicSupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static void Init()
break;
}

if (pluginContainer.Plugin.Version < new Version(2, 0, 0, 0))
if (pluginContainer.Plugin.Version < new Version(2, 0, 0, 3))
{
var currencyNameField = settingProperty.PropertyType.GetField("CurrencyName");
if (currencyNameField is null)
Expand Down
2 changes: 1 addition & 1 deletion src/CaiCustomEmojiCommand/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public CaiCustomEmojiCommand(Main game) : base(game)

public override string Author => "Cai";
public override string Description => GetString("自定义Emoji表情执行命令");
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!; public override Version Version => new Version(2024, 12, 18, 2);
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!; public override Version Version => new Version(2024, 12, 18, 3);


public override void Initialize()
Expand Down
2 changes: 1 addition & 1 deletion src/CaiLib/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Plugin : TerrariaPlugin
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
public override string Description => Assembly.GetExecutingAssembly().GetName().Name!;

public override Version Version => new Version(2024, 12, 18, 3);
public override Version Version => new Version(2024, 12, 18, 4);

public Plugin(Main game) : base(game)
{
Expand Down
2 changes: 1 addition & 1 deletion src/CaiPacketDebug/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public CaiPacketDebug(Main game) : base(game)

public override string Author => "Cai";
public override string Description => GetString("用于调试数据包的插件捏~");
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!; public override Version Version => new Version(2024, 12, 18, 1);
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!; public override Version Version => new Version(2024, 12, 18, 2);


public override void Initialize()
Expand Down
2 changes: 1 addition & 1 deletion src/CaiRewardChest/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public CaiRewardChest(Main game)
public override string Description => GetString("奖励箱!!");

public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
public override Version Version => new Version(2024, 12, 18, 2);
public override Version Version => new Version(2024, 12, 18, 3);


public override void Initialize()
Expand Down
2 changes: 1 addition & 1 deletion src/Challenger/Challenger/Challenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class Challenger : TerrariaPlugin
public override string Description => GetString("增强游戏难度,更好的游戏体验");

public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
public override Version Version => new Version(1, 0, 1, 8);
public override Version Version => new Version(1, 0, 1, 9);

public Challenger(Main game)
: base(game)
Expand Down
2 changes: 1 addition & 1 deletion src/Chameleon/Chameleon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class Chameleon : LazyPlugin

public override string Description => GetString("账户系统交互替换方案");

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


public Chameleon(Main game) : base(game)
Expand Down
2 changes: 1 addition & 1 deletion src/ChattyBridge/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class Plugin : LazyPlugin
public override string Author => "少司命";
public override string Description => Assembly.GetExecutingAssembly().GetName().Name!;
public override string Name => Assembly.GetExecutingAssembly().GetName().Name!;
public override Version Version => new (1, 0, 1, 1);
public override Version Version => new Version(1, 0, 1, 2);

private readonly HttpClient _client = new ();

Expand Down
Loading
Loading