// LiteLoader-AIDS automatic generated
/// <reference path="e:\llse/dts/llaids/src/index.d.ts"/>

const versions = "v1.1.3";
const regvers = [1, 1, 3];
const fixvers = "";
const author = "Planet工作室-星辰开发组-苏苏";
const info = "§l§e[PSign] §r";
const url = "http://update.mcmap.top/?name=PSign"

const signdata = new JsonConfigFile(`./plugins/Planet/PSign/data/signdata.json`, JSON.stringify({}));
const configdata = new JsonConfigFile(`./plugins/Planet/PSign/config.json`, JSON.stringify({
    version: `${versions}${fixvers}`,
    money: 0,
    score: "money",
    sign: {
        breakoffsign: true,
        breakoffsignday: 3,
        switch: true,
        addition: true,
        fixed: 0,
        minreward: 66,
        maxreward: 10000,
        vipfixed: 0,
        vipminreward: 66666,
        vipmaxreward: 100000
    }
}));
const languagedata = new JsonConfigFile(`./plugins/Planet/PSign/lang/language.json`, JSON.stringify({
    lang: [
        {
            language: "zh_CN",
            chinese: "简体中文",
            english: "Simplified Chinese"
        },
        {
            language: "en_US",
            chinese: "英语(美国)",
            english: "English(USA)"
        }
    ],
    server: "zh_CN"
}));

