mcTimer.java 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package com.gmail.nossr50.runnables;
  2. import org.bukkit.entity.*;
  3. import com.gmail.nossr50.Combat;
  4. import com.gmail.nossr50.Users;
  5. import com.gmail.nossr50.mcMMO;
  6. import com.gmail.nossr50.datatypes.AbilityType;
  7. import com.gmail.nossr50.datatypes.PlayerProfile;
  8. import com.gmail.nossr50.datatypes.SkillType;
  9. import com.gmail.nossr50.locale.mcLocale;
  10. import com.gmail.nossr50.skills.Skills;
  11. import com.gmail.nossr50.skills.Swords;
  12. public class mcTimer implements Runnable
  13. {
  14. private final mcMMO plugin;
  15. int thecount = 1;
  16. public mcTimer(final mcMMO plugin)
  17. {
  18. this.plugin = plugin;
  19. }
  20. public void run()
  21. {
  22. long curTime = System.currentTimeMillis();
  23. for(Player player : plugin.getServer().getOnlinePlayers())
  24. {
  25. if(player == null)
  26. continue;
  27. PlayerProfile PP = Users.getProfile(player);
  28. if(PP == null)
  29. continue;
  30. /*
  31. * MONITOR SKILLS
  32. */
  33. Skills.monitorSkill(player, PP, curTime, SkillType.AXES);
  34. Skills.monitorSkill(player, PP, curTime, SkillType.EXCAVATION);
  35. Skills.monitorSkill(player, PP, curTime, SkillType.HERBALISM);
  36. Skills.monitorSkill(player, PP, curTime, SkillType.MINING);
  37. Skills.monitorSkill(player, PP, curTime, SkillType.SWORDS);
  38. Skills.monitorSkill(player, PP, curTime, SkillType.UNARMED);
  39. Skills.monitorSkill(player, PP, curTime, SkillType.WOODCUTTING);
  40. /*
  41. * COOLDOWN MONITORING
  42. */
  43. Skills.watchCooldown(player, PP, curTime, AbilityType.SKULL_SPLIITER);
  44. Skills.watchCooldown(player, PP, curTime, AbilityType.GIGA_DRILL_BREAKER);
  45. Skills.watchCooldown(player, PP, curTime, AbilityType.GREEN_TERRA);
  46. Skills.watchCooldown(player, PP, curTime, AbilityType.SUPER_BREAKER);
  47. Skills.watchCooldown(player, PP, curTime, AbilityType.SERRATED_STRIKES);
  48. Skills.watchCooldown(player, PP, curTime, AbilityType.BERSERK);
  49. Skills.watchCooldown(player, PP, curTime, AbilityType.TREE_FELLER);
  50. Skills.watchCooldown(player, PP, curTime, AbilityType.BLAST_MINING);
  51. /*
  52. * PLAYER BLEED MONITORING
  53. */
  54. if(thecount % 2 == 0 && PP.getBleedTicks() >= 1)
  55. {
  56. //Never kill with Bleeding
  57. if(player.getHealth() - 2 < 0)
  58. {
  59. if(player.getHealth() - 1 > 0)
  60. Combat.dealDamage(player, 1);
  61. } else
  62. Combat.dealDamage(player, 2);
  63. PP.decreaseBleedTicks();
  64. if(PP.getBleedTicks() == 0)
  65. player.sendMessage(mcLocale.getString("Swords.StoppedBleeding"));
  66. }
  67. /*
  68. * NON-PLAYER BLEED MONITORING
  69. */
  70. if(thecount % 2 == 0)
  71. Swords.bleedSimulate(plugin);
  72. //SETUP FOR HP REGEN/BLEED
  73. thecount++;
  74. if(thecount >= 81)
  75. thecount = 1;
  76. }
  77. }
  78. }