-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add MaskSlot for dynamic slot setting
- Loading branch information
Showing
6 changed files
with
112 additions
and
47 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
...score-minecraft-gui-mask/src/main/java/me/hsgamer/hscore/minecraft/gui/mask/MaskSlot.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package me.hsgamer.hscore.minecraft.gui.mask; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.IntStream; | ||
|
||
/** | ||
* The slot for the mask | ||
*/ | ||
public interface MaskSlot { | ||
/** | ||
* Create a mask slot from the slots | ||
* | ||
* @param slots the slots | ||
* | ||
* @return the mask slot | ||
*/ | ||
@NotNull | ||
static MaskSlot of(@NotNull List<@NotNull Integer> slots) { | ||
return () -> slots; | ||
} | ||
|
||
/** | ||
* Create a mask slot from the slots | ||
* | ||
* @param slots the slots | ||
* | ||
* @return the mask slot | ||
*/ | ||
@NotNull | ||
static MaskSlot of(@NotNull Integer... slots) { | ||
List<Integer> slotList = Arrays.asList(slots); | ||
return () -> slotList; | ||
} | ||
|
||
/** | ||
* Create a mask slot from the slot stream | ||
* | ||
* @param slotStream the slot stream | ||
* | ||
* @return the mask slot | ||
*/ | ||
@NotNull | ||
static MaskSlot of(IntStream slotStream) { | ||
return of(slotStream.boxed().collect(Collectors.toList())); | ||
} | ||
|
||
/** | ||
* Get the slots | ||
* | ||
* @return the slots | ||
*/ | ||
@NotNull | ||
List<Integer> getSlots(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters