Getting a block at a specific point

Discussion in 'Plugin Development' started by Awesom_AA, Sep 3, 2020.

Thread Status:
Not open for further replies.
  1. Offline

    Awesom_AA

    Say I want to get a block at some specific coordinates in the overworld. I have no player, no event, nothing like that where I can use the getWorld method. How can I do this?

    At first I was starting to do something like Location loc = new Location (World.Environment.NORMAL, 0, 100, 0); and then Block b = loc.getBlock(); but the World.Environment.NORMAL is a World.Environment instead of a world.

    If you are wondering why I would need this, its for some code inside a runnable in the onEnable event.
     
  2. Online

    timtower Administrator Administrator Moderator

    @Awesom_AA You need to input a world object there...
    Bukkit.getWorld(name)
     
  3. Offline

    Awesom_AA

    What string goes into the method? Seems like it should be "world" but I just wanted to make sure with you
     
  4. Offline

    Strahan

    No String at all. Look at the constructor info in the docs. You need a World there.
     
  5. Offline

    Awesom_AA

    Not talking about that. What goes into bukkit.getWorld(). It needs a string...
     
  6. Online

    timtower Administrator Administrator Moderator

    The name of the world...
     
Thread Status:
Not open for further replies.

Share This Page