-
Notifications
You must be signed in to change notification settings - Fork 107
Expand file tree
/
Copy pathDQueueManager.java
More file actions
123 lines (102 loc) · 3.76 KB
/
Copy pathDQueueManager.java
File metadata and controls
123 lines (102 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package me.realized.duels.api.queue;
import java.util.List;
import me.realized.duels.api.event.queue.QueueCreateEvent;
import me.realized.duels.api.event.queue.QueueJoinEvent;
import me.realized.duels.api.event.queue.QueueLeaveEvent;
import me.realized.duels.api.event.queue.QueueRemoveEvent;
import me.realized.duels.api.kit.Kit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents the QueueManager singleton used by Duels.
*
* @since 3.2.0
*/
public interface DQueueManager {
/**
* Gets a {@link DQueue} with the given kit and bet.
*
* @param kit Kit to check for match in the queues.
* @param bet Bet to check for match in the queues.
* @return DQueue with the given kit and bet if found, otherwise null.
*/
@Nullable
DQueue get(@Nullable final Kit kit, final double bet);
/**
* Gets a {@link DQueue} with the given {@link Player}.
*
* @param player Player to check if in queue
* @return The queue player is in or null if not in queue
*/
@Nullable
DQueue get(@NotNull final Player player);
/**
* Creates a new {@link DQueue}.
* Note: Calls {@link QueueCreateEvent} on successful creation.
*
* @param kit Kit of the DQueue to create
* @param bet Bet of the DQueue to create
* @return The newly created DQueue or null if a queue with given kit and bet already exists
*/
@Nullable
DQueue create(@Nullable final CommandSender source, @Nullable final Kit kit, final double bet);
/**
* Calls {@link #create(CommandSender, Kit, double)} with source being null.
*
* @see #create(CommandSender, Kit, double)
*/
@Nullable
DQueue create(@Nullable final Kit kit, final double bet);
/**
* Removes a new {@link DQueue}.
* Note: Calls {@link QueueRemoveEvent} on successful removal.
*
* @param kit Kit to check for match in the queues
* @param bet Bet to check for match in the queues
* @return The removed DQueue if found, otherwise null
* @see DQueue#isRemoved()
*/
@Nullable
DQueue remove(@Nullable final CommandSender source, @Nullable final Kit kit, final double bet);
/**
* Calls {@link #remove(CommandSender, Kit, double)} with source being null.
*
* @see #remove(CommandSender, Kit, double)
*/
@Nullable
DQueue remove(@Nullable final Kit kit, final double bet);
/**
* Whether or not the {@link Player} is in a queue.
*
* @param player {@link Player} to check if in queue.
* @return True if {@link Player} is in a queue. False otherwise.
*/
boolean isInQueue(@NotNull final Player player);
/**
* Adds the {@link Player} to the given {@link DQueue}.
* Note: Calls {@link QueueJoinEvent}.
*
* @param player {@link Player} to add to {@link DQueue}.
* @param queue {@link DQueue} to add the {@link Player}.
* @return True if {@link Player} was successfully queued. False otherwise.
*/
boolean addToQueue(@NotNull final Player player, @NotNull final DQueue queue);
/**
* Removes the {@link Player} from the queue.
* Note: Calls {@link QueueLeaveEvent} if {@link Player} was in a {@link DQueue}.
*
* @param player {@link Player} to remove from queue.
* @return The {@link DQueue} that {@link Player} was in or null if {@link Player} was not in a queue.
*/
@Nullable
DQueue removeFromQueue(@NotNull final Player player);
/**
* An UnmodifiableList of {@link DQueue}s that are currently loaded.
*
* @return Never-null UnmodifiableList of {@link DQueue}s that are currently loaded.
*/
@NotNull
List<DQueue> getQueues();
}