var config = {
    getAll: () => {
        configdata.reload()
        return JSON.parse(configdata.read())
    },
    getVersion: () => { return config.getAll()["version"] },
    getMoney: () => { return config.getAll()["money"] },
    getScore: () => { return config.getAll()["score"] },
    getSign: () => { return config.getAll()["sign"] },
    setAll: (list) => {
        configdata.reload()
        var configlist = config.getAll()
        if (list.version == null) { list.version = configlist.version }
        if (list.money == null) { list.money = configlist.money }
        if (list.score == null) { list.score = configlist.score }
        if (list.breakoffsign == null) { list.breakoffsign = configlist.sign.breakoffsign }
        if (list.breakoffsignday == null) { list.breakoffsignday = configlist.sign.breakoffsignday }
        if (list.switch == null) { list.switch = configlist.sign.switch }
        if (list.addition == null) { list.addition = configlist.sign.addition }
        if (list.fixed == null) { list.fixed = configlist.sign.fixed }
        if (list.minreward == null) { list.minreward = configlist.sign.minreward }
        if (list.maxreward == null) { list.maxreward = configlist.sign.maxreward }
        if (list.vipfixed == null) { list.vipfixed = configlist.sign.vipfixed }
        if (list.vipminreward == null) { list.vipminreward = configlist.sign.vipminreward }
        if (list.vipmaxreward == null) { list.vipmaxreward = configlist.sign.vipmaxreward }
        configdata.write(JSON.stringify({
            version: list.version,
            money: list.money,
            score: list.score,
            sign: {
                breakoffsign: list.breakoffsign,
                breakoffsignday: list.breakoffsignday,
                switch: list.switch,
                addition: list.addition,
                fixed: parseInt(list.fixed),
                minreward: list.minreward,
                maxreward: list.maxreward,
                vipfixed: parseInt(list.vipfixed),
                vipminreward: list.vipminreward,
                vipmaxreward: list.vipmaxreward
            }
        }, null, 4))
    }
}
var sign = {
    getAll: () => {
        signdata.reload();
        return JSON.parse(signdata.read());
    },
    getPlayerData: (name) => {
        if (name == null) {
            return null;
        } else { return sign.getAll()[name] };
    },
    getState: (name) => {//1.1.0版本后删除 由于需要兼容配置文件和外接接口，暂时保留
        if (name == null) {
            return null;
        } else {
            if (sign.getPlayerData(name) == null) {
                return null;
            } else { return sign.getPlayerData(name).state };
        };
    },
    getCount: (name) => {
        if (name == null) {
            return null;
        } else {
            if (sign.getPlayerData(name) == null) {
                return null;
            } else { return sign.getPlayerData(name).count };
        };
    },
    getContSign: (name) => {
        if (name == null) {
            return null;
        } else {
            if (sign.getPlayerData(name) == null) {
                return null;
            } else { return sign.getPlayerData(name).contsign };
        };
    },
    getReward: (name) => {
        if (name == null) {
            return null;
        } else {
            if (sign.getPlayerData(name) == null) {
                return null;
            } else { return sign.getPlayerData(name).reward };
        };
    },
    getVipReward: (name) => {
        if (name == null) {
            return null;
        } else {
            if (sign.getPlayerData(name) == null) {
                return null;
            } else { return sign.getPlayerData(name).vipreward };
        };
    },
    getSignDate: (name) => {
        if (name == null) {
            return null;
        } else {
            if (sign.getPlayerData(name) == null) {
                return null;
            } else { return sign.getPlayerData(name).signdate };
        };
    },
    getInterval: (name) => {
        if (name == null) {
            return null;
        } else {
            if (sign.getPlayerData(name) == null) {
                return null;
            } else {
                var time = system.getTimeObj();
                var objtime = `${time.Y}-${time.M}-${time.D}`;
                var playerinfo = sign.getPlayerData(name);
                var interval = (new Date(objtime).getTime() - new Date(playerinfo.signdate).getTime()) / (1000 * 60 * 60 * 24);
                return interval;
            };
        };
    },
    setPlayerData: (name, list) => {
        signdata.reload();
        var playerinfo = sign.getPlayerData(name);
        if (list.count == null) { list.count = playerinfo.count };
        if (list.contsign == null) { list.contsign = playerinfo.contsign };
        if (list.reward == null) { list.reward = playerinfo.reward } else if (list.reward != 0) { list.reward = Number(playerinfo.reward + list.reward) }
        if (list.vipreward == null) { list.vipreward = playerinfo.vipreward } else if (list.vipreward != 0) { list.vipreward = Number(playerinfo.vipreward + list.vipreward) }
        if (list.signdate == null) { list.signdate = playerinfo.signdate };
        return signdata.set(name, {
            count: list.count,
            contsign: list.contsign,
            reward: list.reward,
            vipreward: list.vipreward,
            signdate: list.signdate
        });
    }
};
var Money = {
    get: (pl) => {//获取玩家经济
        if (config.getMoney() == 0) {
            return pl.getScore(config.getScore());
        } else { return money.get(pl.xuid) };
    },
    add: (pl, addmoney) => {//增加玩家经济
        if (config.getMoney() == 0) {
            return pl.addScore(config.getScore(), Number(addmoney));
        } else { return money.add(pl.xuid, Number(addmoney)) };
    }
};
var langlist = {
    get: (pl) => {
        languagedata.reload();
        return languagedata.get(pl.realName);
    },
    set: (pl, language) => {
        languagedata.reload();
        return languagedata.set(pl.realName, language);
    },
    getLang: () => {
        languagedata.reload();
        var lang = languagedata.get("lang");
        if (lang == null) {
            lang = [];
        };
        return lang;
    },
    Sign: (pl) => { return language(langlist.get(pl), "sign"); },
    Signset: (pl) => { return language(langlist.get(pl), "signset"); },
    Join: (pl) => { return language(langlist.get(pl), "join"); }
};
var docking = {
    PAPI: () => { return ll.listPlugins().includes("BEPlaceholderAPI"); },
    PAPIjs: () => { return require('./lib/BEPlaceholderAPI-JS.js').PAPI; },
    PBind: () => { return ll.listPlugins().includes("PBind"); },
    PBindQQdata: (qq) => { return ll.import("PBind", "qqdata")(qq) },
    PCsvip: () => { return ll.listPlugins().includes("PCsvip"); },
    PCsvipPlayer: (name) => { return ll.import("PCsvip", "getplayer")(name); },
    PMail: () => { return ll.listPlugins().includes("PMail"); },
    PMailNew: (name, id, title, content, annax) => { return ll.import("PMail", "addnewmail")(name, id, title, content, annax) },
    PMailReg: (name) => { return ll.import("PMail", "regsystem")(name) },
    Timer: () => { return ll.listPlugins().includes("OnlineTimer") },
    TimerData: () => { return new JsonConfigFile("./plugins/OnlineTimer/data.json", "json") }
};
function cmdres(res) {
    if (res.name != null) {
        res = res.name.split(" ")
        var resone = res[0]
        if (res.toString().includes('"') == 1) {
            var restow = specifydata(specifydata(res.toString().replace(/\,/g, ' '), 0), 1)
            var resthree = specifydata(specifydata(res.toString().replace(/\,/g, ' '), 0), 2).split(" ")
            if (isNaN(resone) == 1) {
                res = [restow.replace(/\,/g, ' ')]
            } else {
                res = [resone, restow]
                if (JSON.stringify(resthree[0]).length > 2) {
                    for (let i = 0; i < resthree.length; ++i) {
                        if (resthree[i] == "true") { resthree.splice(resthree.indexOf("true"), 1, true) }
                        if (resthree[i] == "false") { resthree.splice(resthree.indexOf("false"), 1, false) }
                        res.push(resthree[i])
                    }
                }
            }
        } else {
            var ress = []
            for (let i = 0; i < res.length; ++i) {
                if (res[i] == "true") { res.splice(res.indexOf("true"), 1, true) }
                if (res[i] == "false") { res.splice(res.indexOf("false"), 1, false) }
                ress.push(res[i])
            }
            res = ress
        }
    } else { res = null }
    return res
};
function createfile() {
    new JsonConfigFile(`./plugins/Planet/PSign/lang/zh_CN.json`, JSON.stringify({
        version: `${versions}${fixvers}`,
        "sign": {
            "unit1": "次",
            "unit2": "金币",
            "tell1": "§e你取消了签到,输入指令/sign重新签到",
            "tell2": "§c管理员没有打开签到",
            "tell3": "§e配置文件有误,最小奖励值大于或等于最大奖励值",
            "tell4": "§e配置文件有误,VIP最小奖励值大于或等于最大奖励值",
            "tell5": "§c签到过了,不能重复签到,请明天00:00后再来吧",
            "tell6": "§2签到成功,奖励已发放至游戏账户",
            "title1": "§l§2签到",
            "content1": "§e签到说明:暂无(可以把他当成一个公告)\n\n该项在(plugins/Planet/PSign/lang/zh_CN.json)中修改,或通过签到设置中修改",
            "button1a": "§1签到",
            "button1b": "§1确认",
            "button1c": "§1取消",
            "log1": "请输入QQ号或游戏ID",
            "log2": "请输入游戏ID",
            "log3": "当前QQ号没有绑定ID,请先绑定ID后再签到",
            "log4": "服务器没有安装PSerein插件,无法通过QQ号签到",
            "log5": "管理员没有打开签到",
            "log6": "配置文件有误,最小奖励值大于或等于最大奖励值",
            "log7": "配置文件有误,VIP最小奖励值大于或等于最大奖励值",
            "log8": "签到过了,不能重复签到,请明天00:00后再来吧",
            "log9": "查不到你最后登陆的时间无法进行离线签到",
            "log10": "你最后登陆的时间超过了{day}天,无法进行离线签到",
            "log11": "玩家在线,奖励已发放",
            "log12": "请登陆服务器领取"
        },
        "signset": {
            "unit": "金币",
            "score": "记分板",
            "llmoney": "LLMoney",
            "err1": "§l§c你好像什么都没有操作",
            "err2": "§l§c什么也没有变",
            "err3": "§l§c你填写的好像和以前没什么区别",
            "err4": "§l§e你刚刚填写的计分板服务器上不存在",
            "err5": "§l§e配置文件中的计分板在服务器上不存在",
            "err6": "§l§2已完成更改\n已创建计分板: ",
            "err7": "§l§2已完成更改",
            "err8": "§l§c你好像什么也没做",
            "err9": "§l§c请正确输入固定奖励\n范围: 1-100000",
            "err10": "§l§c请正确输入随机最小奖励\n范围: 1-100000",
            "err11": "§l§c请正确输入随机最大奖励\n范围: 1-100000",
            "err12": "§l§c随机最小奖励大于或等于随机最大奖励\n当前最大奖励为: ",
            "err13": "§l§c请正确输入会员固定奖励\n范围: 1-100000",
            "err14": "§l§c请正确输入会员随机最小奖励\n范围: 1-100000",
            "err15": "§l§c请正确输入会员随机最大奖励\n范围: 1-100000",
            "err16": "§l§c会员随机最小奖励大于或等于随机最大奖励\n当前最大奖励为: ",
            "err17": "§l§2设置成功",
            "tell1": "§c你不是管理员,无法更改配置",
            "tell2": "§2取消设置",
            "tell3": "§c你好像什么都没有操作",
            "tell4": "§c什么也没有变",
            "tell5": "§c你填写的好像和以前没什么区别",
            "tell6": "§e你刚刚填写的计分板服务器上不存在",
            "tell7": "§e配置文件中的计分板在服务器上不存在",
            "tell8": "§2已完成更改",
            "tell9": "§2已完成更改",
            "tell10": "§2已完成更改",
            "tell11": "§c你好像什么也没做",
            "tell12": "§c请正确输入固定奖励\n范围: 1-100000",
            "tell13": "§c请正确输入随机最小奖励\n范围: 1-100000",
            "tell14": "§c请正确输入随机最大奖励\n范围: 1-100000",
            "tell15": "§c随机最小奖励大于或等于随机最大奖励\n当前最大奖励为: ",
            "tell16": "§c请正确输入会员固定奖励\n范围: 1-100000",
            "tell17": "§c请正确输入会员随机最小奖励\n范围: 1-100000",
            "tell18": "§c请正确输入会员随机最大奖励\n范围: 1-100000",
            "tell19": "§c会员随机最小奖励大于或等于随机最大奖励\n当前最大奖励为:",
            "tell20": "§2设置成功",
            "tell21": "当前服务器没有可更换的语言",
            "tell22": "取消变更",
            "tell23": "完成变更",
            "tell24": "已更改语言为: ",
            "title1": "§l§2签到设置",
            "content1": "§e选择:",
            "button1a": "§1设置个人语言",
            "button1b": "§1设置经济参数",
            "button1c": "§1设置签到参数",
            "button1d": "§1设置系统默认语言",
            "title2": "§l§2经济配置",
            "dropdown2": "§e选择经济模式---当前: §r",
            "input2a": "§e输入计分板项--当前: §r",
            "input2b": "§e例如: money",
            "title3": "§l§2温馨提醒",
            "content3": "§e您填写的计分板名称服务器上不存在,请检查是否填写有误或现在立即创建您填写的计分板\n当前服务器拥有计分板如下\n",
            "button3a": "§1确认创建",
            "button3b": "§1返回重填",
            "title4": "§l§2温馨提醒",
            "content4": "§e检测到配置文件中的计分板在服务器上不存在,请检查是否有误或现在立即创建您填写的计分板\n当前服务器拥有计分板如下\n",
            "button4a": "§1确认创建",
            "button4b": "§1返回重填",
            "title5": "§l§2修改成功",
            "content5": "已变更经济配置",
            "button5a": "§1返回",
            "button5b": "§1完成",
            "title6": "§l§2签到参数",
            "label4": "§e注意:\n§4仔细阅读各开关及输入框的标题语,请按照要求正确填写",
            "switch1": "§e签到开关--当前为: §r",
            "switch2": "§e连签翻倍---当前为: §r",
            "switch3": "§e奖励模式--当前为: §r",
            "switch4": "§eVIP奖励模式--当前为: §r",
            "input4a1": "§e设置固定奖励---当前为: §r",
            "input4b1": "例如: 666",
            "input4a2": "§e设置最小奖励---当前为: §r",
            "input4b2": "例如: 666",
            "input4a3": "§e设置最大奖励---当前为: §r",
            "input4b3": "例如: 666",
            "input4a4": "§e设置VIP固定奖励---当前为: §r",
            "input4b4": "例如: 666",
            "input4a5": "§e设置VIP最小奖励---当前为: §r",
            "input4b5": "例如: 666",
            "input4a6": "§e设置VIP最大奖励---当前为: §r",
            "input4b6": "例如: 666",
            "title7": "§l§2设置系统语言",
            "content7": "§e选择:"
        },
        "join": {
            "tell": "§2您上次签到所获得的经济已发放,请明天继续签到哟"
        }
    }));
    new JsonConfigFile(`./plugins/Planet/PSign/lang/en_US.json`, JSON.stringify({
        version: `${versions}${fixvers}`,
        "sign": {
            "unit1": "order",
            "unit2": "Gold Coin",
            "tell1": "§eYou cancelled the check-in, enter the command/sign to sign in again",
            "tell2": "§cAdministrator did not open check-in",
            "tell3": "§eError in configuration file, minimum reward value greater than or equal to maximum reward value",
            "tell4": "§eError in configuration file, VIP minimum reward value greater than or equal to maximum reward value",
            "tell5": "§chas checked in and cannot be re checked in. Please come back after 00:00 tomorrow",
            "tell6": "§2Successfully signed in, rewards have been distributed to the game account",
            "title1": "§l§2Check in",
            "content1": "§eSign-in instructions: Currently unavailable (you can treat it as an announcement)\n\nThis item can be modified in (plugins/Planet/PSign/lang/zh_CN.json) or through check-in settings",
            "button1a": "§1Check in",
            "button1b": "§1Confirmation",
            "button1c": "§1Cancel",
            "log1": "Please enter a QQ number or game ID",
            "log2": "Please enter the game ID",
            "log3": "The current QQ number does not have an ID bound, Please bind the ID first before signing in",
            "log4": "The server does not have the PSerin plugin installed and cannot sign in through QQ account",
            "log5": "The administrator did not open check-in",
            "log6": "Configuration file error, minimum reward value greater than or equal to maximum reward value",
            "log7": "Configuration file error, VIP minimum reward value greater than or equal to maximum reward value",
            "log8": "We have already checked in and cannot repeat our check-in. Please come back after 00:00 tomorrow",
            "log9": "Unable to find your last login time and unable to perform offline check-in",
            "log10": "You have logged in for more than {day} days and cannot perform offline check-in",
            "log11": "Player online, rewards have been distributed",
            "log12": "Please log in to the server to collect"
        },
        "signset": {
            "unit": "Species",
            "score": "Scoreboard",
            "llmoney": "LLMoney",
            "err1": "§l§cYou seem to have done nothing",
            "err2": "§l§cHas not changed anything",
            "err3": "§l§cHas not changed anything",
            "err4": "§l§eThe scoreboard server you just filled in does not exist",
            "err5": "§l§eThe scoreboard in the configuration file does not exist on the server",
            "err6": "§l§2Has completed changes\nCreated scoreboard:",
            "err7": "§l§2Has been changed",
            "err8": "§l§cYou seem to have done nothing",
            "err9": "§l§cPlease enter the fixed reward correctly\nRange: 1-100000",
            "err10": "§l§cPlease input the random minimum reward correctly\nRange: 1-100000",
            "err11": "§l§cPlease input the random maximum reward correctly\nRange: 1-100000",
            "err12": "§l§cThe random minimum reward is greater than or equal to the random maximum reward\nThe current maximum reward is: ",
            "err13": "§l§cPlease input the fixed rewards for members correctly\nRange: 1-100000",
            "err14": "§l§cPlease input the fixed rewards for members correctly\nRange: 1-100000",
            "err15": "§l§cPlease input the maximum random reward for members correctly\nRange: 1-100000",
            "err16": "§l§cMember random minimum reward greater than or equal to random maximum reward\nCurrent maximum reward is: ",
            "err17": "§l§2Set successfully",
            "tell1": "§cYou are not an administrator and cannot change the configuration",
            "tell2": "§2Cancel Settings",
            "tell3": "§cCancel Settings",
            "tell4": "§cHas not changed anything",
            "tell5": "§cWhat you filled in seems to be no different from before",
            "tell6": "§eThe scoreboard server you just filled in does not exist",
            "tell7": "§eThe scoreboard in the configuration file does not exist on the server",
            "tell8": "§2Has completed changes",
            "tell9": "§2Has completed changes",
            "tell10": "§2Has completed changes",
            "tell11": "§cIt seems like you haven't done anything",
            "tell12": "§cPlease enter the fixed reward correctly\nRange: 1-100000",
            "tell13": "§cPlease input the random minimum reward correctly\nRange: 1-100000",
            "tell14": "§cPlease input the random maximum reward correctly\nRange: 1-100000",
            "tell15": "§cThe random minimum reward is greater than or equal to the random maximum reward\nThe current maximum reward is: ",
            "tell16": "§cPlease enter the member's fixed reward correctly\nRange: 1-100000",
            "tell17": "§cPlease enter the member's fixed reward correctly\nRange: 1-100000",
            "tell18": "§cPlease input the maximum random reward for members correctly\nRange: 1-100000",
            "tell19": "§cThe random minimum reward for members is greater than or equal to the random maximum reward\nThe current maximum reward is:",
            "tell20": "§2Set successfully",
            "tell21": "The current server does not have a replaceable language",
            "tell22": "Cancel change",
            "tell23": "Complete the change",
            "tell24": "Language has been changed to: ",
            "title1": "§l§2Sign-in Settings",
            "content1": "§eSelect:",
            "button1a": "§1Set personal language",
            "button1b": "§1Setting Economic Parameters",
            "button1c": "§1Set check-in parameters",
            "button1d": "§1Set System Default Language",
            "title2": "§l§2Economic Allocation",
            "dropdown2": "§eSelect Economic Mode - Current: §r",
            "input2a": "§eInput scoreboard item - current: §r",
            "input2b": "§eFor example: money",
            "title3": "§l§2Kind Reminder",
            "content3": "§eThe scoreboard you filled in does not exist on the Name server, please check whether it is filled in incorrectly or now create the scoreboard you filled in immediately. \nThe current server has scoreboards as follows \n",
            "button3a": "§1Confirm creation",
            "button3b": "§1Return to refill",
            "title4": "§l§2Kind Reminder",
            "content4": "§eIt has been detected that the scoreboard in the configuration file does not exist on the server. Please check for errors or create the scoreboard you filled in now. \nThe current server has the following scoreboard \n",
            "button4a": "§1Confirm creation",
            "button4b": "§1Return to refill",
            "title5": "§l§2Modified successfully",
            "content5": "§eEconomic configuration has been changed",
            "button5a": "§1Return",
            "button5b": "§1Done",
            "title6": "§l§2check-in parameters",
            "label4": "§eNote: \n§4Carefully read the captions of each switch and input box, please fill them in correctly as required",
            "switch1": "§eCheck-in Switch---Currently: §r",
            "switch2": "§eDouble Sign---Currently: §r",
            "switch3": "§eReward Mode---Currently: §r",
            "switch4": "§eVIP Reward Mode---Currently: §r",
            "input4a1": "§eSet Fixed Rewards---Currently: §r",
            "input4b1": "For example: 666",
            "input4a2": "§eSet Minimum Reward---Currently: §r",
            "input4b2": "For example: 666",
            "input4a3": "§eSet Maximum Reward---Currently:: §r",
            "input4b3": "For example: 666",
            "input4a4": "§eSet VIP Fixed Rewards---Currently: §r",
            "input4b4": "For example: 666",
            "input4a5": "§eSet VIP Minimum Reward---Current: §r",
            "input4b5": "For example: 666",
            "input4a6": "§eSet VIP Maximum Reward---Current: §r",
            "input4b6": "For example: 666",
            "title7": "Set System Language",
            "content7": "select:"
        },
        "join": {
            "tell": "§2The economic benefits obtained from your last check-in have been distributed. Please continue to check-in tomorrow"
        }
    }));
};
function incolplayer(name) {
    var onlineplayer = mc.getOnlinePlayers()
    for (let i = 0; i < onlineplayer.length; ++i) { if (onlineplayer[i].realName == name) return true };
}
function language(langjson, langtitle) {
    const langdata = new JsonConfigFile(`./plugins/Planet/PSign/lang/${langjson}.json`);
    langdata.reload();
    return langdata.get(langtitle);
};
function random(min, max) {
    return Math.floor(Math.random() * (max - min)) + min;
};
function regcmd(list) {
    for (let i = 0; i < list.length; ++i) {
        const cmd = mc.newCommand(list[i].cmd, list[i].des, list[i].per);
        cmd.setAlias(list[i].des);
        cmd.optional("name", ParamType.RawText);
        cmd.overload(["name"]);
        cmd.setCallback((_cmd, ori, out, res) => {
            if (ori.type == 7) {
                if (list[i].cmd == "sign") {
                    offlinesign(res);
                } else { out.error(`${info}§c请不要使用控制台执行§f${list[i].cmd}§c命令`); };
            } else if (ori.player != null) {
                if (list[i].cmd == "sign") { onlinesign(ori.player); } else { signset(ori.player); };
            } else { out.error(`${info}§c请不要使用命令方块中执行§f${list[i].cmd}§c命令`); };
        });
        cmd.setup();
    }
};
function offlinesign(res) {
    var id = cmdres(res);
    var lang = langlist.Sign({ realName: "server" });
    var time = system.getTimeObj();
    var objtime = `${time.Y}-${time.M}-${time.D}`;
    if (id == null) {
        if (docking.PBind() == true) { log(`[QD] ${lang.log1}`) } else { log(`[QD] ${lang.log2}`) };
    } else {
        var name = "";
        for (let i = 0; i < id.length; ++i) {
            name += `${id[i]} `;
        }
        name = name.replace(/(^\s*)|(\s*$)/g, "");
        if (docking.PBind() == true) {
            if (!isNaN(id[0])) {
                if (docking.PBindQQdata(id[0]) == null) {
                    log(`[QD] ${lang.log3}`);
                } else {
                    name = docking.PBindQQdata(id[0]).gameid;
                    offlinesign();
                }
            } else {
                offlinesign();
            };
        } else {
            if (!isNaN(id[0])) {
                log(`[QD] ${lang.log4}`);
            } else {
                offlinesign();
            };
        };
    };
    function offlinesign() {
        if (config.getSign().switch == false) {
            log(`[QD] ${lang.log5}`);
        } else if (config.getSign().fixed == 0 && config.getSign().minreward >= config.getSign().maxreward) {
            colorLog("red", `[QD] ${lang.log6}`);
        } else if (config.getSign().vipfixed == 0 && config.getSign().vipfixed == true && config.getSign().vipminreward >= config.getSign().vipmaxreward) {
            colorLog("red", `[QD] ${lang.log7}`);
        } else if (config.getSign().breakoffsign == true) {
            if (docking.Timer() == true) {
                var timedata = docking.TimerData().get(name);
                if (timedata == null) {
                    log(`[QD] ${lang.log9}`);
                } else {
                    var strtime = system.getTimeStr()
                    var interval = (new Date(strtime).getTime() - new Date(timedata.LastLogin).getTime()) / (1000 * 60 * 60 * 24)
                    if (Math.ceil(interval) > config.getSign().breakoffsignday) {
                        log(`[QD] ${lang.log10.replace("{day}", config.getSign().breakoffsignday)}`)
                    } else { signfu() };
                }
            } else { signfu() };
        } else { signfu() };
        function signfu() {
            if (config.getSign().switch == true) {
                if (sign.getPlayerData(name) == null) {
                    signfunc();
                } else if (sign.getInterval(name) >= 1) {
                    signfunc();
                } else { log(`[QD] ${lang.log8}`) };
                function signfunc() {
                    if (config.getSign().fixed == false) {
                        var reward = random(config.getSign().minreward, config.getSign().maxreward);
                        var signlog = `已获得随机经济奖励`;
                    } else {
                        var reward = config.getSign().fixed;
                        var signlog = `已获得固定经济奖励`;
                    };
                    if (config.getSign().addition && sign.getPlayerData(name) != null && sign.getInterval(name) <= 1) {
                        sign.setPlayerData(name, { count: Number(sign.getCount(name) + 1), contsign: Number(sign.getContSign(name) + 1), signdate: objtime })
                        reward = reward * 2;
                        var signlogs = `连续签到双倍奖励`;
                    } else if (sign.getPlayerData(name) == null) {
                        sign.setPlayerData(name, { count: Number(1), contsign: Number(1), reward: 0, vipreward: 0, signdate: objtime });
                        var signlogs = "这是首次签到 连续签到奖励翻倍哦";
                    } else {
                        sign.setPlayerData(name, { count: Number(sign.getCount(name) + 1), contsign: Number(1), signdate: objtime });
                        var signlogs = `昨天你没有签到 连签中断`;
                    };
                    if (docking.PCsvip() == true) {
                        if (docking.PCsvipPlayer(name) == true) {
                            if (config.getSign().vipfixed == false) {
                                var vipreward = random(config.getSign().vipminreward, config.getSign().vipmaxreward);
                                var signlogss = `,VIP额外随机经济奖励:  ${vipreward}${lang.unit2}`;
                            } else {
                                var vipreward = config.getSign().vipfixed;
                                var signlogss = `,VIP额外固定经济奖励: ${vipreward}${lang.unit2}`;
                            };
                        } else { var vipreward = 0; var signlogss = "" };
                    } else { var vipreward = 0; var signlogss = "" };
                    sign.setPlayerData(name, { reward: Number(reward), vipreward: Number(vipreward) })
                    if (incolplayer(name) == true) {
                        if (docking.PMail() == true) {
                            if (config.getSign().fixed == false) {
                                var rewardtype = `随机经济奖励: ${sign.getReward(name)}${lang.unit2}`;
                            } else { var rewardtype = `固定经济奖励: ${sign.getReward(name)}${lang.unit2}` };
                            if (sign.getVipReward(name) == 0) {
                                var mailcontent = `离线签到\n${signlogs}\n${rewardtype}`;
                            } else {
                                if (config.getSign().vipfixed == false) {
                                    var viprewardtype = `\nVIP随机经济奖励: ${sign.getVipReward(name)}${lang.unit2}`;
                                } else { var viprewardtype = `\nVIP固定经济奖励: ${sign.getVipReward(name)}${lang.unit2}` };
                                var mailcontent = `离线签到\n${signlogs}\n${rewardtype}${viprewardtype}`;
                            }
                            if (config.getMoney() == false) {
                                var reward = { score: Number(sign.getReward(name) + sign.getVipReward(name)) };
                            } else { var reward = { money: Number(sign.getReward(name) + sign.getVipReward(name)) } };
                            docking.PMailNew(name, "系统", "离线签到奖励", `\n${mailcontent}\n累计签到: ${sign.getCount(name)}${lang.unit1}\n连续签到: ${sign.getContSign(name)}${lang.unit1}`, reward)
                            sign.setPlayerData(name, { reward: 0, vipreward: 0 });
                        } else {
                            Money.add(pl, Number(sign.getReward(name) + sign.getVipReward(name)));
                            sign.setPlayerData(name, { reward: 0, vipreward: 0 });
                        };
                        log(`[QD] ${lang.log11}`);
                    } else {
                        signlog = `${signlogs},${signlog}: ${reward}${lang.unit2}${signlogss}`;
                        log(`[QD] ${signlog},${lang.log12}`);
                    };
                };
            } else {
                log(`[QD] 管理员没有开启签到功能`);
                sign.setPlayerData(name, { signdate: objtime });
            };
        }
    }
};
function onlinesign(pl, err) {
    var lang = langlist.Sign(pl);
    var time = system.getTimeObj();
    var objtime = `${time.Y}-${time.M}-${time.D}`;
    if (err == null) { lang.content1 = lang.content1 } else { lang.content1 = `${lang.content1}\n\n${err}` };
    if (config.getSign().switch == true && sign.getPlayerData(pl.realName) == null || sign.getInterval(pl.realName) >= 1) { var button1a = lang.button1a } else { var button1a = lang.button1b };
    pl.sendModalForm(lang.title1, lang.content1, button1a, lang.button1c,
        function (pl, id) {
            if (id == 0) {
                if (config.getSign().switch == true) {
                    if (sign.getPlayerData(pl.realName) == null) {
                        pl.tell(`${info}${lang.tell1}`);
                    } else if (sign.getInterval(pl.realName) >= 1) {
                        pl.tell(`${info}${lang.tell1}`);
                    };
                } else { sign.setPlayerData(pl.realName, { signdate: objtime }); };
            } else {
                if (config.getSign().switch == true) {
                    if (sign.getPlayerData(pl.realName) == null) {
                        signfunc();
                    } else if (sign.getInterval(pl.realName) >= 1) {
                        signfunc();
                    };
                    function signfunc() {
                        if (config.getSign().fixed == false) {
                            var reward = random(config.getSign().minreward, config.getSign().maxreward);
                            var signlog = `已获得随机经济奖励`;
                        } else {
                            var reward = config.getSign().fixed;
                            var signlog = `已获得固定经济奖励`;
                        };
                        if (config.getSign().addition && sign.getPlayerData(pl.realName) != null && sign.getInterval(pl.realName) <= 1) {
                            sign.setPlayerData(pl.realName, { count: Number(sign.getCount(pl.realName) + 1), contsign: Number(sign.getContSign(pl.realName) + 1), signdate: objtime })
                            reward = reward * 2;
                            var signlogs = `连续签到双倍奖励,`;
                        } else if (sign.getPlayerData(pl.realName) == null) {
                            sign.setPlayerData(pl.realName, { count: Number(1), contsign: Number(1), reward: 0, vipreward: 0, signdate: objtime });
                            var signlogs = "这是首次签到 连续签到奖励翻倍哦,";
                        } else {
                            sign.setPlayerData(pl.realName, { count: Number(sign.getCount(pl.realName) + 1), contsign: Number(1), signdate: objtime });
                            var signlogs = `昨天你没有签到 连签中断,`;
                        };
                        if (docking.PCsvip() == true) {
                            if (docking.PCsvipPlayer(pl.realName) == true) {
                                if (config.getSign().vipfixed == false) {
                                    var vipreward = random(config.getSign().vipminreward, config.getSign().vipmaxreward);
                                    var signlogss = `,VIP额外随机经济奖励:  ${vipreward}${lang.unit2}`;
                                } else {
                                    var vipreward = config.getSign().vipfixed;
                                    var signlogss = `,VIP额外固定经济奖励: ${vipreward}${lang.unit2}`;
                                };
                            } else { var vipreward = 0; var signlogss = "" };
                        } else { var vipreward = 0; var signlogss = "" };
                        signlog = `${signlogs}${signlog}: ${reward}${lang.unit2}${signlogss}`;
                        Money.add(pl, Number(reward + vipreward))
                        pl.tell(`${info}${lang.tell6}`);
                        if (docking.PMail() == true) {
                            docking.PMailNew(pl.realName, "系统", `签到成功`, `\n签到成功\n${signlog.replace(/,/g, "\n")}\n累计签到: ${sign.getCount(pl.realName)}${lang.unit1}\n连续签到: ${sign.getContSign(pl.realName)}${lang.unit1}`)
                        } else { pl.tell(`${info}${signlog}`); };
                    }
                } else { sign.setPlayerData(pl.realName, { signdate: objtime }); };
            }
        }
    )
};
function signset(pl) {
    var lang = langlist.Signset(pl);
    if (pl.isOP() == 0) {
        setlang(pl);
    } else {
        var fm = mc.newSimpleForm();
        fm.setTitle(lang.title1);
        fm.setContent(lang.content1);
        fm.addButton(lang.button1a);
        fm.addButton(lang.button1b);
        fm.addButton(lang.button1c);
        fm.addButton(lang.button1d);
        pl.sendForm(fm, function (pl, id) {
            switch (id) {
                case 0:
                    setlang(pl);
                    break;
                case 1:
                    configset(pl);
                    break;
                case 2:
                    signconfigset(pl, lang.label4);
                    break;
                case 3:
                    setsystemlang(pl);
                    break;
                default:
                    pl.tell(info + lang.tell2);
                    break;
            }
        })
    }
};
function configset(pl, err, i) {
    var lang = langlist.Signset(pl)
    var moneyc = config.getMoney()
    if (i == null) { i = moneyc }
    if (moneyc == 0) { var setmoney = lang.score } else { var setmoney = lang.llmoney }
    var scorec = config.getScore()
    var fm = mc.newCustomForm()
    fm.setTitle(lang.title2)
    fm.addDropdown(lang.dropdown2 + setmoney, [lang.score, lang.llmoney], i)
    fm.addInput(lang.input2a + scorec, lang.input2b)
    if (err != null) { fm.addLabel(err) }
    pl.sendForm(fm, function (pl, aid) {
        if (aid == null) {
            signset(pl)
        } else {
            if (aid[0] == moneyc && aid[1] == "") {
                configset(pl, lang.err1, aid[0])
                pl.tell(`${info}${lang.tell3}`)
            } else if (aid[0] == moneyc && aid[1] == scorec) {
                configset(pl, lang.err2, aid[0])
                pl.tell(`${info}${lang.tell4}`)
            } else if (aid[0] != moneyc && aid[1] == scorec) {
                configset(pl, lang.err3, aid[0])
                pl.tell(`${info}${lang.tell5}`)
            } else {
                if (aid[0] == 0 && aid[1] != "" && mc.getScoreObjective(aid[1]) == null) {
                    var serverscore = mc.getAllScoreObjectives()
                    var scorelist = []
                    for (let i = 0; i < serverscore.length; ++i) {
                        scorelist += (`${(Number(i) + 1)}. ${serverscore[i].name}\n`)
                    }
                    pl.sendModalForm(lang.title3, `${lang.content3}${scorelist}`, lang.button3a, lang.button3b,
                        function (pl, zid) {
                            if (zid == 0) {
                                configset(pl, lang.err4, aid[0])
                                pl.tell(`${info}${lang.tell6}`)
                            } else {
                                mc.newScoreObjective(aid[1], aid[1])
                                setconfig()
                            }
                        })
                } else {
                    setconfig()
                }
            }
            function setconfig() {
                config.setAll({ money: aid[0] })
                if (aid[1] != "") {
                    config.setAll({ score: aid[1] })
                }
                if (aid[0] == 0 && aid[1] == "" && mc.getScoreObjective(config.getScore()) == null) {
                    var serverscore = mc.getAllScoreObjectives()
                    var scorelist = ""
                    for (let i = 0; i < serverscore.length; ++i) {
                        scorelist += (`${(Number(i) + 1)}. ${serverscore[i].name}\n`)
                    }
                    pl.sendModalForm(lang.title4, `${lang.content4}${scorelist}`, lang.button4a, lang.button4b,
                        function (pl, zid) {
                            if (zid == 0) {
                                configset(pl, lang.err5, aid[0])
                                pl.tell(`${info}${lang.tell7}`)
                            } else {
                                mc.newScoreObjective(config.getScore(), config.getScore())
                                configset(pl, `${lang.err6}${config.getScore()}`, aid[0])
                                pl.tell(`${info}${lang.tell8}`)
                            }
                        })
                } else {
                    pl.sendModalForm(lang.title5, lang.content5, lang.button5a, lang.button5b,
                        function (pl, zid) {
                            if (zid == 0) {
                                pl.tell(`${info}${lang.tell9}`)
                            } else {
                                configset(pl, lang.err7, aid[0])
                                pl.tell(`${info}${lang.tell10}`)
                            }
                        })
                }
            }
        }
    })
};
function signconfigset(pl, err, i) {
    var lang = langlist.Signset(pl)
    if (config.getSign().switch == true) { var signswitch = "开" } else { var signswitch = "关" }
    if (config.getSign().addition == true) { var signaddition = "开" } else { var signaddition = "关" }
    if (config.getSign().fixed > 0) { var fixeds = true; var signfixed = "固定经济"; var fixed = config.getSign().fixed + lang.unit } else { var fixeds = false; var signfixed = "随机经济"; fixed = signfixed + "本项填写无效" }
    if (config.getSign().vipfixed > 0) { var vipfixeds = true; var signvipfixed = "固定经济", vipfixed = config.getSign().vipfixed + lang.unit } else { var vipfixeds = false; var signvipfixed = "随机经济"; vipfixed = signvipfixed + "本项填写无效" }
    var fm = mc.newCustomForm()
    fm.setTitle(lang.title3)
    if (err != null) { fm.addLabel(err) }
    fm.addSwitch(lang.switch1 + signswitch, config.getSign().switch)
    fm.addSwitch(lang.switch2 + signaddition, config.getSign().addition)
    fm.addSwitch(lang.switch3 + signfixed, fixeds)
    fm.addInput(`${lang.input4a1}${fixed}\n§2固定经济时才需要输入`, lang.input4b1)
    fm.addInput(`${lang.input4a2}${config.getSign().minreward}${lang.unit}\n§2随机经济时才需要输入`, lang.input4b2)
    fm.addInput(`${lang.input4a3}${config.getSign().maxreward}${lang.unit}\n§2随机经济时才需要输入`, lang.input4b3)
    fm.addSwitch(lang.switch4 + signvipfixed, vipfixeds)
    fm.addInput(`${lang.input4a4}${vipfixed}\n§2固定经济时才需要输入`, lang.input4b4)
    fm.addInput(`${lang.input4a5}${config.getSign().vipminreward}${lang.unit}\n§2随机经济时才需要输入`, lang.input4b5)
    fm.addInput(`${lang.input4a6}${config.getSign().vipmaxreward}${lang.unit}\n§2随机经济时才需要输入`, lang.input4b6)
    pl.sendForm(fm, function (pl, id) {
        if (id == null) {
            signset(pl)
        } else {
            if (id[3] == true) {
                if (!isNaN(id[4]) && id[4] > 1 && id[4] < 1000001) {
                    var fixed = parseInt(id[4])
                } else { if (id[4] == "") { var fixed = parseInt(Number(id[3])) } else { var fixed = "error" } }
                var minreward = config.getSign().minreward
                var maxreward = config.getSign().maxreward
            } else {
                var fixed = parseInt(Number(id[3]))
                if (!isNaN(id[5]) && id[5] > 1 && id[5] < 1000001) {
                    var minreward = parseInt(id[5])
                } else { if (id[5] == "") { var minreward = config.getSign().minreward } else { var minreward = "error" } }
                if (!isNaN(id[6]) && id[6] > 1 && id[6] < 1000001) {
                    var maxreward = parseInt(id[6])
                } else { if (id[6] == "") { var maxreward = config.getSign().maxreward } else { var maxreward = "error" } }
            }
            if (id[7] == true) {
                if (!isNaN(id[8]) && id[8] > 1 && id[8] < 1000001) {
                    var vipfixed = parseInt(id[8])
                } else { if (id[8] == "") { var vipfixed = parseInt(Number(id[7])) } else { var vipfixed = "error" } }
                var vipminreward = config.getSign().vipminreward
                var vipmaxreward = config.getSign().vipmaxreward
            } else {
                var vipfixed = parseInt(Number(id[6]))
                if (!isNaN(id[9]) && id[9] > 1 && id[9] < 1000001) {
                    var vipminreward = parseInt(id[9])
                } else {
                    if (id[9] == "") { var vipminreward = config.getSign().vipminreward } else { var vipminreward = "error" }
                }
                if (!isNaN(id[10]) && id[10] > 1 && id[10] < 1000001) {
                    var vipmaxreward = parseInt(id[10])
                } else {
                    if (id[10] == "") { var vipmaxreward = config.getSign().vipmaxreward } else { var vipmaxreward = "error" }
                }
            }
            if (id[1] == config.getSign().switch && id[2] == config.getSign().addition && id[3] == config.getSign().fixed && id[4] == "" && id[5] == "" && id[6] == "" && id[7] == config.getSign().vipfixed && id[8] == "" && id[9] == "" && id[10] == "") {
                signconfigset(pl, lang.err8)
                pl.tell(`${info}${lang.tell11}`)
            } else if (fixed == "error") {
                signconfigset(pl, lang.err9)
                pl.tell(`${info}${lang.tell12}`)
            } else if (minreward == "error") {
                signconfigset(pl, lang.err10)
                pl.tell(`${info}${lang.tell13}`)
            } else if (maxreward == "error") {
                signconfigset(pl, lang.err11)
                pl.tell(`${info}${lang.tell14}`)
            } else if (minreward >= maxreward) {
                signconfigset(pl, `${lang.err12}${maxreward}`)
                pl.tell(`${info}${lang.tell15}${maxreward}`)
            } else if (id[6] == 1 && vipfixed == "error") {
                signconfigset(pl, lang.err13)
                pl.tell(`${info}${lang.tell16}`)
            } else if (id[6] == 0 && vipminreward == "error") {
                signconfigset(pl, lang.err14)
                pl.tell(`${info}${lang.tell17}`)
            } else if (id[6] == 0 && vipmaxreward == "error") {
                signconfigset(pl, lang.err15)
                pl.tell(`${info}${lang.tell18}`)
            } else if (vipminreward >= vipmaxreward) {
                signconfigset(pl, `${lang.err16}${maxreward}`)
                pl.tell(`${info}${lang.tell19}${maxreward}`)
            } else {
                config.setAll({ switch: id[1], addition: id[2], fixed: fixed, minreward: minreward, maxreward: maxreward, vipfixed: vipfixed, vipminreward: vipminreward, vipmaxreward: vipmaxreward })
                signconfigset(pl, lang.err17)
                pl.tell(`${info}${lang.tell20}`)
            }
        }
    })
};
function setlang(pl) {
    var langmenu = langlist.getLang();
    if (langmenu.length == 0) {
        if (pl.langCode == "zh_CN") {
            pl.tell(`${info}当前服务器没有可更换的语言`);
        } else { pl.tell(`${info}The current server does not have a replaceable language`) };
    } else {
        if (pl.langCode == "zh_CN") {
            var title = "§l§2语言变更";
            var content = "§e选择:";
        } else {
            var title = "§l§2Language change";
            var content = "§eChoice:";
        };
        var fm = mc.newSimpleForm();
        fm.setTitle(title);
        fm.setContent(content);
        for (let i = 0; i < langmenu.length; ++i) {
            if (langmenu[i].language == languagedata.get(pl.realName)) {
                if (pl.langCode == "zh_CN") {
                    fm.addButton(`§1${langmenu[i].chinese} 当前语言`);
                } else { fm.addButton(`§1${langmenu[i].english} 当前语言`) };
            } else {
                if (pl.langCode == "zh_CN") {
                    fm.addButton(`§1${langmenu[i].chinese}`);
                } else { fm.addButton(`§1${langmenu[i].english}`) };
            };
        };
        pl.sendForm(fm, function (pl, id) {
            if (id == null) {
                if (pl.isOP() == 1) {
                    signset(pl);
                } else {
                    if (pl.langCode == "zh_CN") {
                        pl.tell(`${info}取消变更`);
                    } else { pl.tell(`${info}Cancel change`) };
                };
            } else {
                if (pl.langCode == "zh_CN") {
                    pl.tell(`${info}完成变更`);
                } else { pl.tell(`${info}Complete the change`) };
                langlist.set(pl, langmenu[id].language);
                if (pl.isOP() == 1) { signset(pl) }
                if (pl.langCode == "zh_CN") {
                    pl.tell(`${info}已更改语言为: ${langmenu[id].chinese}`);
                } else { pl.tell(`${info}Language has been changed to: ${langmenu[id].english}`) };
            }
        })
    }
};
function setsystemlang(pl) {
    var lang = langlist.Signset(pl);
    var langmenu = langlist.getLang();
    if (langmenu.length == 0) {
        pl.tell(`${info}${lang.tell21}`);
    } else {
        var fm = mc.newSimpleForm();
        fm.setTitle(lang.title7);
        fm.setContent(lang.content7);
        for (let i = 0; i < langmenu.length; ++i) {
            if (langmenu[i].language == languagedata.get("server")) {
                if (pl.langCode == "zh_CN") {
                    fm.addButton(`§1${langmenu[i].chinese} 当前语言`);
                } else { fm.addButton(`§1${langmenu[i].english} 当前语言`) };
            } else {
                if (pl.langCode == "zh_CN") {
                    fm.addButton(`§1${langmenu[i].chinese}`);
                } else { fm.addButton(`§1${langmenu[i].english}`) };
            };
        };
        pl.sendForm(fm, function (pl, id) {
            if (id == null) {
                signset(pl);
                pl.tell(`${info}${lang.tell22}`);
            } else {
                signset(pl);
                pl.tell(`${info}${lang.tell23}`);
                pl.tell(`${info}${lang.tell24}${langmenu[id].chinese}`);
                langlist.set({ realName: "server" }, langmenu[id].language);
            };
        })
    }
};
function regPAPICount(xuid) {
    if (sign.getPlayerData(mc.getPlayer(xuid).realName) != null) {
        return String(sign.getCount(mc.getPlayer(xuid).realName));
    } else { return "0" };
};
function regPAPICont(xuid) {
    if (sign.getPlayerData(mc.getPlayer(xuid).realName) != null) {
        return String(sign.getContSign(mc.getPlayer(xuid).realName));
    } else { return "0" };
};
function regPAPIDate(xuid) {
    if (sign.getPlayerData(mc.getPlayer(xuid).realName) != null) {
        return sign.getSignDate(mc.getPlayer(xuid).realName);
    } else { return "0" };
};
//新版外接接口
ll.export(sign.getAll, "PSign", "all");
ll.export(sign.getPlayerData, "PSign", "playerdata");
ll.export(sign.getCount, "PSign", "count");
ll.export(sign.getContSign, "PSign", "contsign");
ll.export(sign.getReward, "PSign", "reward");
ll.export(sign.getVipReward, "PSign", "vipreward");
ll.export(sign.getSignDate, "PSign", "signdate");
ll.export(sign.getInterval, "PSign", "interval");
//向下兼容
ll.export(sign.getState, "PSign", "state");
ll.export(sign.getPlayerData, "signcount");
ll.export(sign.getAll, "signdata");

