Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Essentials/Commands/AdminModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ public void PlayerCount(int count = -1)
{
if (count == -1)
{
Context.Respond($"Nax player count: {MyMultiplayer.Static.MemberLimit}. Current online players: {MyMultiplayer.Static.MemberCount - 1}");
Context.Respond($"Max player count: {MyMultiplayer.Static.MemberLimit}. Current online players: {MyMultiplayer.Static.MemberCount - 1}");
return;
}

MyMultiplayer.Static.MemberLimit = count;
Context.Respond($"Nax player count: {MyMultiplayer.Static.MemberLimit}. Current online players: {MyMultiplayer.Static.MemberCount - 1}");
Context.Respond($"Max player count: {MyMultiplayer.Static.MemberLimit}. Current online players: {MyMultiplayer.Static.MemberCount - 1}");
}

[Command("runauto", "Runs the auto command with the given name immediately")]
Expand Down
14 changes: 10 additions & 4 deletions Essentials/Commands/InfoModule.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Linq;
using Sandbox.Game;
using Sandbox.Game.World;
using Torch.Commands;
using Torch.Managers.ChatManager;
using Torch.API.Managers;
using Torch.Mod;
using Torch.Mod.Messages;
Expand All @@ -23,21 +24,26 @@ public void List()
Context.Respond(string.Join(", ", EssentialsPlugin.Instance.Config.InfoCommands.Select(i => i.Command).Where(c => !string.IsNullOrEmpty(c))));
}

private static void MessageProcessing(Torch.API.Managers.TorchChatMessage msg, ref bool consumed)
private static void MessageProcessing(TorchChatMessage msg, ref bool consumed)
{
var infoCommands = EssentialsPlugin.Instance.Config.InfoCommands;
if (infoCommands == null)
return;

var c = infoCommands.FirstOrDefault(i => i.Command?.Equals(msg.Message) == true);
if (c == null)
return;

consumed = true;
long playerId = MySession.Static.Players.TryGetIdentityId(msg.AuthorSteamId.Value);

if (!string.IsNullOrEmpty(c.ChatResponse))
EssentialsPlugin.Instance.Torch.CurrentSession?.Managers?.GetManager<IChatManagerServer>()?.SendMessageAsOther("Server", c.ChatResponse, MyFontEnum.Blue, msg.AuthorSteamId.Value);
if (!string.IsNullOrEmpty(c.DialogResponse))
ModCommunication.SendMessageTo(new DialogMessage(c.Command, content: c.DialogResponse), msg.AuthorSteamId.Value);
if (!string.IsNullOrEmpty(c.URL))
MyVisualScriptLogicProvider.OpenSteamOverlay($"https://steamcommunity.com/linkfilter/?url={c.URL}", playerId);

}
}
}
7 changes: 7 additions & 0 deletions Essentials/InfoCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class InfoCommand : ViewModel
private string _command;
private string _chatResponse;
private string _dialogResponse;
private string _urlResponse;

public string Command
{
Expand All @@ -26,6 +27,12 @@ public string DialogResponse
get => _dialogResponse;
set => SetValue(ref _dialogResponse, value);
}

public string URL
{
get => _urlResponse;
set => SetValue(ref _urlResponse, value);
}

public override string ToString()
{
Expand Down