-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add JoinIntent parameter to offer and screen joins events, currently …
…unused
- Loading branch information
Showing
14 changed files
with
91 additions
and
33 deletions.
There are no files selected for viewing
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
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
42 changes: 42 additions & 0 deletions
42
src/main/java/xyz/nucleoid/plasmid/game/player/JoinIntent.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,42 @@ | ||
package xyz.nucleoid.plasmid.game.player; | ||
|
||
import xyz.nucleoid.plasmid.game.GameSpace; | ||
import xyz.nucleoid.plasmid.game.event.GamePlayerEvents; | ||
|
||
/** | ||
* Represents the "intention" of a player or group of players joining a {@link GameSpace}. | ||
* It is up to the game implementation to respect this intent in the way that is appropriate for their game. This may be | ||
* accomplished by handling the {@link GamePlayerEvents#SCREEN_JOINS 'Screen Joins'} and | ||
* {@link GamePlayerEvents#OFFER 'Player Offer'} events. | ||
*/ | ||
public enum JoinIntent { | ||
/** | ||
* The player has no particular intention. Generally, this should be considered as a preference to participate. | ||
*/ | ||
ANY, | ||
/** | ||
* The player intends to join the game to participate. If they cannot be joined as a participant, they should not | ||
* be allowed to join. | ||
*/ | ||
PLAY, | ||
/** | ||
* The player intends to join the game to spectate. Unless the game does not support spectators, this player should | ||
* generally always be accepted. | ||
*/ | ||
SPECTATE, | ||
; | ||
|
||
/** | ||
* @return {@code true} if the player may join as a participant under any circumstances | ||
*/ | ||
public boolean canPlay() { | ||
return this != SPECTATE; | ||
} | ||
|
||
/** | ||
* @return {@code true} if the player may join as a spectator under any circumstances | ||
*/ | ||
public boolean canSpectate() { | ||
return this != PLAY; | ||
} | ||
} |
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