Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Error is QuestSkeleton


    kamilo
     Share

    Recommended Posts

    this was written by @Articron https://github.com/articron/Quest-skeleton?files=1

    and recommended to me to use as a template, therefore i started off placing all the files in my folder but im getting an error in AbstractQuest.java

    package org.dreambot.articron.quest;
    
    import org.dreambot.api.methods.quest.Quest;
    import org.dreambot.articron.node.NodeTask;
    
    import java.util.ArrayList;
    import java.util.Collections;
    import java.util.List;
    
    @SuppressWarnings("deprecation")
    public abstract class AbstractQuest<T extends QuestHandler> {
    
        /**
         */
        private List<NodeTask<T>> nodes;
        private T handler;
    
    
        public AbstractQuest(T handler) {
            nodes = new ArrayList<>();
            loadNodes();
            this.handler = handler;
        }
    
        @SuppressWarnings("rawtypes")
    	public void addNodes(NodeTask...tasks) {
            Collections.addAll(nodes, tasks); //** RIGHT HERE 
      // Error: The method addAll(Collection<? super T>, T...) in the type Collections is not applicable for the arguments (List<NodeTask<T>>, NodeTask[])
    
        }
    
        public int onLoop() {
            for (NodeTask<T> task : nodes) {
                if (task.isValid(handler)) {
                    return task.execute(handler);
                }
            }
            return 600;
        }
    
        public T getHandler() {
            return handler;
        }
    
        /*
         * Returns if we started the quest
         */
        public abstract boolean hasStarted();
    
        /*
         * Returns if we finished the quest
         */
        public abstract boolean isFinished();
    
        /*
         * The playersetting used to track our progression
         */
        public abstract int getPlayerSetting();
    
        /*
         * Load in your nodes
         */
         protected abstract void loadNodes();
    
        /*
         * The Quest enum constant equivalent
         */
        @SuppressWarnings("deprecation")
    	public abstract Quest getQuest();
    
    }

     

    Also in QuestManager.java

    package org.dreambot.articron.quest;
    
    import org.dreambot.api.methods.quest.Quest;
    
    import java.util.ArrayList;
    import java.util.Collections;
    import java.util.List;
    import java.util.function.Predicate;
    import java.util.stream.Collectors;
    
    public class QuestManager {
    
        private List<AbstractQuest<? extends QuestHandler>> quests;
    
        public QuestManager() {
            this.quests = new ArrayList<>();
        }
    
        public void addQuests(AbstractQuest... quests) {
            Collections.addAll(this.quests,quests); // RIGHT HERE
    // Error: The method addAll(Collection<? super T>, T...) in the type Collections is not applicable for the arguments (List<AbstractQuest<? extends QuestHandler>>, AbstractQuest[])
    
        }
    
        public AbstractQuest getFirstUnfinishedQuest() {
            return getQuest(quest -> !quest.isFinished());
        }
    
        /*
         * All sort of getters to fit your needs
         */
    
        public List<AbstractQuest> getAllStartedQuests() {
            return quests.stream().filter(AbstractQuest::hasStarted).collect(Collectors.toList());
        }
    
        public List<AbstractQuest> getAllFinishedQuests() {
            return quests.stream().filter(AbstractQuest::isFinished).collect(Collectors.toList());
        }
    
        public List<AbstractQuest> getNonStartedQuests() {
            return quests.stream().filter(quest -> !quest.isFinished() && !quest.hasStarted()).collect(Collectors.toList());
        }
    
        public Quest[] getAddedQuests() {
            List<Quest> quests = new ArrayList<>();
            for (AbstractQuest quest : this.quests) {
                quests.add(quest.getQuest());
            }
            return quests.toArray(new Quest[quests.size()]);
        }
    
        public AbstractQuest getQuest(Quest constant) {
            return quests.stream().filter(quest -> quest.getQuest() == constant).findFirst().orElse(null);
        }
    
        public AbstractQuest getQuest(Predicate<AbstractQuest> predicate) {
            return quests.stream().filter(predicate::test).findFirst().orElse(null);
        }
    
        public boolean hasFinished(Quest constant) {
            AbstractQuest quest = getQuest(q -> q.getQuest() == constant);
            return quest != null && quest.isFinished();
        }
    
        public boolean hasStarted(Quest constant) {
            AbstractQuest quest = getQuest(q -> q.getQuest() == constant);
            return quest != null && quest.hasStarted();
        }
    
    }

     

    Both cases im getting The method addAll(Collection<? super T>, T...) in the type Collections is not applicable for the arguments (List<AbstractQuest<? extends QuestHandler>>, AbstractQuest[])

    error, since im new to using nodes and classes can someone point out how to fix this

    Link to comment
    Share on other sites

    Just imported your code into my IDE and it seems fine, is there any chance that some of the classes haven't been imported or something along those lines? 

     

    Edit: Update your package directory to whatever package you have created. 

    package org.dreambot.articron.quest;

     

    Edited by Koschei
    Update
    Link to comment
    Share on other sites

    3 hours ago, Koschei said:

    Just imported your code into my IDE and it seems fine, is there any chance that some of the classes haven't been imported or something along those lines? 

     

    Edit: Update your package directory to whatever you have it as. 

    package org.dreambot.articron.quest;

    Should be whatever you have it as. 

     

    i just downloaded the whole package and even tried file by file copy and paste im stilll getting those errors

    only in those 2 files where collections.addAll inst applicable etc...

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.