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

Selecting All Players

Comments in 'Plugin Development' started by Tethered_, Nov 16, 2014.

  1. Tethered_
    Offline

    Tethered_ Active Member Plugin Developer

    Joined:
    Jun 24, 2014
    Posts:
    178
    Plugins:
    2
    Minecraft User:
    Frostbyte58
    How can I teleport all players to a location, or even just select all players, rather than just a $sender?
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Do a foreach loop on $server->getOnlinePlayers()
    Tethered_ likes this.
  3. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    foreach($p->getLevel()->getNearbyEntities(new AxisAlignedBB($pos->getX()-10, $pos->getY()-10, $pos->getZ()-10, $pos->getX()+10, $pos->getY()+10, $pos->getZ()+10), $p) as $entity)

    (+/-10 is the range)
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    That's slower.
    Xenturio likes this.
  5. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    Ok dont know but u have a range so not all player will be telepotet only the player nearby u
  6. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,201
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    i suggest you dig out the plugin "LocalChat" in the plugin repo :)
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Yes... but, you can also select by player using chunks.
    Falk likes this.
  8. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    Simple the same i have made a minigame with that. If a player is near 10blocks and a other player break a grassblock all players near will be teleport random in the sky for fall damage... other damage is disable in world ^^
  9. Tethered_
    Offline

    Tethered_ Active Member Plugin Developer

    Joined:
    Jun 24, 2014
    Posts:
    178
    Plugins:
    2
    Minecraft User:
    Frostbyte58
    But how would you teleport ALL players in a given world to a location? Not all players near you, all players in the world.
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Tethered_ likes this.

Share This Page

Advertisement