Skip to content

Commit 5f6c692

Browse files
authored
Merge pull request #47 from HerrMagiic/dev
v2.0.2
2 parents 09561da + 2f08f01 commit 5f6c692

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

CustomCommands/CustomCommands.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace CustomCommands;
99
public partial class CustomCommands : BasePlugin, IPluginConfig<CustomCommandsConfig>
1010
{
1111
public override string ModuleName => "CustomCommands";
12-
public override string ModuleVersion => "2.0.0";
12+
public override string ModuleVersion => "2.0.2";
1313
public override string ModuleAuthor => "HerrMagic";
1414
public override string ModuleDescription => "Create your own commands per config";
1515

CustomCommands/Interfaces/IReplaceTagsFunctions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public interface IReplaceTagsFunctions
66
{
77
string[] ReplaceTags(string[] input, CCSPlayerController player);
88
string ReplaceLanguageTags(string input);
9-
string ReplaceMessageTags(string input, CCSPlayerController player);
9+
string ReplaceMessageTags(string input, CCSPlayerController player, bool safety = true);
1010
string ReplaceColorTags(string input);
1111
string[] WrappedLine(dynamic message);
1212
}

CustomCommands/Services/ReplaceTagsFunction.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public string[] ReplaceTags(string[] input, CCSPlayerController player)
3131
for (int i = 0; i < input.Length; i++)
3232
{
3333
output[i] = ReplaceLanguageTags(input[i]);
34-
output[i] = ReplaceMessageTags(output[i], player);
34+
output[i] = ReplaceMessageTags(output[i], player, false);
3535
output[i] = ReplaceColorTags(output[i]);
3636
}
3737

@@ -61,7 +61,7 @@ public string ReplaceLanguageTags(string input)
6161
return input;
6262
}
6363
}
64-
public string ReplaceMessageTags(string input, CCSPlayerController player)
64+
public string ReplaceMessageTags(string input, CCSPlayerController player, bool safety = true)
6565
{
6666
SteamID steamId = new SteamID(player.SteamID);
6767

@@ -71,7 +71,6 @@ public string ReplaceMessageTags(string input, CCSPlayerController player)
7171
{"{MAP}", NativeAPI.GetMapName() ?? "<MAP not found>"},
7272
{"{TIME}", DateTime.Now.ToString("HH:mm:ss") ?? "<TIME not found>"},
7373
{"{DATE}", DateTime.Now.ToString("dd.MM.yyyy") ?? "<DATE not found>"},
74-
{"{PLAYERNAME}", player.PlayerName ?? "<PLAYERNAME not found>"},
7574
{"{USERID}", player.Slot.ToString() ?? "<USERID not found>"},
7675
{"{STEAMID2}", steamId.SteamId2 ?? "<STEAMID2 not found>"},
7776
{"{STEAMID3}", steamId.SteamId3 ?? "<STEAMID3 not found>"},
@@ -84,6 +83,8 @@ public string ReplaceMessageTags(string input, CCSPlayerController player)
8483
{"{PLAYERS}",
8584
Utilities.GetPlayers().Count(u => u.PlayerPawn.Value != null && u.PlayerPawn.Value.IsValid).ToString() ?? "<PLAYERS not found>"}
8685
};
86+
if (!safety)
87+
replacements.Add("{PLAYERNAME}", player.PlayerName ?? "<PLAYERNAME not found>");
8788

8889
foreach (var pair in replacements)
8990
input = input.Replace(pair.Key, pair.Value);

Examples/ServerCommands.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"cl_ragdoll_gravity 0",
3232
"sv_accelerate 10",
3333
"sv_airaccelerate 1400",
34-
"sv_gravity 800.0"
34+
"sv_gravity 800.0"
3535
],
3636
"Permission": {
3737
"RequiresPermissionOr": true,

0 commit comments

Comments
 (0)