runescape私有服务器从另一个类调用方法

时间:2014-03-09 19:51:26

标签: java command

好的,所以我想要它,所以如果播放器typs :: help,来自RequestHelp.java的方法将会运行,

命令if (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);
}

1 个答案:

答案 0 :(得分:0)

RequestHelp helper = new RequestHelp();
if(playerCommand.equals("::help")) {
    helper.callForHelp(client);
}

这应该有用。