Skip to content

Commit

Permalink
单独一个文件
Browse files Browse the repository at this point in the history
  • Loading branch information
XLittleLeft committed Jan 25, 2025
1 parent 9fa3164 commit 1bfe575
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 23 deletions.
16 changes: 8 additions & 8 deletions HelpSense/Commands/InfoCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ public class InfoCommand : ICommand
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
{
Player player;
TranslateConfig TranslateConfig = Plugin.Instance.TranslateConfig;
CommandTranslateConfig CommandTranslateConfig = Plugin.Instance.CommandTranslateConfig;

if (sender is null || (player = Player.Get(sender)) is null)
{
response = TranslateConfig.InfoCommandFailed;
response = CommandTranslateConfig.InfoCommandFailed;
return false;
}

if (player.DoNotTrack || !Plugin.Instance.Config.SavePlayersInfo)
{
response = TranslateConfig.InfoCommandFailed;
response = CommandTranslateConfig.InfoCommandFailed;
return false;
}

Expand All @@ -50,11 +50,11 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s

var sb = StringBuilderPool.Pool.Get();

sb.AppendLine(TranslateConfig.InfoCommandTitle);
sb.AppendLine(TranslateConfig.InfoCommandPlayedTime.Replace("%day%" , day.ToString()).Replace("%hour%", hour.ToString()).Replace("%minutes%", minutes.ToString()));
sb.AppendLine(TranslateConfig.InfoCommandRolePlayed.Replace("%rolePlayed%" , rolePlayed.ToString()));
sb.AppendLine(TranslateConfig.InfoCommandKillsDamages.Replace("%kills%" , kills.ToString()).Replace("%scpKills%", scpKills.ToString()).Replace("%playerDamage%", playerDamage.ToString()).Replace("%playerDeath%", playerDeath.ToString()));
sb.AppendLine(TranslateConfig.InfoCommandShot.Replace("%shot%" , shot.ToString()));
sb.AppendLine(CommandTranslateConfig.InfoCommandTitle);
sb.AppendLine(CommandTranslateConfig.InfoCommandPlayedTime.Replace("%day%" , day.ToString()).Replace("%hour%", hour.ToString()).Replace("%minutes%", minutes.ToString()));
sb.AppendLine(CommandTranslateConfig.InfoCommandRolePlayed.Replace("%rolePlayed%" , rolePlayed.ToString()));
sb.AppendLine(CommandTranslateConfig.InfoCommandKillsDamages.Replace("%kills%" , kills.ToString()).Replace("%scpKills%", scpKills.ToString()).Replace("%playerDamage%", playerDamage.ToString()).Replace("%playerDeath%", playerDeath.ToString()));
sb.AppendLine(CommandTranslateConfig.InfoCommandShot.Replace("%shot%" , shot.ToString()));

response = sb.ToString();
StringBuilderPool.Pool.Return(sb);
Expand Down
25 changes: 25 additions & 0 deletions HelpSense/ConfigSystem/CommandTranslateConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HelpSense.ConfigSystem
{
public class CommandTranslateConfig
{
[Description("玩家信息指令_标题")]
public string InfoCommandTitle { get; set; } = "自从插件安装后你已在本服游玩了";
[Description("玩家信息指令_时间")]
public string InfoCommandPlayedTime { get; set; } = "<color=red>%day%</color>天<color=red>%hour%</color>小时<color=red>%minutes%</color>分钟";
[Description("玩家信息指令_角色")]
public string InfoCommandRolePlayed { get; set; } = "一共扮演了<color=red>%rolePlayed%</color>次角色";
[Description("玩家信息指令_击杀和伤害")]
public string InfoCommandKillsDamages { get; set; } = "你一共击杀了<color=red>%kills%</color>个人<color=red>%scpKills%</color>个SCP | 一共造成了<color=red>%playerDamage%</color>点伤害(伤害包括无效的) | 一共死亡<color=red>%playerDeath%次</color>";
[Description("玩家信息指令_射击")]
public string InfoCommandShot { get; set; } = "一共开了<color=red>%shot%</color>枪";
[Description("玩家信息指令_因DNT查询失败的消息")]
public string InfoCommandFailed { get; set; } = "查询失败,请关闭DNT或服务器未启用此功能";
}
}
15 changes: 0 additions & 15 deletions HelpSense/ConfigSystem/TranslateConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,20 +285,5 @@ public class TranslateConfig
public string SkynetSpecialIntroduction { get; set; } = "<color=blue>天网 机动特遣队</color>";
[Description("非礼勿视机动特遣队特殊介绍")]
public string SeeNoEvilSpecialIntroduction { get; set; } = "<color=blue>非礼勿视 机动特遣队</color>";
///
///
///
[Description("玩家信息指令_标题")]
public string InfoCommandTitle { get; set; } = "自从插件安装后你已在本服游玩了";
[Description("玩家信息指令_时间")]
public string InfoCommandPlayedTime { get; set; } = "<color=red>%day%</color>天<color=red>%hour%</color>小时<color=red>%minutes%</color>分钟";
[Description("玩家信息指令_角色")]
public string InfoCommandRolePlayed { get; set; } = "一共扮演了<color=red>%rolePlayed%</color>次角色";
[Description("玩家信息指令_击杀和伤害")]
public string InfoCommandKillsDamages { get; set; } = "你一共击杀了<color=red>%kills%</color>个人<color=red>%scpKills%</color>个SCP | 一共造成了<color=red>%playerDamage%</color>点伤害(伤害包括无效的) | 一共死亡<color=red>%playerDeath%次</color>";
[Description("玩家信息指令_射击")]
public string InfoCommandShot { get; set; } = "一共开了<color=red>%shot%</color>枪";
[Description("玩家信息指令_因DNT查询失败的消息")]
public string InfoCommandFailed { get; set; } = "查询失败,请关闭DNT或服务器未启用此功能";
}
}
1 change: 1 addition & 0 deletions HelpSense/HelpSense.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<Compile Include="Commands\InfoCommand.cs" />
<Compile Include="Commands\VersionCommand.cs" />
<Compile Include="Commands\RescueCommand.cs" />
<Compile Include="ConfigSystem\CommandTranslateConfig.cs" />
<Compile Include="ConfigSystem\Config.cs" />
<Compile Include="ConfigSystem\SSSSTranslateConfig.cs" />
<Compile Include="ConfigSystem\TranslateConfig.cs" />
Expand Down
3 changes: 3 additions & 0 deletions HelpSense/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public class Plugin
[PluginConfig("SSSSTranslateConfig.yml")]
public SSSSTranslateConfig SSSSTranslateConfig;

[PluginConfig("CommandTranslateConfig.yml")]
public CommandTranslateConfig CommandTranslateConfig;

public System.Random Random = new(DateTime.Now.GetHashCode());

public static string RespawnTimerDirectoryPath { get; private set; }
Expand Down

0 comments on commit 1bfe575

Please sign in to comment.