-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract GameSpaceManager into api interface
- Loading branch information
Showing
21 changed files
with
131 additions
and
81 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
42 changes: 42 additions & 0 deletions
42
src/main/java/xyz/nucleoid/plasmid/api/game/GameSpaceManager.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.api.game; | ||
|
||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.registry.entry.RegistryEntry; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.world.World; | ||
import org.jetbrains.annotations.ApiStatus; | ||
import org.jetbrains.annotations.Nullable; | ||
import xyz.nucleoid.plasmid.api.game.config.GameConfig; | ||
import xyz.nucleoid.plasmid.impl.manager.GameSpaceManagerImpl; | ||
import xyz.nucleoid.plasmid.impl.manager.ManagedGameSpace; | ||
|
||
import java.util.Collection; | ||
import java.util.UUID; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
@ApiStatus.NonExtendable | ||
public interface GameSpaceManager { | ||
static GameSpaceManagerImpl get() { | ||
return GameSpaceManagerImpl.get(); | ||
} | ||
|
||
CompletableFuture<GameSpace> open(RegistryEntry<GameConfig<?>> config); | ||
|
||
Collection<ManagedGameSpace> getOpenGameSpaces(); | ||
|
||
@Nullable | ||
GameSpace byId(UUID id); | ||
|
||
@Nullable | ||
GameSpace byUserId(Identifier userId); | ||
|
||
@Nullable | ||
GameSpace byWorld(World world); | ||
|
||
@Nullable | ||
GameSpace byPlayer(PlayerEntity player); | ||
|
||
boolean hasGame(World world); | ||
|
||
boolean inGame(PlayerEntity player); | ||
} |
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
Oops, something went wrong.