好的,我想要它,所以如果播放器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);
}发布于 2014-03-10 04:58:35
RequestHelp helper = new RequestHelp();
if(playerCommand.equals("::help")) {
helper.callForHelp(client);
}这应该是可行的。
https://stackoverflow.com/questions/22287288
复制相似问题