Falcon 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...
Falcon 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 331 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. Link to comment Share on other sites More sharing options...
Hashtag 8671 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
Archived
This topic is now archived and is closed to further replies.