예제 #1
0
        /// <summary>
        /// 初始化文件
        /// </summary>
        private static void initPlugin()
        {
            if (!Directory.Exists(BDSName))
            {
                Directory.CreateDirectory(BDSName);
            }
            if (!File.Exists(configFile))
            {
                initConfig();
            }

            // var config = JObject.Parse(File.ReadAllText(configFile));
            Economic.init();
            CleanRobot.init();

            /* if (config["tpa"])
             *  Tpa.init(mcapi);
             * if (config["tpr"])
             *  Tpr.init(mcapi);
             * if (config["back"])
             *  Back.init(mcapi);
             * if (config["blacklist"])
             *  BlackList.init(mcapi);
             * if (config["home"])
             * {
             *  Home.init(mcapi);
             *  HomeT.init(mcapi);
             * } */

            /* mcapi.setCommandDescribe("money", "打开经济管理");
             * if ((bool)config["tpa"])
             *  mcapi.setCommandDescribe("tpa", "打开传送菜单");
             * if ((bool)config["tpr"])
             *  mcapi.setCommandDescribe("tpr", "随机传送");
             * if ((bool)config["back"])
             *  mcapi.setCommandDescribe("back", "返回死亡点");
             * if ((bool)config["blacklist"])
             *  mcapi.setCommandDescribeEx("ban", "打开封禁管理", MCCSAPI.CommandPermissionLevel.Admin, (byte)MCCSAPI.CommandCheatFlag.NotCheat, (byte)MCCSAPI.CommandVisibilityFlag.Visible);
             * if ((bool)config["home"])
             * {
             *  mcapi.setCommandDescribe("home", "打开家园菜单");
             *  mcapi.setCommandDescribe("homet", "返回至默认家");
             * } */
        }
예제 #2
0
        private static bool ServerCmd(Events x)
        {
            var json = BaseEvent.getFrom(x) as ServerCmdEvent;

            switch (json.cmd)
            {
            case "money reload":
                if (File.Exists(Economic.configFile))
                {
                    try { Economic.config = JObject.Parse(File.ReadAllText(Economic.configFile)); }
                    catch { Console.WriteLine("Economic >> 配置文件 config.json 读取失败!"); }
                }
                else
                {
                    Economic.initConfig();
                    Console.WriteLine("Economic >> 未找到配置文件 config.json,正在为您生成!");
                }
                return(false);

            case "clean reload":
                if (File.Exists(CleanRobot.configFile))
                {
                    try { CleanRobot.config = JObject.Parse(File.ReadAllText(CleanRobot.configFile)); }
                    catch { Console.WriteLine("Economic >> 配置文件 config.json 读取失败!"); }
                }
                else
                {
                    CleanRobot.initConfig();
                    Console.WriteLine("Economic >> 未找到配置文件 config.json,正在为您生成!");
                }
                return(false);

            default:
                break;
            }
            return(true);
        }