.
This commit is contained in:
parent
c234c600fe
commit
8eb15179db
16 changed files with 152 additions and 98 deletions
|
|
@ -1,9 +1,9 @@
|
|||
package de.kentoj.scrow.bukkit;
|
||||
|
||||
import com.mongodb.reactivestreams.client.MongoClient;
|
||||
import com.mongodb.reactivestreams.client.MongoDatabase;
|
||||
import de.kentoj.kencommandapi.BukkitKenCommandApi;
|
||||
import de.kentoj.scrow.bukkit.friends.FriendsService;
|
||||
import de.kentoj.scrow.bukkit.friends.FriendRequestService;
|
||||
import de.kentoj.scrow.bukkit.friends.FriendshipService;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
|
@ -23,7 +23,9 @@ public class ScrowAPI {
|
|||
@Getter
|
||||
private static EconomyService economyService;
|
||||
@Getter
|
||||
private static FriendsService friendsService;
|
||||
private static FriendshipService friendshipService;
|
||||
@Getter
|
||||
private static FriendRequestService friendRequestService;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static void setDatabase(@Nullable MongoDatabase database) {
|
||||
|
|
@ -46,8 +48,13 @@ public class ScrowAPI {
|
|||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static void setFriendsService(FriendsService friendsService) {
|
||||
ScrowAPI.friendsService = friendsService;
|
||||
public static void setFriendshipService(FriendshipService friendshipService) {
|
||||
ScrowAPI.friendshipService = friendshipService;
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static void setFriendRequestService(FriendRequestService friendRequestService) {
|
||||
ScrowAPI.friendRequestService = friendRequestService;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package de.kentoj.scrow.bukkit.friends;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface FriendRequestService {
|
||||
|
||||
Flux<@NotNull FriendRequest> getFriendRequestsTo(UUID playerId);
|
||||
|
||||
Flux<@NotNull FriendRequest> getFriendRequestsFrom(UUID playerId);
|
||||
|
||||
Mono<@NotNull FriendRequest> getFriendRequest(UUID from, UUID to);
|
||||
|
||||
/**
|
||||
* @return True if request saved, false if already existing request found.
|
||||
*/
|
||||
Mono<@NotNull Boolean> saveFriendRequest(FriendRequest friendRequest);
|
||||
|
||||
/**
|
||||
* @return True if request deleted, false if none found.
|
||||
*/
|
||||
Mono<@NotNull Boolean> deleteFriendRequest(UUID from, UUID to);
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package de.kentoj.scrow.bukkit.friends;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface FriendsService {
|
||||
|
||||
Flux<@NotNull Friendship> getFriendships(UUID playerId);
|
||||
|
||||
Mono<@NotNull Boolean> removeFriend(Friendship friendship);
|
||||
|
||||
Flux<@NotNull FriendRequest> getIncomingFriendRequests(UUID playerId);
|
||||
|
||||
Flux<@NotNull FriendRequest> getOutgoingFriendRequests(UUID playerId);
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package de.kentoj.scrow.bukkit.friends;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface FriendshipService {
|
||||
|
||||
Mono<@NotNull Friendship> getFriendship(UUID uuid1, UUID uuid2);
|
||||
|
||||
Flux<@NotNull Friendship> getFriendships(UUID playerId);
|
||||
|
||||
/*
|
||||
* @return True if friendship saved, false if friendship already exists
|
||||
*/
|
||||
Mono<@NotNull Boolean> saveFriendship(Friendship playerIds);
|
||||
|
||||
/**
|
||||
* @return True if friendship deleted, false if none found
|
||||
*/
|
||||
Mono<@NotNull Boolean> deleteFriendship(UUID uuid1, UUID uuid2);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue