Skip to content

Commit

Permalink
feat(npc): add new visibility methods to enable more diverse and situ…
Browse files Browse the repository at this point in the history
…ation-dependent control (#189)
  • Loading branch information
Snabeldier authored Jun 25, 2024
1 parent 2791817 commit 3f6556d
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions src/main/java/minevalley/core/api/npc/NPC.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,36 @@
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;

public interface NPC {

String getName();

void show(Player player);

void show(OnlineUser user);

void hide(Player player);

void hide(OnlineUser user);

boolean canSee(Player player);

boolean canSee(OnlineUser user);
/**
* Defines which users can see the npc
* <br>
* <b>Default:</b> Everyone can see the npc
*
* @param function defines whether a specific user can see the npc
*/
void setVisibility(Function<OnlineUser, Boolean> function);

/**
* Updates the visibility of the npc
* <br>
* <b>Note:</b> This simply calls the function defined in {@link #setVisibility(Function)} for every user that the npc is or could be visible to
*/
void updateVisibility();

/**
* Updates the visibility of the npc for a specific user
* <br>
* <b>Note:</b> This simply calls the function defined in {@link #setVisibility(Function)} for this user
*
* @param user to update the visibility for
*/
void updateVisibility(OnlineUser user);

boolean focusNearPlayers();

Expand Down

0 comments on commit 3f6556d

Please sign in to comment.