繁体   English   中英

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

[英]runescape private server calling a method from another class

好的,所以我想要这样,如果玩家输入:: 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' } 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);
}
RequestHelp helper = new RequestHelp();
if(playerCommand.equals("::help")) {
    helper.callForHelp(client);
}

这应该工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM