This repository was archived by the owner on Jul 9, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLoadRoundCommand.cs
More file actions
45 lines (38 loc) · 1.32 KB
/
Copy pathLoadRoundCommand.cs
File metadata and controls
45 lines (38 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using CommandSystem;
using RemoteAdmin;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PluginAPI.Helpers;
using PluginAPI.Core;
using Utf8Json;
namespace NWAPIBulletHoleVisualizer
{
[CommandHandler(typeof(RemoteAdminCommandHandler))]
public class LoadRoundCommand : ICommand
{
public string Command { get; } = "bvloadround";
public string[] Aliases { get; } = new string[] { "bvlr" };
public string Description { get; } = "Load a previous round's bullets for visualization.";
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
{
string path = Path.Combine(Plugin.PluginHandler.PluginDirectoryPath, "rounds", arguments.ElementAt(0) + ".json");
if (!File.Exists(path))
{
response = "Round not found";
return false;
}
string json = File.ReadAllText(path);
Utils.Clear();
PostData postData = JsonSerializer.Deserialize<PostData>(json);
Utils.SetBullets(postData.Bullets);
Utils.LoadedRound = true;
Utils.RegenMap(postData.Seed);
response = "Loaded.";
return true;
}
}
}