1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Protection radius

Discussion in 'Plugin Help' started by Koyotazu, Feb 15, 2022.

  1. Koyotazu

    Koyotazu Creeper

    Messages:
    4
    GitHub:
    Koyotazu
    C Since it is the correct code for protection in PM4, I am doing this but it does not protect at all

    if ($spawn->distance($ev->getBlock()->getPosition()) < 100) {

    but it doesn't work or protect, can someone tell me what I'm doing wrong?
     
  2. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    1. Did you register listener
    2. What's $spawn
     
  3. Koyotazu

    Koyotazu Creeper

    Messages:
    4
    GitHub:
    Koyotazu
    If I register the listener and $spawn is

    $spawn = new Vector3(0.0, 0.0, 0.0);
     
  4. Primus

    Primus Zombie Pigman

    Messages:
    749
    var_dump the distance to console and see what the values are when code is being executed. Debug this way.

    Not to be mean, but how is that not the obvious way to do it?
     
    minijaham likes this.
  5. aSluggishPerson

    aSluggishPerson Spider

    Messages:
    7
    GitHub:
    asluggishperson
    what is inside the if statement?
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.