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
  • Confused about "getWorld()" method


    DarkFalcon
     Share

    Recommended Posts

    22 minutes ago, DarkFalcon said:

    Didn't figgure out why it gave me 300 but found a static method getCurrentWorld() which did what I needed.

    I believe it is due to the fact that when a new "World" object is instantiated, it has, by default, an ID of "0". This ID is then appended to the number "300" to get the world's ID. This does not return the ID of your currently world, just the ID of the World object.

    For example, if the World were to have an ID of "10", doing World.getWorld() would return "310".

    Happy to hear that you found a method for getting your current world that works for you. I personally use the same method.

     

    Link to comment
    Share on other sites

    Just like with many of the API's classes, you don't want to create new instances of them yourself. You're supposed to use API methods such as Worlds.getMyWorld(), Worlds.getRandomWorld() or Worlds.getWorld(World::isF2P).

    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.