How to set a chest where lightning strikes?

Discussion in 'Plugin Development' started by cube_smasher, Jun 28, 2014.

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

    cube_smasher

    I am creating my first plugin, it is wherever lightning strikes it will spawn a chest full of items.
    Here is what i have i am not sure where to go from here -
    Code:java
    1. package me.cube_smasher;
    2.  
    3. import org.bukkit.event.EventHandler;
    4. import org.bukkit.event.Listener;
    5. import org.bukkit.event.weather.LightningStrikeEvent;
    6.  
    7. public class PlayerListener implements Listener{
    8.  
    9. public PlayerListener(Zeus plugin) {
    10. plugin.getServer().getPluginManager().registerEvents(this, plugin);
    11. }
    12.  
    13. @EventHandler
    14. public void zap(LightningStrikeEvent event) {
    15.  
    16. }
    17.  
    18. }
    19.  
     
  2. Offline

    Mammothskier

    Get the location of the LightningStrikeEvent, get the highest block at that location and change it to a chest. Then you will need to add items to the chest.
     
  3. Offline

    Plo124

    Mammothskier
    You need to add 1 to the max y, otherwise the chest will be in ground, or could overwrite another chest, or in a protected area destroy something, e.t.c
     
  4. Offline

    Mammothskier

    Plo124
    Right, forgot about that.
     
  5. Offline

    cube_smasher

    I'm sorry but how would i do this this is my first plugin and I'm not very familiar with java I'm still learning
     
Thread Status:
Not open for further replies.

Share This Page