Placing fire where a player is standing?

Discussion in 'Plugin Development' started by stuntguy3000, Apr 24, 2012.

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

    stuntguy3000

    Hello again! :)

    Now I am new to the whole player location block changing stuff and require assistance ;)
    What the aim of my plugin to do is to simply place fire where the user is standing on command.

    I have no idea how to get the player location, or how to add a block (fire) where they are standing xD

    Example: Lets say I wanted to light a fireplace, I would stand ON The fireplace and it would light w/ a command :)

    Cheers!
    ~Luke
     
  2. Offline

    SirTyler

    Code:java
    1.  
    2. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    3. if(args.length == 1) {
    4. String cmd = args[0];
    5. if(cmd.equalsIgnoreCase("fire")) {
    6. ((Player) sender).getLocation().getBlock().getRelative(BlockFace.UP).setType(Material.FIRE);
    7. return true;
    8. }
    9. return false;
    10. }
    11.  
     
    stuntguy3000 likes this.
  3. Offline

    stuntguy3000

    Haha one line, I thought it was a lot more... Thanks!!!

    Actually I have a issue
    Its not placing the fire, i did a test and it knows the block under,...... Any ideas?

    EDIT: I know the issue, fixing now!

    -Sorry for the triple post 0.o-

    How can I get the block the user is pointing at? I have no idea where to begin xD

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016
  4. Offline

    SirTyler

    JavaDoc
     
Thread Status:
Not open for further replies.

Share This Page