configから使えない秒数を取得して
それを毎秒1ずつ減らしていき、使えない間に右クリックしたら
残りの秒数を表示する。0になったら再使用可能、というものを
作ろうとしたのですが、残り秒数を表示させる方法が思いつきません。
どのようにすればいいでしょうか。
code 一部抜粋
- コード: 全て選択
public class SkillCast implements Listener{
int count;
-----------------------------------------
右クリック検知
-----------------------------------------
if(player.hasMetadata("Skill_Cooldown"){
final int cooldown = skills.getInt(upper_skill + ".class" + "." + job_type + ".cooldown");
new BukkitRunnable(){
int cool = cooldown;
@Override
public void run(){
if(cool > 0){
cool--;
count = cool;
}
if(cool == 0){
player.removeMetadata("Skill_Cooldown", Main.plugin);
this.cancel();
}
}
}.runTaskTimer(Main.plugin, 0, 20);
}else if(player.hasMetadata("Skill_Cooldown")){
player.sendMessage(ChatColor.DARK_RED + name + " は現在クールダウン中です. 残り " + ChatColor.RED +
count + ChatColor.DARK_RED + "秒");
}
}
これだと他の同じような処理と被ってしまってうまく動かないんですよね