Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Events in events

Comments in 'Plugin Development' started by Marcelo234, Mar 16, 2016.

  1. Marcelo234
    Offline

    Marcelo234 New Member

    Joined:
    Oct 18, 2014
    Posts:
    204
    Hey Guys...The function Getlastdamagecause() is for the EntityDamageEvent.... How to write this?: If A Player tap a Block the Plugin should get the last damage..... So here are two events :EntityDamageEvent and Plerinteractevent.... Because I can't write a Event into a Event
    Thanks Marcelo234
  2. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    ??? getLastDamageCause is for Player object.
    CraftYourBukkit and PEMapModder like this.
  3. Marcelo234
    Offline

    Marcelo234 New Member

    Joined:
    Oct 18, 2014
    Posts:
    204
    No the The last damage cause should get from the Player.....So i want to have the lastdamagecause from the Player,not from the Block :D
  4. Marcelo234
    Offline

    Marcelo234 New Member

    Joined:
    Oct 18, 2014
    Posts:
    204
    Someone has an idea?:ยง
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    So basically, you mean, you want to get the last block interaction of the player, right? You have to use a session array to store it yourself.
  6. Marcelo234
    Offline

    Marcelo234 New Member

    Joined:
    Oct 18, 2014
    Posts:
    204
    No....A Player Hit another player....If the hitted player tap a Block after few seconds the Player get a message:"The Player Gargl Hit you at least..."
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Then you can still use getLastDamageCause(). What is the difference? Use it in the same way you use it in PlayerDeathEvent.
  8. Marcelo234
    Offline

    Marcelo234 New Member

    Joined:
    Oct 18, 2014
    Posts:
    204
    Ok? I would Test it....I tought the Playerinteractevent hasn't this function..
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PlayerInteractEvent does not have a getLastDamageCause() function. PlayerDeathEvent doesn't either. However, both of these events have a function that returns a Player instance, and a Player is an Entity, and the Entity class has a getLastDamageCause() function.
    getLastDamageCause() has never been directly related to PlayerDeathEvent. You can use it anywhere, as long as you make appropraite checks.
    Legoboy0215 likes this.

Share This Page

Advertisement