Skip to content

Commit

Permalink
Fix More Compiler Warnings with API
Browse files Browse the repository at this point in the history
- Fixes AlertAdminActivity
  • Loading branch information
data-bomb committed Mar 23, 2024
1 parent 6bdd534 commit 2bd6639
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
16 changes: 5 additions & 11 deletions Si_AdminMod/HelperMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,18 @@ public static void ReplyToCommand_Player(Player player, params string[] messages
broadcastPlayer.SendChatMessage(chatPrefix + GetTeamColor(player) + player.PlayerName + defaultColor + " " + String.Concat(messages), false);
}

public static void AlertAdminActivity(Player adminPlayer, Player targetPlayer, string action)
public static void AlertAdminActivity(Player? adminPlayer, Player targetPlayer, string action)
{
Player broadcastPlayer = FindBroadcastPlayer();
broadcastPlayer.SendChatMessage(chatPrefix + GetAdminColor() + adminPlayer.PlayerName + defaultColor + " " + action + " " + GetTeamColor(targetPlayer) + targetPlayer.PlayerName, false);
string adminName = (adminPlayer == null) ? "SERVER CONSOLE" : adminPlayer.PlayerName;
broadcastPlayer.SendChatMessage(chatPrefix + GetAdminColor() + adminName + defaultColor + " " + action + " " + GetTeamColor(targetPlayer) + targetPlayer.PlayerName, false);
}

public static void AlertAdminAction(Player? adminPlayer, string action)
{
Player broadcastPlayer = FindBroadcastPlayer();

if (adminPlayer == null)
{
broadcastPlayer.SendChatMessage(chatPrefix + GetAdminColor() + "SERVER CONSOLE" + defaultColor + " " + action, false);
}
else
{
broadcastPlayer.SendChatMessage(chatPrefix + GetAdminColor() + adminPlayer.PlayerName + defaultColor + " " + action, false);
}
string adminName = (adminPlayer == null) ? "SERVER CONSOLE" : adminPlayer.PlayerName;
broadcastPlayer.SendChatMessage(chatPrefix + GetAdminColor() + adminName + defaultColor + " " + action, false);
}

public static void SendChatMessageToPlayer(Player? player, params string[] messages)
Expand Down
11 changes: 5 additions & 6 deletions Si_CommManagement/Si_CmdrMgr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -739,15 +739,14 @@ public static void Command_CommanderBan(Player? callerPlayer, String args)
return;
}

if (callerPlayer.CanAdminTarget(playerToCmdrBan))
{
AddCommanderBan(playerToCmdrBan);
HelperMethods.AlertAdminAction(callerPlayer, "restricted " + playerToCmdrBan.PlayerName + " to play as infantry only");
}
else
if (callerPlayer != null && !callerPlayer.CanAdminTarget(playerToCmdrBan))
{
HelperMethods.ReplyToCommand_Player(playerToCmdrBan, "is immune due to level");
return;
}

AddCommanderBan(playerToCmdrBan);
HelperMethods.AlertAdminAction(callerPlayer, "restricted " + playerToCmdrBan.PlayerName + " to play as infantry only");
}

#if false
Expand Down

0 comments on commit 2bd6639

Please sign in to comment.