【问题标题】:runescape private server calling a method from another classrunescape 私有服务器调用另一个类的方法
【发布时间】:2014-04-12 19:06:17
【问题描述】:

好的,所以我想要它,所以如果玩家输入 ::help,RequestHelp.java 中的方法将运行,

Commandif (playerCommand.startsWith("help") && (c.playerRights >= 0)) { c.sendMessage("A staff member has been contacted, please wait."); (right here is where I want the method from the other class to run' }

这是 RequestHelp.java 中的方法

    public static void callForHelp(Client c) {
    if (System.currentTimeMillis() - c.lastRequest < 30000) {
        c.sendMessage("It has only been "+ getTimeLeft(c) +" seconds since your last request for help!");
        c.sendMessage("Please only request help from the staff every 30 seconds!");
        if (!requestingHelp) {
            c.setSidebarInterface(3, 3213);
            c.getPA().sendFrame106(3);
        }
        return;
    }
    requestingHelp = true;
    otherPlayer = c.playerName;
    c.lastRequest = System.currentTimeMillis();
    setInterface(c);
    PlayerHandler.messageAllStaff(Misc.optimizeText(getPlayer().playerName) +" needs help, their cords are: "+ playerCoords() +".", true);
}

【问题讨论】:

  • 问题是什么?

标签: java command


【解决方案1】:
RequestHelp helper = new RequestHelp();
if(playerCommand.equals("::help")) {
    helper.callForHelp(client);
}

这应该可行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-09-06
    • 1970-01-01
    • 1970-01-01
    • 2021-08-31
    • 1970-01-01
    • 2012-12-24
    • 1970-01-01
    相关资源
    最近更新 更多