Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Detect if an player is in water

Comments in 'Plugin Development' started by Tim // robske Büba, Feb 16, 2016.

  1. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    I know exactly how to get if an player is in water, but i want to know what the best method to do it without big server lag.
    1. Task? Like every 1 sec
    2. PlayerMoveEvent? That will be laggy...
    3. ??? anything else another event maybe?
  2. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
  3. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    Thanks
    Anyone else?
    I just don't wanna lag my server, but a task will delay stuff :(
  4. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    use a RepatingTask for each tick, it'll not lagg the server.
  5. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    Ok
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You don't need a task or PlayerMoveEvent if you just want to know if player is in water.
    The question is, what are you using it for?
  7. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    In my lobby i have water and i want to teleport the player if he touches/is in the water
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Since you don't need to check that every tick, maybe make a scheduled task that checks it every second.

Share This Page

Advertisement