DarkFalcon 0 Share Posted April 14, 2021 World world = new World().getWorld() Is it intentional that this returns me an integer of 300 regardless of the world I am in? Link to comment Share on other sites More sharing options...
DarkFalcon 0 Author Share Posted April 14, 2021 Didn't figgure out why it gave me 300 but found a static method getCurrentWorld() which did what I needed. Link to comment Share on other sites More sharing options...
Bonfire 323 Share Posted April 14, 2021 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. DarkFalcon 1 Link to comment Share on other sites More sharing options...
Hashtag 8357 Share Posted April 14, 2021 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now