.
This commit is contained in:
parent
b6aff8497f
commit
ad4e00a6ab
19 changed files with 153 additions and 253 deletions
|
|
@ -36,7 +36,9 @@ dependencies {
|
|||
api("org.spigotmc:spigot-api:1.21.11-R0.1-SNAPSHOT")
|
||||
api("net.kyori:adventure-platform-bukkit:4.4.1")
|
||||
|
||||
api("de.kentoj:kencommandapi-core:1.2.0")
|
||||
api("de.kentoj:kencommandapi-core:2.0.1")
|
||||
implementation("de.kentoj:kencommandapi-bukkit:2.0.1")
|
||||
api("de.kentoj:kencommandapi-bukkit:2.0.1")
|
||||
}
|
||||
|
||||
publishing {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
package de.kentoj.scrow.bukkit;
|
||||
|
||||
import com.mongodb.reactivestreams.client.MongoDatabase;
|
||||
import de.kentoj.kencommandapi.api.KenCommandApi;
|
||||
import de.kentoj.kencommandapi.api.processing.CommandContext;
|
||||
import de.kentoj.kencommandapi.api.structure.node.CommandNode;
|
||||
import de.kentoj.kencommandapi.BukkitKenCommandApi;
|
||||
import de.kentoj.scrow.bukkit.friends.FriendsService;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import reactor.core.scheduler.Scheduler;
|
||||
|
|
@ -20,7 +16,7 @@ public class ScrowAPI {
|
|||
@Getter
|
||||
private static @Nullable MongoDatabase database;
|
||||
@Getter
|
||||
private static KenCommandApi<CommandSender, CommandContext<CommandSender>> commandManager;
|
||||
private static BukkitKenCommandApi commandManager;
|
||||
@Getter
|
||||
private static Scheduler minecraftScheduler;
|
||||
@Getter
|
||||
|
|
@ -39,7 +35,7 @@ public class ScrowAPI {
|
|||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static void setCommandManager(KenCommandApi<CommandSender, CommandContext<CommandSender>> commandManager) {
|
||||
public static void setCommandManager(BukkitKenCommandApi commandManager) {
|
||||
ScrowAPI.commandManager = commandManager;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
package de.kentoj.scrow.bukkit.email;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface Email extends EmailDraft {
|
||||
|
||||
Long getId();
|
||||
|
||||
/**
|
||||
* @return UUID of player the mail is sent to or null if console
|
||||
*/
|
||||
@Nullable UUID getFrom();
|
||||
|
||||
@Nullable Instant getSentAt();
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
package de.kentoj.scrow.bukkit.email;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface EmailDraft {
|
||||
|
||||
/**
|
||||
* @return UUID of player sending the mail or null if console
|
||||
*/
|
||||
@Nullable UUID getFrom();
|
||||
|
||||
/**
|
||||
* @return non-empty string specifying the subject
|
||||
*/
|
||||
String getSubject();
|
||||
|
||||
/**
|
||||
* @return body of the message
|
||||
*/
|
||||
String getBody();
|
||||
|
||||
/**
|
||||
* @return id of the mail this mail is replying to or null if not replying to any email
|
||||
*/
|
||||
@Nullable Long getReplyTo();
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
package de.kentoj.scrow.bukkit.email;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* like email but for minecraft
|
||||
*/
|
||||
public interface EmailService {
|
||||
|
||||
Mono<@NotNull Email> sendMail(UUID to, EmailDraft emailDraft);
|
||||
Flux<@NotNull Email> sendMailToMany(Set<UUID> to, EmailDraft emailDraft);
|
||||
|
||||
Flux<@NotNull Email> fetchMails(UUID to);
|
||||
|
||||
/**
|
||||
* @param to uuid of player whose inbox to operate on
|
||||
* @param id id of the email
|
||||
*/
|
||||
Mono<@NotNull Void> deleteMail(UUID to, long id);
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ public interface FriendsService {
|
|||
* @param other id of the player the initiator wants to end the friendship with
|
||||
* @throws FriendRequestUsageException
|
||||
*/
|
||||
Mono<@NotNull Boolean> removeFriend(UUID initiator, UUID other);
|
||||
Mono<@NotNull Boolean> removeFriend(Friendship friendship);
|
||||
|
||||
/**
|
||||
* @param playerId
|
||||
|
|
|
|||
|
|
@ -1,16 +1,11 @@
|
|||
package de.kentoj.scrow.bukkit.friends;
|
||||
|
||||
import de.kentoj.scrow.bukkit.util.pair.Tuple2;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface Friendship {
|
||||
Tuple2<UUID, UUID> getPlayerIds();
|
||||
Instant getCreatedAt();
|
||||
|
||||
default UUID getOther(UUID self) {
|
||||
final var ids = getPlayerIds();
|
||||
return ids.getFirst() != self ? ids.getFirst() : ids.getSecond();
|
||||
}
|
||||
OrderedUUIDPair getUuids();
|
||||
|
||||
Instant getCreatedAt();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
package de.kentoj.scrow.bukkit.friends;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter
|
||||
public class OrderedUUIDPair {
|
||||
private final UUID first;
|
||||
private final UUID second;
|
||||
|
||||
public OrderedUUIDPair(UUID uuid1, UUID uuid2) {
|
||||
Preconditions.checkArgument(uuid1 != uuid2);
|
||||
if (uuid1.compareTo(uuid2) < 0) {
|
||||
this.first = uuid1;
|
||||
this.second = uuid2;
|
||||
} else {
|
||||
this.first = uuid2;
|
||||
this.second = uuid1;
|
||||
}
|
||||
}
|
||||
|
||||
public UUID getOther(UUID self) {
|
||||
final var ids = getFirst();
|
||||
return getFirst().equals(self) ? getSecond() : getFirst();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue