-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feactures : #19
- Loading branch information
Showing
8 changed files
with
137 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
35 changes: 35 additions & 0 deletions
35
api/src/main/java/fr/euphyllia/skyllia/api/SkylliaAPI.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,35 @@ | ||
package fr.euphyllia.skyllia.api; | ||
|
||
import fr.euphyllia.skyllia.api.skyblock.Island; | ||
import fr.euphyllia.skyllia.api.skyblock.model.Position; | ||
import org.bukkit.Chunk; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.UUID; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
public final class SkylliaAPI { | ||
|
||
private static SkylliaImplementation implementation; | ||
|
||
public static void setImplementation(SkylliaImplementation skylliaImplementation) { | ||
implementation = skylliaImplementation; | ||
} | ||
|
||
public static @Nullable CompletableFuture<@NotNull Island> getIslandByPlayerId(UUID playerUniqueId) { | ||
return implementation.getIslandByPlayerId(playerUniqueId); | ||
} | ||
|
||
public static @Nullable CompletableFuture<@NotNull Island> getIslandByIslandId(UUID islandId) { | ||
return implementation.getIslandByIslandId(islandId); | ||
} | ||
|
||
public static @Nullable @NotNull Island getIslandByPosition(Position position) { | ||
return implementation.getIslandByPosition(position); | ||
} | ||
|
||
public static @Nullable @NotNull Island getIslandByChunk(Chunk chunk) { | ||
return implementation.getIslandByChunk(chunk); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
api/src/main/java/fr/euphyllia/skyllia/api/SkylliaImplementation.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,21 @@ | ||
package fr.euphyllia.skyllia.api; | ||
|
||
import fr.euphyllia.skyllia.api.skyblock.Island; | ||
import fr.euphyllia.skyllia.api.skyblock.model.Position; | ||
import org.bukkit.Chunk; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.UUID; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
public interface SkylliaImplementation { | ||
|
||
public @Nullable CompletableFuture<@NotNull Island> getIslandByPlayerId(UUID playerUniqueId); | ||
|
||
public CompletableFuture<@NotNull Island> getIslandByIslandId(UUID islandId); | ||
|
||
public @NotNull Island getIslandByPosition(Position position); | ||
|
||
public @NotNull Island getIslandByChunk(Chunk chunk); | ||
} |
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
44 changes: 44 additions & 0 deletions
44
plugin/src/main/java/fr/euphyllia/skyllia/managers/skyblock/APISkyllia.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,44 @@ | ||
package fr.euphyllia.skyllia.managers.skyblock; | ||
|
||
import fr.euphyllia.skyllia.api.InterneAPI; | ||
import fr.euphyllia.skyllia.api.SkylliaImplementation; | ||
import fr.euphyllia.skyllia.api.skyblock.Island; | ||
import fr.euphyllia.skyllia.api.skyblock.model.Position; | ||
import fr.euphyllia.skyllia.cache.PositionIslandCache; | ||
import fr.euphyllia.skyllia.utils.RegionUtils; | ||
import org.bukkit.Chunk; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.UUID; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
public final class APISkyllia implements SkylliaImplementation { | ||
|
||
|
||
private final InterneAPI interneAPI; | ||
|
||
public APISkyllia(InterneAPI interneAPI) { | ||
this.interneAPI = interneAPI; | ||
} | ||
|
||
@Override | ||
public CompletableFuture<@NotNull Island> getIslandByPlayerId(UUID playerUniqueId) { | ||
return this.interneAPI.getSkyblockManager().getIslandByPlayerId(playerUniqueId); | ||
} | ||
|
||
@Override | ||
public CompletableFuture<@NotNull Island> getIslandByIslandId(UUID islandId) { | ||
return this.interneAPI.getSkyblockManager().getIslandByIslandId(islandId); | ||
} | ||
|
||
@Override | ||
public @NotNull Island getIslandByPosition(Position position) { | ||
return PositionIslandCache.getIsland(position); | ||
} | ||
|
||
@Override | ||
public @NotNull Island getIslandByChunk(Chunk chunk) { | ||
Position position = RegionUtils.getRegionInChunk(chunk.getX(), chunk.getZ()); | ||
return PositionIslandCache.getIsland(position); | ||
} | ||
} |