Solved Triggering code by walking on a range of blocks?

Discussion in 'Plugin Development' started by iClipse, Dec 14, 2016.

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

    iClipse

    I'm back.

    So I wanna remake hypixels maps HB1, HB2, and WotF into adventure maps that use 0 command blocking, but code instead. Firstly, I need to get the scripts done. How does one make a line of code go off upon walking on blocks? Preferably a range to make things simple.

    Also, if you can, does @r work in code or only ingame?

    And btw I know that I need to use a listener.
     
  2. Offline

    Zombie_Striker

  3. Offline

    iClipse

    But I don't want an even that goes off every time someone presses the w key. Any other ideas?

    Also nice sig link answered my question instantly
     
  4. Offline

    Zombie_Striker

    @iClipse
    Well, you could create a repeating task that checks the player's location every __ ticks. The thing is, you either set it to repeat every second, meaning it may become unreliable. Then, if you set it to less than a second (e.g. 10 ticks or 0.5 seconds) it may run even more times than the PlayerMoveEvent and will run even when no players move or if there are no players even online.

    Again, use PlayerMoveEvent. It's there for a reason.

    [Edit] if you're doing this because you think it will cause lag, it will only be noticeable if you have really bad code.
     
  5. Offline

    iClipse

    It is pretty noticable because I have a bad computer. I'm rocking 4 gigs of 2012 ram and 4 gigs of 2005 ram (I scraped computer parts to make mine) and a pentium processor.

    Anyhow, thanks. I checked it out, and its ok, I guess.
     
Thread Status:
Not open for further replies.

Share This Page