diff --git a/POBC.cs b/POBC.cs index fc99dbe..7ca2fb3 100644 --- a/POBC.cs +++ b/POBC.cs @@ -27,7 +27,7 @@ public class POBCSystem : TerrariaPlugin public override Version Version => Assembly.GetExecutingAssembly().GetName().Version; public string ConfigPath => Path.Combine(TShock.SavePath, "POBC.json"); - public POBCConfin Config = new POBCConfin(); + public POBCConfig Config = new POBCConfig(); //public string time = DateTime.Now.ToString("yyyy-MM-dd_hh-mm-ss"); yuqing : 日志整体移动到DB Sheet #endregion @@ -203,6 +203,11 @@ private void Pay(CommandArgs args) args.Player.SendErrorMessage("未能在POBC用户数据中查找到该玩家:" + args.Parameters[0] + "! 请确认玩家名"); return; } + if (int.Parse(args.Parameters[1]) <1) + { + args.Player.SendErrorMessage("支付的货币不能小于 1" ); + return; + } if (int.Parse(args.Parameters[1]) > Db.QueryCurrency(args.Player.Name)) { args.Player.SendErrorMessage("您拥有的货币不够你要支付的货币数,拥有货币数:" + Db.QueryCurrency(args.Player.Name)); @@ -273,11 +278,11 @@ public void File() { try { - Config = POBCConfin.Read(ConfigPath).Write(ConfigPath); + Config = POBCConfig.Read(ConfigPath).Write(ConfigPath); } catch (Exception ex) { - Config = new POBCConfin(); + Config = new POBCConfig(); TShock.Log.ConsoleError("[POBC] 读取配置文件发生错误!\n{0}".SFormat(ex.ToString())); } } diff --git a/config.cs b/config.cs index 054723b..0cea21f 100644 --- a/config.cs +++ b/config.cs @@ -4,7 +4,7 @@ namespace POBC2 { - public class POBCConfin + public class POBCConfig { public int[] IgnoreNpc = new int[0]; public int infodisplay = 1; @@ -19,19 +19,19 @@ public bool IsIgnored(int npctype) return IgnoreNpc.Contains(npctype); } - public POBCConfin Write(string file) + public POBCConfig Write(string file) { File.WriteAllText(file, JsonConvert.SerializeObject(this, Formatting.Indented)); return this; } - public static POBCConfin Read(string file) + public static POBCConfig Read(string file) { if (!File.Exists(file)) { - return new POBCConfin(); + return new POBCConfig(); } - return JsonConvert.DeserializeObject(File.ReadAllText(file)); + return JsonConvert.DeserializeObject(File.ReadAllText(file)); } } } \ No newline at end of file