let me turn this into a plugin
This commit is contained in:
parent
145a3116bc
commit
5a4ae1b7f1
4 changed files with 35 additions and 8 deletions
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
@ -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<Long> sendMail(UUID to, Mail mail);
|
||||||
|
}
|
||||||
|
|
@ -2,9 +2,6 @@ package de.kentoj.scrow.friends;
|
||||||
|
|
||||||
import de.kentoj.scrow.services.friends.FriendRequest;
|
import de.kentoj.scrow.services.friends.FriendRequest;
|
||||||
import de.kentoj.scrow.services.friends.Friendship;
|
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 org.jetbrains.annotations.NotNull;
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
@ -17,17 +14,22 @@ public interface FriendshipService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param initiator id of player who wished to end the friendship
|
* @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.
|
* @return true on success, false if no such friendship existed.
|
||||||
*/
|
*/
|
||||||
Mono<@NotNull Boolean> endFriendship(Tuple2<UUID, UUID> 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 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
|
* @return true on success, false if already requested
|
||||||
*/
|
*/
|
||||||
Mono<@NotNull Boolean> sendFriendRequest(UUID initiator, UUID to);
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ public class BsonFriendship implements Friendship {
|
||||||
) {
|
) {
|
||||||
Preconditions.checkArgument(playerIds.getFirst() != playerIds.getSecond());
|
Preconditions.checkArgument(playerIds.getFirst() != playerIds.getSecond());
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.playerIds = toOrderedTuple(playerIds);
|
this.playerIds = FriendshipUtils.toOrderedTuple(playerIds);
|
||||||
this.createdAt = createdAt;
|
this.createdAt = createdAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue