Advertisement
Guest User

Untitled

a guest
Jan 10th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1. public class Quest {
  2.  
  3. public String getQuestGroup() {
  4. return questGroup;
  5. }
  6.  
  7. public void setQuestGroup(String questGroup) {
  8. this.questGroup = questGroup;
  9. }
  10.  
  11. public String getQuestName() {
  12. return questName;
  13. }
  14.  
  15. public void setQuestName(String questName) {
  16. this.questName = questName;
  17. }
  18.  
  19. public List<String> getItemLore() {
  20. return itemLore;
  21. }
  22.  
  23. public void setItemLore(List<String> itemLore) {
  24. this.itemLore = itemLore;
  25. }
  26.  
  27. public Player getPlayer() {
  28. return player;
  29. }
  30.  
  31. public void setPlayer(Player player) {
  32. this.player = player;
  33. }
  34.  
  35. public HashMap<String, String> getConfigPath() {
  36. return configPath;
  37. }
  38.  
  39. public void setConfigPath(HashMap<String, String> configPath) {
  40. this.configPath = configPath;
  41. }
  42.  
  43. private String questName;
  44. private String questGroup;
  45. private HashMap<String,String> configPath = new HashMap<String,String>();
  46. private List<String> itemLore = new ArrayList<String>();
  47. private Player player;
  48. private ConfigFile cf;
  49.  
  50. public Quest(String questName,String questGroup, HashMap<String,String> configPath, Player player, ConfigFile cf, List<String> itemLore) {
  51. this.questGroup = questGroup;
  52. this.questName = questName;
  53. this.configPath = configPath;
  54. this.player = player;
  55. this.cf = cf;
  56. this.itemLore = itemLore;
  57. }
  58.  
  59. public void setupConfig() {
  60. for(String s : configPath.keySet()) {
  61. String value = configPath.get(s);
  62. if (value.equalsIgnoreCase("false")){
  63. cf.getConfig().set(s,false);
  64. }else if (value.equalsIgnoreCase("true")){
  65. cf.getConfig().set(s,true);
  66. }else{
  67. try {
  68. int valueAsInteger = Integer.parseInt(value);
  69. cf.getConfig().set(s,valueAsInteger);
  70. } catch (NumberFormatException e) {
  71. cf.getConfig().set(s,configPath.get(s));
  72. }
  73. }
  74. }
  75. cf.saveConfig();
  76. }
  77.  
  78. public boolean setGUIItem(ItemStack itemStack) {
  79. boolean ifActive = cf.getConfig().getBoolean("PlayerQuests."+player.getUniqueId()+".quests."+ questName +".active");
  80. ItemMeta im = itemStack.getItemMeta();
  81. im.setLore(itemLore);
  82. if (ifActive){
  83. im.setDisplayName(ChatColor.GREEN+questName);
  84. itemStack.addUnsafeEnchantment(Enchantment.getById(120),1);
  85. itemStack.setItemMeta(im);
  86. return true;
  87. }else{
  88. im.setDisplayName(ChatColor.RED+questName);
  89. itemStack.setItemMeta(im);
  90. return false;
  91. }
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement