April 3, 201510 yr Is it possible to determin wether ANOTHER player (someone you dont know the name of) is in a certain area with like a boolean? (for example the area where u are in). Is there a method for that or do u have to create something urself? for example: final Area YOUR_AREA = new Area(bla,bla,bla,bla); if(YOUR_AREA.contains(/*a player*/)){ //... } Edited April 3, 201510 yr by dokato
April 3, 201510 yr Is it possible to determin wether another player is in a certain area with like a boolean? (for example the area where u are in). Is there a method for that or do u have to create something urself? for example: final Area YOUR_AREA = new Area(bla,bla,bla,bla); if(YOUR_AREA.contains(/*a player*/)){ //... } yes you can
April 3, 201510 yr Author yes you can fuck Obama But i can't, plz tell me how then spoonfeed me a bit
April 3, 201510 yr Player otherPlayer = getPlayers().closest("OtherPlayerName"); if(YOUR_AREA.contains(otherPlayer.getPosition()) { //Interesting things happen } EDIT: to get a list of players in your area, you can do: List<Player> playersInArea = getPlayers().filter(new AreaFilter<Player>(YOUR_AREA)); Edited April 3, 201510 yr by FrostBug
April 3, 201510 yr fuck Obama But i can't, plz tell me how then spoonfeed me a bit Player otherPlayer = getPlayers().closest("OtherPlayerName"); if(YOUR_AREA.contains(otherPlayer.getPosition()) { //Interesting things happen } EDIT: to get a list of players in your area, you can do: List<Player> playersInArea = getPlayers().filter(new AreaFilter<Player>(YOUR_AREA)); what Frostbug said ^_^ i forgot to post code lmao xD
April 3, 201510 yr Author Ow sry my bad, i meant if that player is a random player who u dont know the name of, but just happens to be in that area. What to do then? Edited April 3, 201510 yr by dokato
April 3, 201510 yr Ow sry my bad, i meant if that player is a random player who u dont know the name of, but just happens to be in that area. What to do then? like frostbug said: List<Player> playersInArea = getPlayers().filter(new AreaFilter<Player>(YOUR_AREA)); this will return a list of all the players in the area.
April 3, 201510 yr Ow sry my bad, i meant if that player is a random player who u dont know the name of, but just happens to be in that area. What to do then? you create the list and do a simple list#isEmpty() boolean check. empty == what you want
Create an account or sign in to comment