SHARE
TWEET

Untitled

a guest May 19th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package mystic.core.classes;
  2.  
  3. import java.util.List;
  4. import java.util.Map;
  5.  
  6. import org.bukkit.ChatColor;
  7. import org.bukkit.configuration.serialization.ConfigurationSerializable;
  8.  
  9. import mystic.core.Handler;
  10. import mystic.core.Requirement;
  11. import mystic.core.user.User;
  12. import mystic.core.utility.ChatComponent;
  13.  
  14. public abstract class Classes implements ConfigurationSerializable {
  15.  
  16.     protected int LEVEL = 0;
  17.  
  18.     public abstract String getName();
  19.  
  20.     public abstract String getPassive();
  21.  
  22.     public abstract List<String> getSpells();
  23.  
  24.     public abstract List<Requirement> getRequirements();
  25.  
  26.     public abstract void init(Map<String, Object> map);
  27.  
  28.     public abstract int getMaxLevel();
  29.  
  30.     public int getLevel() {
  31.         return LEVEL;
  32.     }
  33.  
  34.     public void setLevel(int lvl) {
  35.         LEVEL = lvl;
  36.         if (LEVEL > getMaxLevel())
  37.             LEVEL = getMaxLevel();
  38.     }
  39.  
  40.     public void addLevel(int lvl) {
  41.         LEVEL += lvl;
  42.         if (LEVEL > getMaxLevel())
  43.             LEVEL = getMaxLevel();
  44.     }
  45.  
  46.     public abstract void applyBenefit(User u);
  47.  
  48.     public Classes() {
  49.  
  50.     }
  51.  
  52.     public boolean canTakeClasses(User u) {
  53.         int total = 0;
  54.         for (Requirement req : getRequirements()) {
  55.             if (req.meetRquirement(u)) {
  56.                 total++;
  57.             }
  58.         }
  59.         return total >= getRequirements().size();
  60.     }
  61.  
  62.     public ChatComponent getPage() {
  63.         ChatComponent pages = new ChatComponent(ChatColor.DARK_RED + getName());
  64.         pages.appendChatComponent(new ChatComponent("\n").clean());
  65.         pages.appendChatComponent(new ChatComponent("\n").clean());
  66.         pages.appendChatComponent(new ChatComponent(
  67.                 ChatColor.GOLD + "" + ChatColor.BOLD + "Passive: " + ChatColor.GREEN + "" + getPassive())
  68.                         .addHoverText(Handler.getSpellInstance(getPassive()).descToPages()));
  69.         pages.appendChatComponent(new ChatComponent("\n").clean());
  70.         pages.appendChatComponent(new ChatComponent("\n").clean());
  71.  
  72.         pages.appendChatComponent(new ChatComponent(ChatColor.GOLD + "" + ChatColor.BOLD + "Active: \n"));
  73.         for (String s : getSpells()) {
  74.             pages.appendChatComponent(new ChatComponent(ChatColor.GREEN + s + "\n")
  75.                     .addHoverText(Handler.getSpellInstance(s).descToPages()));
  76.         }
  77.         pages.appendChatComponent(new ChatComponent("\n").clean());
  78.         pages.appendChatComponent(new ChatComponent("\n").clean());
  79.         ChatComponent click = new ChatComponent(ChatColor.AQUA + "" + ChatColor.BOLD + "SELECT")
  80.                 .addHoverText(ChatColor.GOLD + "Input here to pick this class")
  81.                 .addClickInsert("mc classes zet " + getName());
  82.         pages.appendChatComponent(click);
  83.         return pages;
  84.     }
  85.  
  86. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top