Jump to content

World hopping in order


legacyZZ

Recommended Posts

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

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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

😀

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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