2012-01-09 20:00:13 +01:00
|
|
|
package com.gmail.nossr50.runnables;
|
2012-03-07 22:53:54 +01:00
|
|
|
|
2012-04-01 06:11:57 +02:00
|
|
|
import org.bukkit.entity.Player;
|
2012-01-09 20:00:13 +01:00
|
|
|
|
|
|
|
import com.gmail.nossr50.Users;
|
|
|
|
import com.gmail.nossr50.mcMMO;
|
2012-03-01 22:01:41 +01:00
|
|
|
import com.gmail.nossr50.datatypes.AbilityType;
|
2012-01-09 20:00:13 +01:00
|
|
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
2012-02-27 23:28:32 +01:00
|
|
|
import com.gmail.nossr50.datatypes.SkillType;
|
2012-01-09 20:00:13 +01:00
|
|
|
import com.gmail.nossr50.skills.Skills;
|
|
|
|
|
2012-04-01 06:11:57 +02:00
|
|
|
public class mcTimer implements Runnable {
|
|
|
|
private final mcMMO plugin;
|
2012-01-09 20:00:13 +01:00
|
|
|
|
2012-04-01 06:11:57 +02:00
|
|
|
public mcTimer(final mcMMO plugin) {
|
2012-01-09 20:00:13 +01:00
|
|
|
this.plugin = plugin;
|
|
|
|
}
|
2012-04-01 06:11:57 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
long curTime = System.currentTimeMillis();
|
|
|
|
|
|
|
|
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
|
|
|
if (player == null) { //Is this even possible?
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
PlayerProfile PP = Users.getProfile(player);
|
|
|
|
|
|
|
|
if (PP == null) { //Is this even possible?
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MONITOR SKILLS
|
|
|
|
*/
|
2012-04-24 15:21:21 +02:00
|
|
|
for (SkillType skill : SkillType.values()) {
|
|
|
|
if (skill.getTool() != null && skill.getAbility() != null) {
|
|
|
|
Skills.monitorSkill(player, PP, curTime, skill);
|
|
|
|
}
|
|
|
|
}
|
2012-04-01 06:11:57 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* COOLDOWN MONITORING
|
|
|
|
*/
|
2012-04-24 15:21:21 +02:00
|
|
|
for (AbilityType ability : AbilityType.values()) {
|
|
|
|
if (ability.getCooldown() > 0 ) {
|
|
|
|
Skills.watchCooldown(player, PP, curTime, ability);
|
|
|
|
}
|
|
|
|
}
|
2012-04-01 06:11:57 +02:00
|
|
|
}
|
|
|
|
}
|
2012-01-09 20:00:13 +01:00
|
|
|
}
|