FallingBlock with Material.getMaterial(string);

Discussion in 'Plugin Development' started by Löwenpower, Jul 27, 2014.

?

Youre meaning :P

Poll closed Aug 10, 2014.
  1. This is Strange.

    0 vote(s)
    0.0%
  2. I have a answer.

    0 vote(s)
    0.0%
  3. You are blind. Dont you see it? -_-

    0 vote(s)
    0.0%
  4. aoeifijepijapiu93uz8huiaöwjpf

    0 vote(s)
    0.0%
  5. lol

    0 vote(s)
    0.0%
  6. I dont understand english

    0 vote(s)
    0.0%
  7. What is Bukkit?

    0 vote(s)
    0.0%
  8. lol. I cant code.

    0 vote(s)
    0.0%
  9. I gonna die.

    0 vote(s)
    0.0%
  10. I hate you.

    0 vote(s)
    0.0%
Multiple votes are allowed.
Thread Status:
Not open for further replies.
  1. Offline

    Löwenpower

    I have a strange error:
    I have a command, which shoots FallingBlocks in different directions.
    The command looks like this: /blib shotblock <block name> <count> <speed>...
    I type in /blib shotblock wool 10 1
    My Code for creating the FallingBlock:

    Code:java
    1. FallingBlock fbl = loc.getWorld().spawnFallingBlock(loc, Material.getMaterial(m), (byte)0);
    2. System.out.println("spawn");
    3. fbl.setDropItem(false);
    4. System.out.println("drop item false");
    5. fbl.setVelocity(new Vector(speed*(Math.random() - Math.random()),speed*(Math.random()),speed*(Math.random() - Math.random())));


    Only: It does not work.
    The Error Code does not tell me anything...
    The funny thing is, it works when i do not Material.getString(string).
    When i do Material.WOOL it works O__o .
    Just confused.
     
  2. Offline

    Totom3

    Löwenpower Do you get "spawn" and "drop item false" in the console ? Perhaps it doesn't find the right material for the falling sand and the method just fail silently ? Could you show us the code where you get/set the value for the m variable ?
     
  3. Offline

    xTigerRebornx

    Löwenpower Post the full code and the full errors.
     
  4. Offline

    NathanWolf

    Have you tried "WOOL" on your command? You may just need a toUpperCase in there.

    I normally use valueOf though, so I honestly am not sure about getMaterial.
     
  5. Offline

    fireblast709

  6. Offline

    Löwenpower

    Hello Guys ;)
    I think i got the solution.
    I read in a thread, i have to make if.
    sry, my english isnt that good.
    I think it have to be such this ;(
    Code:java
    1. if(m == Material.WOOL){
    2. // spawn FallingBlock with Material.WOOL
    3. }
    4. else if(m == Material. //...
     
Thread Status:
Not open for further replies.

Share This Page