Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
更新:宵禁 v2.2.0
  • Loading branch information
1242509682 committed Jun 18, 2024
commit ab3bec99f414bc7ead7ac2c389e9e0bb5865ecea
8 changes: 7 additions & 1 deletion GoodNight/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,19 @@ public static void GnCmd(CommandArgs args)
NPC npc;
List<NPC> matchedNPCs = TShock.Utils.GetNPCByIdOrName(args.Parameters[1]);

if (matchedNPCs.Count > 1 && matchedNPCs.Count != 0)
if (matchedNPCs.Count > 1)
{
args.Player.SendMultipleMatchError(matchedNPCs.Select(i => i.FullName));
return;
}
if (matchedNPCs.Count == 0)
{
args.Player.SendErrorMessage("不存在的NPC");
return;
}
else
{

npc = matchedNPCs[0];
}

Expand Down
4 changes: 2 additions & 2 deletions GoodNight/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void Write()
sw.Write(JsonConvert.SerializeObject(this, Formatting.Indented));
}

public static Configuration Read(string path)
public static Configuration Read()
{
if (!File.Exists(FilePath))
{
Expand All @@ -60,7 +60,7 @@ public static Configuration Read(string path)
}
else
{
using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
using (var fs = new FileStream(FilePath, FileMode.Open, FileAccess.Read, FileShare.Read))
using (var sr = new StreamReader(fs))
return JsonConvert.DeserializeObject<Configuration>(sr.ReadToEnd())!;
}
Expand Down
2 changes: 1 addition & 1 deletion GoodNight/Goodnight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected override void Dispose(bool disposing)
internal static void LoadConfig(ReloadEventArgs args = null!)
{
if (File.Exists(Configuration.FilePath))
Config = Configuration.Read(Configuration.FilePath);
Config = Configuration.Read();
else
{
Config.PlayersList = new() { "羽学" };
Expand Down