From 5a4ae1b7f10ddd5131f869310f15b2c6fad57fa4 Mon Sep 17 00:00:00 2001 From: kento2 Date: Sun, 15 Feb 2026 10:35:57 +0100 Subject: [PATCH] let me turn this into a plugin --- .../java/de/kentoj/scrow/services/mail/Mail.java | 12 ++++++++++++ .../kentoj/scrow/services/mail/MailService.java | 13 +++++++++++++ .../kentoj/scrow/friends/FriendshipService.java | 16 +++++++++------- .../scrow/friends/friendship/BsonFriendship.java | 2 +- 4 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 core-api/src/main/java/de/kentoj/scrow/services/mail/Mail.java create mode 100644 core-api/src/main/java/de/kentoj/scrow/services/mail/MailService.java diff --git a/core-api/src/main/java/de/kentoj/scrow/services/mail/Mail.java b/core-api/src/main/java/de/kentoj/scrow/services/mail/Mail.java new file mode 100644 index 0000000..034ff90 --- /dev/null +++ b/core-api/src/main/java/de/kentoj/scrow/services/mail/Mail.java @@ -0,0 +1,12 @@ +package de.kentoj.scrow.services.mail; + +import lombok.Value; + +import java.util.UUID; + +@Value +public class Mail { + UUID from; + String subject; + String body; +} diff --git a/core-api/src/main/java/de/kentoj/scrow/services/mail/MailService.java b/core-api/src/main/java/de/kentoj/scrow/services/mail/MailService.java new file mode 100644 index 0000000..a726ea2 --- /dev/null +++ b/core-api/src/main/java/de/kentoj/scrow/services/mail/MailService.java @@ -0,0 +1,13 @@ +package de.kentoj.scrow.services.mail; + +import reactor.core.publisher.Mono; + +import java.util.UUID; + +/** + * like email but for minecraft + */ +public interface MailService { + + Mono sendMail(UUID to, Mail mail); +} diff --git a/core-impl/src/main/java/de/kentoj/scrow/friends/FriendshipService.java b/core-impl/src/main/java/de/kentoj/scrow/friends/FriendshipService.java index c692ed9..f0125df 100644 --- a/core-impl/src/main/java/de/kentoj/scrow/friends/FriendshipService.java +++ b/core-impl/src/main/java/de/kentoj/scrow/friends/FriendshipService.java @@ -2,9 +2,6 @@ package de.kentoj.scrow.friends; import de.kentoj.scrow.services.friends.FriendRequest; import de.kentoj.scrow.services.friends.Friendship; -import de.kentoj.scrow.util.pair.Tuple2; -import org.bson.codecs.OverridableUuidRepresentationUuidCodec; -import org.bson.types.ObjectId; import org.jetbrains.annotations.NotNull; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -17,17 +14,22 @@ public interface FriendshipService { /** * @param initiator id of player who wished to end the friendship - * @param other id of the player the initiator wants to end the friendship with + * @param other id of the player the initiator wants to end the friendship with * @return true on success, false if no such friendship existed. */ - Mono<@NotNull Boolean> endFriendship(Tuple2 playerIds); + Mono<@NotNull Boolean> endFriendship(UUID initiator, UUID other); + + Flux<@NotNull FriendRequest> getIncomingFriendRequests(UUID playerId); + Flux<@NotNull FriendRequest> getOutgoingFriendRequests(UUID playerId); /** * @param initiator id of player sending the friend request - * @param to id of the player the initiator wants to befriend + * @param to id of the player the initiator wants to befriend * @return true on success, false if already requested */ Mono<@NotNull Boolean> sendFriendRequest(UUID initiator, UUID to); - Mono<@NotNull Friendship> acceptFriendRequest(ObjectId objectId); + Mono<@NotNull Friendship> acceptFriendRequest(UUID from, UUID to); + + Mono<@NotNull Friendship> denyFriendRequest(UUID from, UUID to); } diff --git a/core-impl/src/main/java/de/kentoj/scrow/friends/friendship/BsonFriendship.java b/core-impl/src/main/java/de/kentoj/scrow/friends/friendship/BsonFriendship.java index 075e4bb..579553a 100644 --- a/core-impl/src/main/java/de/kentoj/scrow/friends/friendship/BsonFriendship.java +++ b/core-impl/src/main/java/de/kentoj/scrow/friends/friendship/BsonFriendship.java @@ -26,7 +26,7 @@ public class BsonFriendship implements Friendship { ) { Preconditions.checkArgument(playerIds.getFirst() != playerIds.getSecond()); this.id = id; - this.playerIds = toOrderedTuple(playerIds); + this.playerIds = FriendshipUtils.toOrderedTuple(playerIds); this.createdAt = createdAt; }