mc.listen("onServerStarted", () => {
    if (File.exists(`./plugins/Planet/PSign/lang/zh_CN.json`) == false) { createfile() };
    if (File.exists(`./plugins/Planet/PSign/lang/en_US.json`) == false) { createfile() };
    if (configdata.get("version") < "1.1.0") {
        File.delete(`./plugins/Planet/PSign/lang/zh_CN.json`);
        File.delete(`./plugins/Planet/PSign/lang/en_US.json`);
        createfile()
    };
    regcmd([{ cmd: "sign", des: "签到", per: PermType.Any }, { cmd: "signset", des: "签到设置", per: PermType.Any }]);
    if (docking.PMail() == true) {
        if (String(ll.getPluginInfo("PMail").version).replace(/,/g, '.') == "1.0.5" && docking.PMailReg("系统").state == true) { colorLog("yellow", "注册邮件系统发件人成功") };
    };
    if (config.getVersion() < `${versions}${fixvers}`) {
        config.setAll({ version: `${versions}${fixvers}` });
        colorLog("red", "当前配置文件版本与插件版本不匹配,已更新配置文件版本");
    } else if (config.getVersion() > `${versions}${fixvers}`) { colorLog("red", "当前配置文件版本高于插件版本插件可能存在问题,请删除config.json重启服务器") };
    network.httpGet(url, (status, result) => {
        if (status == 200) {
            var httpinfo = JSON.parse(result);
            var httpvers = `v${httpinfo.version}${httpinfo.fixvers}`;
            if (true)
            colorLog("yellow", `网络连接成功`);
        } else { colorLog("red", "网络故障或无法访问目标网站以获取插件更新内容") };
    })
    if (docking.PAPI() == true) {
        docking.PAPIjs().registerPlayerPlaceholder(regPAPICount, "PSign", "PS_Count");
        docking.PAPIjs().registerPlayerPlaceholder(regPAPICont, "PSign", "PS_Cont");
        docking.PAPIjs().registerPlayerPlaceholder(regPAPIDate, "PSign", "PS_Date");
    };
    if (File.exists(`./plugins/Planet/PSign/lang/undefuned.json`) == true) { File.delete(`./plugins/Planet/PSign/lang/undefuned.json`) }
})
mc.listen("onJoin", (pl) => {
    if (langlist.get(pl) == null) { langlist.set(pl, "zh_CN") };
    var lang = langlist.Sign(pl);
    if (sign.getPlayerData(pl.realName) == null || sign.getInterval(pl.realName) > 0) { onlinesign(pl) };
    if (sign.getPlayerData(pl.realName) != null && sign.getVipReward(pl.realName) == null) { sign.setPlayerData(pl.realName, { vipreward: 0 }) };
    if (sign.getPlayerData(pl.realName) != null && sign.getReward(pl.realName) > 0) {
        if (docking.PMail() == true) {
            if (config.getSign().fixed == false) {
                var rewardtype = `随机经济奖励: ${sign.getReward(pl.realName)}${lang.unit2}`;
            } else { var rewardtype = `固定经济奖励: ${sign.getReward(pl.realName)}${lang.unit2}` };
            if (sign.getVipReward(pl.realName) == 0) {
                var mailcontent = `离线签到\n${rewardtype}`;
            } else {
                if (config.getSign().vipfixed == false) {
                    var viprewardtype = `\nVIP随机经济奖励: ${sign.getVipReward(pl.realName)}${lang.unit2}`;
                } else { var viprewardtype = `\nVIP固定经济奖励: ${sign.getVipReward(pl.realName)}${lang.unit2}` };
                var mailcontent = `离线签到\n${rewardtype}${viprewardtype}`;
            }
            if (config.getMoney() == false) {
                var reward = { score: Number(sign.getReward(pl.realName) + sign.getVipReward(pl.realName)) };
            } else { var reward = { money: Number(sign.getReward(pl.realName) + sign.getVipReward(pl.realName)) } };
            docking.PMailNew(pl.realName, "系统", "离线签到奖励", `\n${mailcontent}\n累计签到: ${sign.getCount(pl.realName)}${lang.unit1}\n连续签到: ${sign.getContSign(pl.realName)}${lang.unit1}`, reward)
            sign.setPlayerData(pl.realName, { reward: 0, vipreward: 0 });
        } else {
            Money.add(pl, Number(sign.getReward(pl.realName) + sign.getVipReward(pl.realName)));
            sign.setPlayerData(pl.realName, { reward: 0, vipreward: 0 });
            pl.tell(`${info}${langlist.Join(pl).tell}`);
        };
    };
})

if (fixvers == "") { var fix = " 正式版" } else { var fix = `${fixvers} 开发版` }
ll.registerPlugin("PSign", "Sign Plugins", regvers, { Author: author, Docs: `https://docs.mcmap.top/#/plugins/LLSE/PSign`, Names: "签到插件", Fixvers: fix.replace(/ /, "") })
log(`签到插件---加载成功,当前版本: ${versions}${fix} 作者: ${author}`)