-
Notifications
You must be signed in to change notification settings - Fork 0
/
RemoteDataUtil.cs
30 lines (25 loc) · 994 Bytes
/
RemoteDataUtil.cs
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
using System;
using System.Threading.Tasks;
using Blish_HUD;
using Flurl.Http;
using Teh.BHUD.Blacklist_Buddy_Module.Models;
namespace Teh.BHUD.Blacklist_Buddy_Module
{
public static class RemoteDataUtil {
private static readonly Logger Logger = Logger.GetLogger(typeof(RemoteDataUtil));
private const string BLOCKLIST_URI = "https://bhm.blishhud.com/Teh.BHUD.Blacklist_Buddy_Module/blocklist.json";
/// <summary>
/// Returns a list of BlacklistedPlayer's from the hosted json
/// </summary>
/// <returns>A list of BlacklistedPlayers</returns>
public static async Task<BlacklistedPlayer[]> GetBlockedPlayers()
{
try {
return await BLOCKLIST_URI.GetJsonAsync<BlacklistedPlayer[]>();
} catch (Exception e) {
Logger.Warn(e, $"Failed to download blocklist from {BLOCKLIST_URI}.");
}
return Array.Empty<BlacklistedPlayer>();
}
}
}