Jump to content

World hopping in order


Recommended Posts

Posted
53 minutes ago, legacyZZ said:

Hello there, ive been stuck at this line of code im trying to create. 

So basically i want to hop P2P worlds but in order 302>303>304>305>306>307>309 etc..

Ive seen this line of code

hopToP2PWorld()
Hops to a random P2P server which is not full or is PvP.
 

 

But this is used for random hopping and not what i need

Any1 could help me out 

 :D

hop(int world)

Posted
1 hour ago, legacyZZ said:

Just that?

Here's some pseudo-ish code:

get a list of all the worlds i.e. getWorlds.getAvailableWorlds()

Iterate through this list and pick out the ones that are paid worlds using .isMembersWorld() and put them in your own list of worlds maybe call it membersWorldsList

find the index of the current world within that membersWorldsList you just created 

hop to membersWorldsList[index+1] until the end then wrap around... maybe consider a linked list or something

 

Havn't tested or tried this specific problem yet - but thats how Id go about solving it

😀

Posted
7 hours ago, legacyZZ said:

Hello there, ive been stuck at this line of code im trying to create. 

So basically i want to hop P2P worlds but in order 302>303>304>305>306>307>309 etc..

Ive seen this line of code

hopToP2PWorld()
Hops to a random P2P server which is not full or is PvP.
 

 

But this is used for random hopping and not what i need

Any1 could help me out 

 :D

    private int nextWorldInOrder(boolean members) {
        return getWorlds().getAvailableWorlds(true)
                .stream()
                .filter(world -> !world.isPvpWorld() && world.isMembers() == members && !world.getActivity().contains("skill") && !world.getActivity().contains("Deadman") && world.getId() > getWorlds().getCurrentWorld())
                .min(Comparator.comparingInt(World::getId))
                .map(World::getId)
                .orElseGet(() -> members ? 302 : 301);
    }

and then 

        getWorlds().hop(nextWorldInOrder(true));

should work for you, if u want to use total level worlds aswell then parseInt of world acrivity and check if ur total level > required

  • Heart 1

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...