Solved How can i kill player while collide with armorstand

Discussion in 'Spigot Plugin Development' started by Carster, Feb 8, 2020.

  1. I'm wonderng how i can kill player while player connecting with armorstands
     
  2. Probably your best shot of detecting collisions is to schedule a 1-Tick task where you check if the distance between stand and player is lower than a certain threshold
     
    • Like Like x 2
  3. In
    player.getWorld().spawnEntity(player.getLocation() Can i do so it spawn it like 1 block backward the player and not in the player?
     
  4. If you want to spawn the armor stand 1 block backward the player, you can do the following.
    Code (Text):
    Location location = player.getLocation();
    Vector direction = location.getDirection();
    location.add(-direction.getX(), 0, -direction.getZ());
    location.getWorld().spawnEntity(location, EntityType.ARMOR_STAND);
    For the collision detection, you can use events.
     
  5. armorstand.setHelmet do not work with
    Code (Text):
    Location location = player.getLocation();
    Vector direction = location.getDirection();
    location.add(-direction.getX(), 0, -direction.getZ());
    location.getWorld().spawnEntity(location, EntityType.ARMOR_STAND);
     
  6. Try replacing
    Code (Java):
    location.getWorld().spawnEntity(location, EntityType.ARMOR_STAND);
    with
    Code (Java):
    location.getWorld().spawnEntity(location, ArmorStand.class);
     
    • Agree Agree x 1