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;
2012-04-27 11:47:11 +02:00
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.skills.AbilityType;
import com.gmail.nossr50.skills.SkillType;
import com.gmail.nossr50.skills.Skills;
2012-04-27 11:47:11 +02:00
import com.gmail.nossr50.util.Users;
public class SkillMonitor implements Runnable {
private final mcMMO plugin;
2012-04-27 11:47:11 +02:00
public SkillMonitor(final mcMMO plugin) {
2012-04-27 11:47:11 +02:00
this.plugin = plugin;
}
@Override
public void run() {
long curTime = System.currentTimeMillis();
for (Player player : plugin.getServer().getOnlinePlayers()) {
2012-07-03 16:04:04 +02:00
PlayerProfile profile = Users.getProfile(player);
2012-04-27 11:47:11 +02:00
/*
* MONITOR SKILLS
*/
for (SkillType skill : SkillType.values()) {
if (skill.getTool() != null && skill.getAbility() != null) {
2012-07-03 16:04:04 +02:00
Skills.monitorSkill(player, profile, curTime, skill);
2012-04-27 11:47:11 +02:00
}
}
/*
* COOLDOWN MONITORING
*/
for (AbilityType ability : AbilityType.values()) {
if (ability.getCooldown() > 0 ) {
2012-07-03 16:04:04 +02:00
Skills.watchCooldown(player, profile, ability);
2012-04-27 11:47:11 +02:00
}
}
}
}
}