SkillUnlockNotificationTask.java 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package com.gmail.nossr50.runnables.skills;
  2. import com.gmail.nossr50.datatypes.player.McMMOPlayer;
  3. import com.gmail.nossr50.datatypes.skills.SubSkillType;
  4. import com.gmail.nossr50.mcMMO;
  5. import org.bukkit.scheduler.BukkitRunnable;
  6. public class SkillUnlockNotificationTask extends BukkitRunnable {
  7. private final mcMMO pluginRef;
  8. private final McMMOPlayer mcMMOPlayer;
  9. private final SubSkillType subSkillType;
  10. /**
  11. * Notify a player about a newly unlocked subskill
  12. *
  13. * @param mcMMOPlayer target player
  14. * @param subSkillType the subskill that they just unlocked
  15. */
  16. public SkillUnlockNotificationTask(mcMMO pluginRef, McMMOPlayer mcMMOPlayer, SubSkillType subSkillType) {
  17. this.pluginRef = pluginRef;
  18. this.mcMMOPlayer = mcMMOPlayer;
  19. this.subSkillType = subSkillType;
  20. }
  21. /**
  22. * When an object implementing interface <code>Runnable</code> is used
  23. * to create a thread, starting the thread causes the object's
  24. * <code>run</code> method to be called in that separately executing
  25. * thread.
  26. * <p>
  27. * The general contract of the method <code>run</code> is that it may
  28. * take any action whatsoever.
  29. *
  30. * @see Thread#run()
  31. */
  32. @Override
  33. public void run() {
  34. //mcMMOPlayer.getPlayer().sendTitle(subSkillType.getLocaleName(), "Rank "+rank, 7, 20, 7);
  35. pluginRef.getNotificationManager().sendPlayerUnlockNotification(mcMMOPlayer, subSkillType);
  36. }
  37. }