SkillManager.java 1022 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package com.gmail.nossr50.skills;
  2. import org.bukkit.entity.Player;
  3. import com.gmail.nossr50.datatypes.PlayerProfile;
  4. import com.gmail.nossr50.util.Misc;
  5. import com.gmail.nossr50.util.Permissions;
  6. import com.gmail.nossr50.util.Users;
  7. public abstract class SkillManager {
  8. protected Player player;
  9. protected PlayerProfile profile;
  10. protected int skillLevel;
  11. protected int activationChance;
  12. public SkillManager(Player player, SkillType skill) {
  13. this.player = player;
  14. this.profile = Users.getProfile(player);
  15. this.skillLevel = profile.getSkillLevel(skill);
  16. this.activationChance = Misc.calculateActivationChance(Permissions.lucky(player, skill));
  17. }
  18. public Player getPlayer() {
  19. return player;
  20. }
  21. public PlayerProfile getProfile() {
  22. return profile;
  23. }
  24. public int getSkillLevel() {
  25. return skillLevel;
  26. }
  27. public int getActivationChance() {
  28. return activationChance;
  29. }
  30. }