ExcavationCommand.java 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package com.gmail.nossr50.commands.skills;
  2. import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
  3. import com.gmail.nossr50.datatypes.skills.SubSkillType;
  4. import com.gmail.nossr50.mcMMO;
  5. import com.gmail.nossr50.skills.excavation.ExcavationManager;
  6. import net.md_5.bungee.api.chat.TextComponent;
  7. import org.bukkit.entity.Player;
  8. import java.util.ArrayList;
  9. import java.util.List;
  10. public class ExcavationCommand extends SkillCommand {
  11. private String gigaDrillBreakerLength;
  12. private String gigaDrillBreakerLengthEndurance;
  13. private boolean canGigaDrill;
  14. private boolean canTreasureHunt;
  15. public ExcavationCommand(mcMMO pluginRef) {
  16. super(PrimarySkillType.EXCAVATION, pluginRef);
  17. }
  18. @Override
  19. protected void dataCalculations(Player player, double skillValue) {
  20. // GIGA DRILL BREAKER
  21. if (canGigaDrill) {
  22. String[] gigaDrillStrings = formatLengthDisplayValues(player, skillValue);
  23. gigaDrillBreakerLength = gigaDrillStrings[0];
  24. gigaDrillBreakerLengthEndurance = gigaDrillStrings[1];
  25. }
  26. }
  27. @Override
  28. protected void permissionsCheck(Player player) {
  29. canGigaDrill = pluginRef.getPermissionTools().gigaDrillBreaker(player) && pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER);
  30. canTreasureHunt = canUseSubskill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY);
  31. }
  32. @Override
  33. protected List<String> statsDisplay(Player player, double skillValue, boolean hasEndurance, boolean isLucky) {
  34. List<String> messages = new ArrayList<>();
  35. ExcavationManager excavationManager = pluginRef.getUserManager().getPlayer(player).getExcavationManager();
  36. if (canGigaDrill) {
  37. messages.add(getStatMessage(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, gigaDrillBreakerLength)
  38. + (hasEndurance ? pluginRef.getLocaleManager().getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : ""));
  39. //messages.add(pluginRef.getLocaleManager().getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? pluginRef.getLocaleManager().getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : ""));
  40. }
  41. if(canUseSubskill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
  42. messages.add(getStatMessage(false, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,
  43. percent.format(excavationManager.getArchaelogyExperienceOrbChance() / 100.0D)));
  44. messages.add(getStatMessage(true, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,
  45. String.valueOf(excavationManager.getExperienceOrbsReward())));
  46. }
  47. return messages;
  48. }
  49. @Override
  50. protected List<TextComponent> getTextComponents(Player player) {
  51. List<TextComponent> textComponents = new ArrayList<>();
  52. pluginRef.getTextComponentFactory().getSubSkillTextComponents(player, textComponents, PrimarySkillType.EXCAVATION);
  53. return textComponents;
  54. }
  55. }