This repository has been archived by the owner on Sep 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NGPlugins.cs
39 lines (35 loc) · 1.57 KB
/
NGPlugins.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
31
32
33
34
35
36
37
38
39
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Terraria;
using TerrariaApi.Server;
using TShockAPI;
namespace NGPlugins
{
[ApiVersion(2, 1)]
public class NGPlugins : TerrariaPlugin
{
public override string Name { get { return "NGPlugins"; } }
public override string Author { get { return "Frontalvlad"; } }
public override string Description { get { return "Plugin specifically for NGVille server. Shows a list of plugins."; } }
public override Version Version { get { return Assembly.GetExecutingAssembly().GetName().Version; } }
public NGPlugins(Main game)
: base(game)
{
}
public override void Initialize() => Commands.ChatCommands.Add(new Command("ngplugins", new CommandDelegate(this.ListPluginsCommand), new string[2]
{
"ngplugins",
"plugins"
}));
private void ListPluginsCommand(CommandArgs args)
{
uint packedValue = Color.White.packedValue;
string colorTag = string.Format("[c/{0:X}:", (object)((uint)(((int)packedValue & (int)byte.MaxValue) << 16 | (int)packedValue & 65280) | (packedValue & 16711680U) >> 16));
string msg = "[i:547] [c/e3693f:Plugins]: " + string.Join("[c/ffffff:,] ", ((IEnumerable<PluginContainer>)ServerApi.Plugins).Select<PluginContainer, string>((Func<PluginContainer, string>)(p => colorTag + p.Plugin.Name.Replace("]", "]" + colorTag + "]") + "]")));
args.Player.SendInfoMessage(msg);
}
}
}