Spawning a wall of lava

Discussion in 'Plugin Development' started by sunny.zhang, Aug 5, 2014.

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

    sunny.zhang

    I want to spawn a wall of lava around a player. It must be 5 blocks high and 2 blocks wide and goes around the whole player. Here is my current code:
    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd,String commandLabel, String args[]) {
    2. if(commandLabel.equalsIgnoreCase("lava")){
    3. if(args.length == 0){
    4. Player player = (Player) sender;
    5. player.sendMessage(ChatColor.RED + "LOOK ABOVE MWAHAHA!");
    6. Location location = player.getLocation();
    7. location.setY(location.getY() + 2);
    8. Block block = location.getBlock();
    9. block.setType(Material.LAVA);
    10. }else if(args.length == 1){
    11. Player target = Bukkit.getServer().getPlayer(args[0]);
    12. Location location = target.getLocation();
    13. target.sendMessage(ChatColor.RED + "Look .. above!!!");
    14. location.setY(location.getY() + 2);
    15. Block block = location.getBlock();
    16. block.setType(Material.LAVA);
    17. }
    18. }

    I did not find a way to get multiple blocks to be spawned though, help is appreciated thanks!
     
  2. Offline

    Code0

    Well, the way I'd do it,

    Is just get each block around the player, by doing player.getLocation() and then adding x,y and z values to it to get the target block.
     
  3. Offline

    sunny.zhang

    Ok but how do you target multiple x,y and z values?
     
Thread Status:
Not open for further replies.

Share This Page