Taming.java 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package com.gmail.nossr50.skills.taming;
  2. import org.bukkit.EntityEffect;
  3. import org.bukkit.entity.AnimalTamer;
  4. import org.bukkit.entity.EntityType;
  5. import org.bukkit.entity.Player;
  6. import org.bukkit.entity.Tameable;
  7. import org.bukkit.entity.Wolf;
  8. import com.gmail.nossr50.config.AdvancedConfig;
  9. import com.gmail.nossr50.config.experience.ExperienceConfig;
  10. import com.gmail.nossr50.locale.LocaleLoader;
  11. public class Taming {
  12. public static int environmentallyAwareUnlockLevel = AdvancedConfig.getInstance().getEnviromentallyAwareUnlock();
  13. public static int holyHoundUnlockLevel = AdvancedConfig.getInstance().getHolyHoundUnlock();
  14. public static int fastFoodServiceUnlockLevel = AdvancedConfig.getInstance().getFastFoodUnlock();
  15. public static double fastFoodServiceActivationChance = AdvancedConfig.getInstance().getFastFoodChance();
  16. public static int goreBleedTicks = AdvancedConfig.getInstance().getGoreBleedTicks();
  17. public static int goreMaxBonusLevel = AdvancedConfig.getInstance().getGoreMaxBonusLevel();
  18. public static int goreModifier = AdvancedConfig.getInstance().getGoreModifier();
  19. public static double goreMaxChance = AdvancedConfig.getInstance().getGoreChanceMax();
  20. public static int sharpenedClawsUnlockLevel = AdvancedConfig.getInstance().getSharpenedClawsUnlock();
  21. public static int sharpenedClawsBonusDamage = AdvancedConfig.getInstance().getSharpenedClawsBonus();
  22. public static int shockProofUnlockLevel = AdvancedConfig.getInstance().getShockProofUnlock();
  23. public static int shockProofModifier = AdvancedConfig.getInstance().getShockProofModifier();
  24. public static int thickFurUnlockLevel = AdvancedConfig.getInstance().getThickFurUnlock();
  25. public static int thickFurModifier = AdvancedConfig.getInstance().getThickFurModifier();
  26. public static int wolfXp = ExperienceConfig.getInstance().getTamingXPWolf();
  27. public static int ocelotXp = ExperienceConfig.getInstance().getTamingXPOcelot();
  28. public static boolean canPreventDamage(Tameable pet, AnimalTamer owner) {
  29. return pet.isTamed() && owner instanceof Player && pet instanceof Wolf;
  30. }
  31. public static double processThickFur(Wolf wolf, double damage) {
  32. wolf.playEffect(EntityEffect.WOLF_SHAKE);
  33. return damage / thickFurModifier;
  34. }
  35. public static void processThickFurFire(Wolf wolf) {
  36. wolf.playEffect(EntityEffect.WOLF_SMOKE);
  37. wolf.setFireTicks(0);
  38. }
  39. public static double processShockProof(Wolf wolf, double damage) {
  40. wolf.playEffect(EntityEffect.WOLF_SHAKE);
  41. return damage / shockProofModifier;
  42. }
  43. public static void processHolyHound(Wolf wolf, double damage) {
  44. double modifiedHealth = Math.min(wolf.getHealth() + damage, wolf.getMaxHealth());
  45. wolf.setHealth(modifiedHealth);
  46. wolf.playEffect(EntityEffect.WOLF_HEARTS);
  47. }
  48. protected static String getCallOfTheWildFailureMessage(EntityType type) {
  49. switch (type) {
  50. case OCELOT:
  51. return LocaleLoader.getString("Taming.Summon.Fail.Ocelot");
  52. case WOLF:
  53. return LocaleLoader.getString("Taming.Summon.Fail.Wolf");
  54. default:
  55. return "";
  56. }
  57. }
  58. }