Skip to content

更新:宵禁v2.2.0 加入指令功能与权限检查#219

Merged
Controllerdestiny merged 8 commits intoUnrealMultiple:masterfrom
1242509682:master
Jun 18, 2024
Merged

更新:宵禁v2.2.0 加入指令功能与权限检查#219
Controllerdestiny merged 8 commits intoUnrealMultiple:masterfrom
1242509682:master

Conversation

@1242509682
Copy link
Copy Markdown
Contributor

No description provided.

@Controllerdestiny
Copy link
Copy Markdown
Contributor

还是存在bug吗

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的方法应该挪到Config类里

#region 修改豁免名单方法
if (args.Parameters.Count >= 3 && (args.Parameters[0].ToLower() == "hm"))
{
switch (args.Parameters[2])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

args.Parameters[1]
顺便ToLower一下

case "update":
{
string text = args.Parameters[3];
if (text != null && Goodnight.Config.Add(text))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用string.IsEmptyOrNull

}
case "clear":
{
string text = args.Parameters[3];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同理

}
case "clear":
{
string text = args.Parameters[3];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是[2]吧

{
case "update":
{
string text = args.Parameters[3];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该是[2]

if (args.Parameters.Count == 2)
{
NPC npc;
List<NPC> matchedNPCs = TShock.Utils.GetNPCByIdOrName(args.Parameters[1]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该加个判断是否list为长度0

#region 设置宵禁时间
if (args.Parameters.Count == 3 && args.Parameters[0].ToLower() == "time")
{
if (!TimeSpan.TryParseExact(args.Parameters[2], "hh\\:mm\\:ss", CultureInfo.InvariantCulture, out TimeSpan SetTime))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我不知道指令咋设计的但这里是不是应该args.Paramters[1]来着,你验证一下看看


| 语法 | 别名 | 权限 | 说明 |
| -------------------------------- | :---: | :--------------: | :--------------------------------------: |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个列表貌似存在错误,无法正常显示

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个里面有个静态字段的保存配置路径了,所以保存文件和读取文件的方法是不是可以不用传值了,直接用字段就行了

@Controllerdestiny Controllerdestiny merged commit 8914ad6 into UnrealMultiple:master Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants