SkillMonitor.java 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package com.gmail.nossr50.runnables;
  2. import org.bukkit.entity.Player;
  3. import com.gmail.nossr50.mcMMO;
  4. import com.gmail.nossr50.datatypes.AbilityType;
  5. import com.gmail.nossr50.datatypes.PlayerProfile;
  6. import com.gmail.nossr50.datatypes.SkillType;
  7. import com.gmail.nossr50.util.Skills;
  8. import com.gmail.nossr50.util.Users;
  9. public class SkillMonitor implements Runnable {
  10. private final mcMMO plugin;
  11. public SkillMonitor(final mcMMO plugin) {
  12. this.plugin = plugin;
  13. }
  14. @Override
  15. public void run() {
  16. long curTime = System.currentTimeMillis();
  17. for (Player player : plugin.getServer().getOnlinePlayers()) {
  18. PlayerProfile PP = Users.getProfile(player);
  19. /*
  20. * MONITOR SKILLS
  21. */
  22. for (SkillType skill : SkillType.values()) {
  23. if (skill.getTool() != null && skill.getAbility() != null) {
  24. Skills.monitorSkill(player, PP, curTime, skill);
  25. }
  26. }
  27. /*
  28. * COOLDOWN MONITORING
  29. */
  30. for (AbilityType ability : AbilityType.values()) {
  31. if (ability.getCooldown() > 0 ) {
  32. Skills.watchCooldown(player, PP, ability);
  33. }
  34. }
  35. }
  36. }
  37. }