27
27
28
28
import org .checkerframework .checker .nullness .qual .NonNull ;
29
29
import org .checkerframework .checker .nullness .qual .Nullable ;
30
+ import org .geysermc .geyser .api .connection .GeyserConnection ;
30
31
31
32
import java .util .Set ;
32
33
import java .util .UUID ;
33
34
35
+ /**
36
+ * This interface holds all the methods that relate to a client's camera.
37
+ * Can be accessed through {@link GeyserConnection#camera()}.
38
+ */
34
39
public interface CameraData {
35
40
36
41
/**
37
- * Sends a camera instruction to the client.
42
+ * Sends a camera fade instruction to the client.
38
43
* If an existing camera fade is already in progress, the current fade will be prolonged.
39
44
* Can be built using {@link CameraFade.Builder}.
45
+ * To stop a fade early, use {@link #clearCameraInstructions()}.
40
46
*
41
- * @param fade the camera fade to send
47
+ * @param fade the camera fade instruction to send
42
48
*/
43
49
void sendCameraFade (@ NonNull CameraFade fade );
44
50
45
51
/**
46
- * Sends a camera instruction to the client.
47
- * If an existing camera movement is already in progress:
48
- * The (optional) camera fade will be added on top of the existing fade , and
49
- * the final camera position will be the one of the latest instruction .
52
+ * Sends a camera position instruction to the client.
53
+ * If an existing camera movement is already in progress,
54
+ * the final camera position will be the one of the latest instruction , and
55
+ * the (optional) camera fade will be added on top of the existing fade .
50
56
* Can be built using {@link CameraPosition.Builder}.
57
+ * To stop reset the camera position/stop ongoing instructions, use {@link #clearCameraInstructions()}.
51
58
*
52
- * @param position the camera position to send
59
+ * @param position the camera position instruction to send
53
60
*/
54
61
void sendCameraPosition (@ NonNull CameraPosition position );
55
62
@@ -60,8 +67,8 @@ public interface CameraData {
60
67
void clearCameraInstructions ();
61
68
62
69
/**
63
- * Forces a {@link CameraPerspective} on the client. This will prevent
64
- * the client from changing their camera perspective until it is unlocked via {@link #clearCameraInstructions()}.
70
+ * Forces a {@link CameraPerspective} on the client. This will prevent the client
71
+ * from changing their camera perspective until it is unlocked via {@link #clearCameraInstructions()}.
65
72
* <p>
66
73
* Note: You cannot force a client into a free camera perspective with this method.
67
74
* To do that, send a {@link CameraPosition} via {@link #sendCameraPosition(CameraPosition)} - it requires a set position
@@ -72,16 +79,17 @@ public interface CameraData {
72
79
void forceCameraPerspective (@ NonNull CameraPerspective perspective );
73
80
74
81
/**
75
- * Gets the client's current {@link CameraPerspective}, if forced.
82
+ * Gets the client's current {@link CameraPerspective}, if one is currently forced.
76
83
* This will return {@code null} if the client is not currently forced into a perspective.
77
- * If a perspective is forced, the client will not be able to change their camera perspective until it is unlocked
84
+ * If a perspective is forced, the client will not be able to change their camera perspective until it is unlocked.
78
85
*
79
86
* @return the forced perspective, or {@code null} if none is forced.
80
87
*/
81
88
@ Nullable CameraPerspective forcedCameraPerspective ();
82
89
83
90
/**
84
- * Shakes the client's camera.<br><br>
91
+ * Shakes the client's camera.
92
+ * <p>
85
93
* If the camera is already shaking with the same {@link CameraShake} type, then the additional intensity
86
94
* will be layered on top of the existing intensity, with their own distinct durations.<br>
87
95
* If the existing shake type is different and the new intensity/duration are not positive, the existing shake only
@@ -94,7 +102,7 @@ public interface CameraData {
94
102
void shakeCamera (float intensity , float duration , @ NonNull CameraShake type );
95
103
96
104
/**
97
- * Stops all camera shake of any type.
105
+ * Stops all camera shakes of any type.
98
106
*/
99
107
void stopCameraShake ();
100
108
@@ -123,18 +131,18 @@ public interface CameraData {
123
131
/**
124
132
* (Un)locks the client's camera, so that they cannot look around.
125
133
* To ensure the camera is only unlocked when all locks are released, you must supply
126
- * a UUID-key to this method, and use the same key to unlock the camera.
134
+ * a UUID when using method, and use the same UUID to unlock the camera.
127
135
*
128
136
* @param lock whether to lock the camera
129
- * @param owner the owner of the lock
137
+ * @param owner the owner of the lock, represented with a UUID
130
138
* @return if the camera is locked after this method call
131
139
*/
132
140
boolean lockCamera (boolean lock , @ NonNull UUID owner );
133
141
134
142
/**
135
143
* Returns whether the client's camera is locked.
136
144
*
137
- * @return whether the camera is locked
145
+ * @return whether the camera is currently locked
138
146
*/
139
147
boolean isCameraLocked ();
140
148
}
0 commit comments