Solved Check if OnBowShootEvent is done by a play

Discussion in 'Plugin Development' started by MinecraftMart, Jun 8, 2014.

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

    MinecraftMart

    Everybody, you must understand i feel ashamed right now...

    Ive been making 4 plugins now but i never had to check if the event was triggered by a player.

    So i think it works a little different with the OnBowShootEvent. Does somebody know how to check if the event is triggered by a player?
     
  2. Offline

    Monkey_Swag

    MinecraftMart
    if(e.getShooter() instaceof Player)){
    // super amazing code that'll beat the best developer alive
    }

    ?
     
  3. Offline

    MinecraftMart

    Monkey_Swag

    there is no getShooter()

    AdamQpzm

    You mean?
    Code:java
    1. if(e.getEntity() instanceof Player){}
     
  4. Offline

    TCO_007

    Code:java
    1. //You need to "classify the entity as the shooter so
    2. if (e.getEnitity().getShooter() instance of Player){
    3. //Other code for if it is true
    4. }
    5.  

    MinecraftMart
     
  5. Offline

    MinecraftMart

    TCO_007

    Okay well adams way worked too xD but i was getting the player from the entity before checkin if it whas a player. So thats why it gave me the error.. i wasnt doing the instanceof wrong lol
     
  6. Offline

    TCO_007

    Ok haha. As long as you got it solved, thats all I care about XD MinecraftMart
     
Thread Status:
Not open for further replies.

Share This Page