mcMMO/src/main/java/com/gmail/nossr50/runnables/SkillMonitor.java

47 lines
1.3 KiB
Java
Raw Normal View History

2012-04-27 11:47:11 +02:00
package com.gmail.nossr50.runnables;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
2012-05-01 19:58:47 +02:00
import com.gmail.nossr50.util.Skills;
2012-04-27 11:47:11 +02:00
import com.gmail.nossr50.util.Users;
public class SkillMonitor implements Runnable {
private final mcMMO plugin;
public SkillMonitor(final mcMMO plugin) {
this.plugin = plugin;
}
@Override
public void run() {
long curTime = System.currentTimeMillis();
for (Player player : plugin.getServer().getOnlinePlayers()) {
PlayerProfile PP = Users.getProfile(player);
/*
* MONITOR SKILLS
*/
for (SkillType skill : SkillType.values()) {
if (skill.getTool() != null && skill.getAbility() != null) {
Skills.monitorSkill(player, PP, curTime, skill);
}
}
/*
* COOLDOWN MONITORING
*/
for (AbilityType ability : AbilityType.values()) {
if (ability.getCooldown() > 0 ) {
Skills.watchCooldown(player, PP, curTime, ability);
}
}
}
}
}