Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Quest {
- public String getQuestGroup() {
- return questGroup;
- }
- public void setQuestGroup(String questGroup) {
- this.questGroup = questGroup;
- }
- public String getQuestName() {
- return questName;
- }
- public void setQuestName(String questName) {
- this.questName = questName;
- }
- public List<String> getItemLore() {
- return itemLore;
- }
- public void setItemLore(List<String> itemLore) {
- this.itemLore = itemLore;
- }
- public Player getPlayer() {
- return player;
- }
- public void setPlayer(Player player) {
- this.player = player;
- }
- public HashMap<String, String> getConfigPath() {
- return configPath;
- }
- public void setConfigPath(HashMap<String, String> configPath) {
- this.configPath = configPath;
- }
- private String questName;
- private String questGroup;
- private HashMap<String,String> configPath = new HashMap<String,String>();
- private List<String> itemLore = new ArrayList<String>();
- private Player player;
- private ConfigFile cf;
- public Quest(String questName,String questGroup, HashMap<String,String> configPath, Player player, ConfigFile cf, List<String> itemLore) {
- this.questGroup = questGroup;
- this.questName = questName;
- this.configPath = configPath;
- this.player = player;
- this.cf = cf;
- this.itemLore = itemLore;
- }
- public void setupConfig() {
- for(String s : configPath.keySet()) {
- String value = configPath.get(s);
- if (value.equalsIgnoreCase("false")){
- cf.getConfig().set(s,false);
- }else if (value.equalsIgnoreCase("true")){
- cf.getConfig().set(s,true);
- }else{
- try {
- int valueAsInteger = Integer.parseInt(value);
- cf.getConfig().set(s,valueAsInteger);
- } catch (NumberFormatException e) {
- cf.getConfig().set(s,configPath.get(s));
- }
- }
- }
- cf.saveConfig();
- }
- public boolean setGUIItem(ItemStack itemStack) {
- boolean ifActive = cf.getConfig().getBoolean("PlayerQuests."+player.getUniqueId()+".quests."+ questName +".active");
- ItemMeta im = itemStack.getItemMeta();
- im.setLore(itemLore);
- if (ifActive){
- im.setDisplayName(ChatColor.GREEN+questName);
- itemStack.addUnsafeEnchantment(Enchantment.getById(120),1);
- itemStack.setItemMeta(im);
- return true;
- }else{
- im.setDisplayName(ChatColor.RED+questName);
- itemStack.setItemMeta(im);
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement