此代码应该等待.help
在聊天中输入,然后发送一条消息说"Help text."
。什么都没发生。
package testplugin.HelpMe;
import java.util.logging.Logger;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.event.player.PlayerChatEvent;
public class HelpMe extends JavaPlugin implements {
Logger log;
public void onEnable(){
log = this.getLogger();
log.info("Your plugin has been enabled!");
}
public void onDisable(){
log.info("Your plugin has been disabled.");
}
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
return false;
}
public void onChat(PlayerChatEvent event) {
if (event.getMessage().startsWith(".help"))
{
event.getPlayer().sendMessage("Help text.");
event.setCancelled(true);
}
}
}