How do I summon a chest at a certain spot? (No Config)

Discussion in 'Plugin Development' started by xCyclonez, Jan 8, 2017.

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

    xCyclonez

    So, I am developing a plugin as a Investigation Project, and I was hoping to create some sort of Envoy plugin. I've seen Envoy plugins on servers like CosmicPvP, TheArchon, and many more. Well, I'm trying to figure out how to make chest(s) summon every 30 minutes, and then after about 5 minutes disappear.
     
  2. Get the chest locations and manipulate them getBlock()
     
  3. Offline

    DoggyCode™

    I believe the chest is treated as a Block, so you can spawn it by using World's method to place a block at a specific location. Store this location. I also believe you can use World's method to get the Block at the stored location, then cast the Block's BlockState to Chest, then use Chest's getBlockInventory which returns Inventory which you can then directly edit ;)
     
  4. Code:
    world.getBlockAt(Location).setType(Material.CHEST)
    Then get the blockstate and edit inventory. If your going to make an envoy like plugin I recommend you use the config, it helps store locations items and all sorts.
     
  5. Offline

    xCyclonez

    Well, I don't really know how to make / use configs. The only experience I have is customizing it for my server (
     
  6. Offline

    DoggyCode™

    You could always store the chests in runtime, but that would mean that any chest placed before restart wouldn't work anymore.
     
  7. Offline

    xCyclonez

    What do I do for the locations?
     
  8. Offline

    JanTuck

    Well i believe they have a square they pick random spots in. A square you could do something like getting a random position then getting the top. With a loop.
     
  9. Offline

    xCyclonez

    I believe the chest is treated as a Block, so you can spawn it by using World's method to place a block at a specific location. Store this location. I also believe you can use World's method to get the Block at the stored location, then cast the Block's BlockState to Chest, then use Chest's getBlockInventory which returns Inventory which you can then directly edit ;)


    I don't get how to do this
     
  10. Offline

    JanTuck

    I have an example laying around i can give you tomorrow, have a great night.

    Sendt fra min ALE-L21 med Tapatalk
     
Thread Status:
Not open for further replies.

Share This Page