• 周年纪念勋章活动已圆满结束,如有已购买但仍未申请的用户,可以通过对应勋章的下载链接申请~

已解决 求找个(或做)LLBDS公告个插件

解决方案
JavaScript:
"use strict";

const path = "plugins/Notice/notice.txt";
if (!File.exists(path)) File.writeTo(path, "");
mc.listen("onJoin", (pl) => {
    const fm = mc.newSimpleForm();
    fm.setTitle("公告");
    const notice = File.readFrom(path);
    fm.setContent(notice);
    pl.sendForm(fm, (_pl, _arg) => {});
});
JavaScript:
"use strict";

const path = "plugins/Notice/notice.txt";
if (!File.exists(path)) File.writeTo(path, "");
mc.listen("onJoin", (pl) => {
    const fm = mc.newSimpleForm();
    fm.setTitle("公告");
    const notice = File.readFrom(path);
    fm.setContent(notice);
    pl.sendForm(fm, (_pl, _arg) => {});
});
 
解决方案
JavaScript:
"use strict";

const path = "plugins/Notice/notice.txt";
if (!File.exists(path)) File.writeTo(path, "");
mc.listen("onJoin", (pl) => {
    const fm = mc.newSimpleForm();
    fm.setTitle("公告");
    const notice = File.readFrom(path);
    fm.setContent(notice);
    pl.sendForm(fm, (_pl, _arg) => {});
});
大佬太牛逼了吧??
 
JavaScript:
"use strict";

const path = "plugins/Notice/notice.txt";
if (!File.exists(path)) File.writeTo(path, "");
mc.listen("onJoin", (pl) => {
    const fm = mc.newSimpleForm();
    fm.setTitle("公告");
    const notice = File.readFrom(path);
    fm.setContent(notice);
    pl.sendForm(fm, (_pl, _arg) => {});
});
怎么换行呢?
 
大佬能不能加一个游戏时输入指令,比如/g时也会弹出公告?我需要配合一个菜单插件使用,谢谢大佬!?
JavaScript:
"use strict";

const path = "plugins/Notice/notice.txt";
if (!File.exists(path)) File.writeTo(path, "");
mc.listen("onJoin", sendNotice);
mc.listen("onServerStarted", () => {
    const cmd = mc.newCommand("notice", "查看公告。", PermType.Any);
    cmd.overload();
    cmd.setCallback((_cmd, ori, out, _res) => {
        if (!ori.player) return out.error("commands.generic.noTargetMatch");
        sendNotice(ori.player);
    });
    cmd.setup();
});

function sendNotice(pl) {
    const notice = File.readFrom(path);
    pl.sendForm(
        mc.newSimpleForm().setTitle("公告").setContent(notice),
        (_pl, _arg) => {}
    );
}
 
打赏用户

在线会员

  • Radiation_pi
  • abcd43295
  • XiaoLou
  • 海贝壳
  • llllapland
  • 圣影
  • s648555685
  • badragon
  • 古怪ilil
  • 清茶菌
  • 离川
  • xinghe0635
  • fect
  • bluezjx
  • Apostles
  • xian2024
  • isuo
  • 天禅吖TvT
  • wfyjm
  • 2409460473
  • PuddingKC
...和 74 更多。
后退
顶部 底部