Solved Cancelling Entity Tracking

Discussion in 'Plugin Development' started by xYourFreindx, May 31, 2014.

Thread Status:
Not open for further replies.
  1. Hello,
    I'm trying to provide a vanish option with a plugin I'm working on,​
    and part of being vanished, is being vanished to mobs.​
    I've tried...​
    Code:java
    1.  
    2. @EventHandler
    3. public void onEntityTarget(EntityTargetLivingEntityEvent e){
    4. if (getConfig().getBoolean("CameraMode.PlayersInCM.AreInvincible") == true) {
    5. if (e.getTarget() instanceof Player) {
    6. if (flyplayers.contains(e.getTarget().getUniqueId().toString())){
    7. e.setCancelled(true);
    8. e.setTarget(null);
    9. }
    10. }
    11. }
    12. }

    But players are still being targeted by slimes and ghasts,​
    and if already targeted, will continue to be targeted even while vanished. ​

    Other than that, it works fine. Players vanished, will not be targeted.
    What could I do to improve this? ​

    Anyone?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 1, 2016
  2. Last edited by a moderator: Jul 1, 2016
Thread Status:
Not open for further replies.

Share This Page