Disable Fly when Near Enemy player (faction)

Discussion in 'Plugin Development' started by 808sFinest, Mar 26, 2016.

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

    808sFinest

    Hey guys, I need help creating a way to disable player fly when 30 blocks near an enemy/neutral player.
    this is what I got so far ->http://pastebin.com/iWjGxf0R
     
  2. Online

    timtower Administrator Administrator Moderator

    @808sFinest Don't add a Constructor to your plugin.
    Moved to plugin development.
     
  3. Offline

    808sFinest

    okay sorry about that, do you know how to delete this?

    @timtower

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
  4. Online

    timtower Administrator Administrator Moderator

    @808sFinest No need to remove the thread, I moved it already.
     
  5. Offline

    CoderRex

    first things first im the realest ok

    1- you have to be able to get the players who are around you that are enemies
    2- then you have to make a if statement saying if e.getentity is flying p.get player disable fly
    3- might want to add a message to the player who is flying that an enemy is here
    4- code is not correct in number 2 you have to write it youself sry
     
  6. Offline

    808sFinest

  7. Offline

    I Al Istannen

  8. Offline

    Swakiny


    Idk how factions actually works. Maybe you can get the players factions name and compare to nearbyplayers factions name
     
  9. Offline

    808sFinest

  10. Offline

    I Al Istannen

    @808sFinest
    Please post the full stacktrace of the error. Could not pass event PlayerMoveEvent is very unspecific.
     
  11. Offline

    808sFinest

  12. Offline

    mcdorli

    1. Caused by: java.lang.NullPointerException
    2. at com.finest.fly.EnemyNear.onPlayerMove(EnemyNear.java:25) ~[?:?]
    This is what you're looking for
     
  13. Offline

    808sFinest

    http://pastebin.com/A9gXhGfH
    When player is 5+ blocks away from player it says "player is nearby" and "player is not nearby" too.
    Does anybody know the solution? I only want player is not nearby to run.
     
    Last edited: Mar 27, 2016
  14. Offline

    Zombie_Striker

    @808sFinest
    1. Fix your formatting.
    2. Player move events get triggered when a player moves in any direction or if they move their head (which means it can be triggered multiple times per tick) Try testing first if the player even moved in any direction before continuing with the checks.
     
  15. Offline

    808sFinest

  16. Offline

    mythbusterma

Thread Status:
Not open for further replies.

Share This Page