Skip to content

Commit

Permalink
Adds Logging for Team Admin Command
Browse files Browse the repository at this point in the history
- Adds Melon Loader logging message for changing a player's team
- Adds alert notification for changing a player's team
  • Loading branch information
data-bomb committed Jun 22, 2024
1 parent 1e863e9 commit 3a01e11
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Si_BasicTeamBalance/Si_BasicTeamBalance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ You should have received a copy of the GNU General Public License
using SilicaAdminMod;
using System.Linq;

[assembly: MelonInfo(typeof(BasicTeamBalance), "Basic Team Balance", "1.3.0", "databomb", "https://github.com/data-bomb/Silica")]
[assembly: MelonInfo(typeof(BasicTeamBalance), "Basic Team Balance", "1.3.1", "databomb", "https://github.com/data-bomb/Silica")]
[assembly: MelonGame("Bohemia Interactive", "Silica")]
[assembly: MelonOptionalDependencies("Admin Mod")]

Expand Down Expand Up @@ -277,7 +277,7 @@ public static void Command_Team(Player? callerPlayer, String args)
Team team = Team.GetTeamByName(teamTarget, false);
if (team == null)
{
HelperMethods.ReplyToCommand(args.Split(' ')[0] + ": Ambiguous or invalid team name");
HelperMethods.SendChatMessageToPlayer(callerPlayer, HelperMethods.chatPrefix, commandName, ": Ambiguous or invalid team name");
return;
}

Expand All @@ -294,7 +294,7 @@ public static void Command_Team(Player? callerPlayer, String args)

if (player == null)
{
HelperMethods.ReplyToCommand(args.Split(' ')[0] + ": Ambiguous or invalid player");
HelperMethods.SendChatMessageToPlayer(callerPlayer, HelperMethods.chatPrefix, commandName, ": Ambiguous or invalid target");
return;
}

Expand All @@ -305,10 +305,13 @@ public static void Command_Team(Player? callerPlayer, String args)
}

SwapTeam(player, team);
HelperMethods.AlertAdminAction(callerPlayer, "swapped " + player.PlayerName + " to " + HelperMethods.GetTeamColor(player) + team.TeamShortName);
}

public static void SwapTeam(Player player, Team team)
{
MelonLogger.Msg("Swapping player (" + player.PlayerName + ") to team: " + team.TeamShortName);

player.Team = team;
NetworkLayer.SendPlayerSelectTeam(player, team);
}
Expand Down

0 comments on commit 3a01e11

Please sign in to comment.