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
3 changes: 2 additions & 1 deletion Essentials/Commands/GridModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Threading.Tasks;
using Sandbox.Game.Entities;
using Sandbox.ModAPI;
using Torch.API.Managers;
using Torch.Commands;
using Torch.Commands.Permissions;
using VRage.Game.Entity.EntityComponents;
Expand Down Expand Up @@ -35,7 +36,7 @@ public void SetOwner(string gridName, string playerName)
long identityId;
if (!long.TryParse(playerName, out identityId))
{
var player = Context.Torch.Multiplayer.GetPlayerByName(playerName);
var player = Context.Torch.CurrentSession?.Managers?.GetManager<IMultiplayerManagerBase>().GetPlayerByName(playerName);
if (player == null)
{
Context.Respond($"Player {playerName} not found.");
Expand Down
12 changes: 6 additions & 6 deletions Essentials/Commands/PlayerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class PlayerModule : CommandModule
[Command("say", "Say a message as the server.")]
public void Say(string message)
{
Context.Torch.Managers.GetManager<MultiplayerManager>()?.SendMessage(Context.RawArgs);
Context.Torch.CurrentSession?.Managers?.GetManager<IChatManagerServer>()?.SendMessageAsSelf(Context.RawArgs);
}

[Command("tp", "Teleport one entity to another.")]
Expand Down Expand Up @@ -70,7 +70,7 @@ public void Whisper(string playerName)
return;

var message = Context.RawArgs.Substring(msgIndex);
var player = Context.Torch.Multiplayer.GetPlayerByName(playerName);
var player = Context.Torch.CurrentSession?.Managers?.GetManager<IMultiplayerManagerBase>()?.GetPlayerByName(playerName);
Console.WriteLine($"'{player?.DisplayName ?? "null"}'");

if (player == null)
Expand All @@ -79,7 +79,7 @@ public void Whisper(string playerName)
return;
}

Context.Torch.Multiplayer.SendMessage(message, Context.Player?.DisplayName ?? "Server", player.IdentityId, MyFontEnum.Red);
Context.Torch.CurrentSession?.Managers?.GetManager<IChatManagerServer>()?.SendMessageAsOther(message, Context.Player?.DisplayName ?? "Server", MyFontEnum.Red, player.SteamUserId);
}

[Command("kick", "Kick a player from the game.")]
Expand All @@ -89,7 +89,7 @@ public void Kick(string playerName)
var player = Utilities.GetPlayerByNameOrId(playerName);
if (player != null)
{
Context.Torch.Multiplayer.KickPlayer(player.SteamUserId);
Context.Torch.CurrentSession?.Managers?.GetManager<IMultiplayerManagerServer>()?.KickPlayer(player.SteamUserId);
Context.Respond($"Player '{player.DisplayName}' kicked.");
}
else
Expand All @@ -105,7 +105,7 @@ public void Ban(string playerName)
var player = Utilities.GetPlayerByNameOrId(playerName);
if (player != null)
{
Context.Torch.Multiplayer.BanPlayer(player.SteamUserId);
Context.Torch.CurrentSession?.Managers?.GetManager<IMultiplayerManagerServer>()?.BanPlayer(player.SteamUserId);
Context.Respond($"Player '{player.DisplayName}' banned.");
}
else
Expand All @@ -121,7 +121,7 @@ public void Unban(string playerName)
var player = Utilities.GetPlayerByNameOrId(Context.Args.FirstOrDefault());
if (player != null)
{
Context.Torch.Multiplayer.BanPlayer(player.SteamUserId, false);
Context.Torch.CurrentSession?.Managers?.GetManager<IMultiplayerManagerServer>()?.BanPlayer(player.SteamUserId, false);
Context.Respond($"Player '{player.DisplayName}' unbanned.");
}
else
Expand Down
6 changes: 5 additions & 1 deletion Essentials/EssentialsPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
using Sandbox.Game.World;
using Torch;
using Torch.API;
using Torch.API.Managers;
using Torch.API.Plugins;
using Torch.Commands;
using Torch.Managers;
using VRage.Game;
using VRage.Game.Entity;

namespace Essentials
Expand Down Expand Up @@ -61,7 +63,9 @@ private void MotdOnce(MyEntity obj)
if (string.IsNullOrEmpty(Config.Motd) || _motdOnce.Contains(id))
return;

Torch.Multiplayer.SendMessage(Config.Motd, "MOTD", id);
if (MySession.Static.Players.TryGetPlayerId(id, out MyPlayer.PlayerId info))
Torch.CurrentSession?.Managers?.GetManager<IChatManagerServer>()
.SendMessageAsOther("MOTD", Config.Motd, MyFontEnum.Blue, info.SteamId);
_motdOnce.Add(id);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ node {
if (result) {
currentBuild.result = "SUCCESS"
stage('Archive') {
archiveArtifacts artifacts: "bin/x64/Release/Essentials.*", caseSensitive: false, fingerprint: true, onlyIfSuccessful: true
archiveArtifacts artifacts: "bin/x64/${buildMode}/Essentials.*", caseSensitive: false, fingerprint: true, onlyIfSuccessful: true

zipFile = "bin\\essentials.zip"
packageDir = "bin\\essentials\\"
Expand Down