Skip to content

Commit af7cfed

Browse files
authored
feat(fake-blocks): add new visibility system to fake blocks (#200)
1 parent a289ed3 commit af7cfed

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed
Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,24 @@
11
package minevalley.core.api.regions.utils;
22

33
import minevalley.core.api.users.OnlineUser;
4-
import org.bukkit.entity.Player;
54

6-
public interface FakeBlock {
7-
8-
/**
9-
* Shows the block to specific players.
10-
*
11-
* @param players Players to whom the block is shown
12-
*/
13-
void show(Player... players);
5+
import java.util.function.Function;
146

15-
/**
16-
* Hides the block from specific players.
17-
*
18-
* @param players Players from whom the block is hidden
19-
*/
20-
void hide(Player... players);
7+
public interface FakeBlock {
218

229
/**
23-
* Shows the block to specific users.
10+
* Defines which users can see the fake block
11+
* <br>
12+
* <b>Default:</b> Everyone can see the fake block
2413
*
25-
* @param users Users to whom the block is shown
14+
* @param function defines whether a specific user can see the fake block
2615
*/
27-
void show(OnlineUser... users);
16+
void setVisibility(Function<OnlineUser, Boolean> function);
2817

2918
/**
30-
* Hides the block from specific users.
31-
*
32-
* @param users Users from whom the block is hidden
19+
* Updates the visibility of the fake block
20+
* <br>
21+
* <b>Note:</b> This simply calls the function defined in {@link #setVisibility(Function)} for every user that the fake block is or could be visible to
3322
*/
34-
void hide(OnlineUser... users);
23+
void updateVisibility();
3524
}

0 commit comments

Comments
 (0)