-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlaytimeService.java
More file actions
59 lines (53 loc) · 2.12 KB
/
PlaytimeService.java
File metadata and controls
59 lines (53 loc) · 2.12 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
package com.github.imdmk.playtime;
import com.github.imdmk.playtime.user.UserTime;
import org.jetbrains.annotations.NotNull;
import java.util.UUID;
/**
* A high-level abstraction for accessing and modifying player playtime data.
* <p>
* Implementations of this interface are responsible for bridging between
* the plugin domain model ({@link UserTime}) and the underlying platform’s
* data source (e.g., Bukkit statistics API, database, etc.).
* <p>
* Playtime is typically expressed in Minecraft ticks (20 ticks = 1 second),
* but the {@link UserTime} abstraction handles conversions to and from human-readable units.
*
* @see com.github.imdmk.playtime.user.UserTime
*/
public interface PlaytimeService {
/**
* Retrieves the total accumulated playtime for the specified player.
*
* @param uuid
* the unique identifier of the player whose playtime should be fetched;
* must not be {@code null}
* @return
* a non-null {@link UserTime} representing the player’s total playtime.
* If no playtime is recorded or the player has never joined, returns {@link UserTime#ZERO}.
* @throws NullPointerException
* if {@code uuid} is {@code null}.
*/
@NotNull UserTime getTime(@NotNull UUID uuid);
/**
* Sets the total playtime for the specified player to the given value.
*
* @param uuid
* the unique identifier of the player whose playtime should be updated;
* must not be {@code null}
* @param time
* the new total playtime value to assign; must not be {@code null}
* @throws NullPointerException
* if {@code uuid} or {@code time} is {@code null}
*/
void setTime(@NotNull UUID uuid, @NotNull UserTime time);
/**
* Resets the total recorded playtime of the specified player to zero.
*
* @param uuid
* the unique identifier of the player whose playtime should be reset;
* must not be {@code null}
* @throws NullPointerException
* if {@code uuid} is {@code null}
*/
void resetTime(@NotNull UUID uuid);
}