18
18
package me .brandonli .mcav .bukkit .media .config ;
19
19
20
20
import com .google .common .base .Preconditions ;
21
+
21
22
import java .util .Collection ;
22
23
import java .util .UUID ;
23
- import me .brandonli .mcav .bukkit .media .result .ChatResult ;
24
- import me .brandonli .mcav .media .player .pipeline .filter .video .VideoFilter ;
25
24
26
25
/**
27
- * The {@code ChatConfiguration} class represents a configuration for a chat interface.
28
- * It holds the parameters required to customize the chat, including the audience,
29
- * dimensions, and character used for representation.
30
- * <p>
31
- * This class is designed to be immutable, and instances are created using
32
- * its nested {@link Builder} class or its specialized {@link ChatResultBuilder}.
33
- * <p>
34
- * Responsibilities:
35
- * - Defines the configuration properties for chat setup.
36
- * - Provides accessor methods to retrieve configuration data such as viewers,
37
- * character, width, and height.
38
- * <p>
39
- * The builder pattern ensures that all required properties are properly set
40
- * before an instance of {@code ChatConfiguration} is created, while also
41
- * allowing for a fluent interface.
26
+ * Represents a configuration for chat related prototypes.
42
27
*/
43
28
public class ChatConfiguration {
44
29
@@ -55,72 +40,69 @@ private ChatConfiguration(final Builder<?> builder) {
55
40
}
56
41
57
42
/**
58
- * Retrieves the collection of viewers associated with this configuration.
59
- * Each viewer is represented by a unique UUID.
43
+ * Gets the viewers of this chat configuration.
60
44
*
61
- * @return a collection of UUIDs representing the viewers
45
+ * @return the collection of UUIDs representing the viewers
62
46
*/
63
47
public Collection <UUID > getViewers () {
64
48
return this .viewers ;
65
49
}
66
50
67
51
/**
68
- * Retrieves the character associated with the chat configuration.
52
+ * Gets the character string associated with this chat configuration.
69
53
*
70
- * @return the character as a string representation
54
+ * @return the character string, which may represent a specific
71
55
*/
72
56
public String getCharacter () {
73
57
return this .character ;
74
58
}
75
59
76
60
/**
77
- * Retrieves the width of the chat configuration.
61
+ * Gets the width of the chat
78
62
*
79
- * @return the width of the chat as an integer
63
+ * @return the chat width
80
64
*/
81
65
public int getChatWdith () {
82
66
return this .chatWdith ;
83
67
}
84
68
85
69
/**
86
- * Retrieves the height of the chat, which represents the configured vertical size
87
- * available for chat display in terms of units or pixels.
70
+ * Gets the height of the chat
88
71
*
89
- * @return the current chat height as an integer
72
+ * @return the chat height as an integer
90
73
*/
91
74
public int getChatHeight () {
92
75
return this .chatHeight ;
93
76
}
94
77
95
78
/**
96
- * Builder class for constructing instances of {@link ChatResult}. This class
97
- * extends the abstract Builder class and provides concrete implementations
98
- * for the required parameters.
79
+ * Chat configuration builder abstraction.
99
80
*/
100
81
public static final class ChatResultBuilder extends Builder <ChatResultBuilder > {
101
82
83
+ ChatResultBuilder () {
84
+ // no-op
85
+ }
86
+
102
87
@ Override
103
88
protected ChatResultBuilder self () {
104
89
return this ;
105
90
}
106
91
}
107
92
108
93
/**
109
- * Creates a new builder instance for constructing a {@link ChatResult} object .
94
+ * Creates a new chat configuration builder .
110
95
*
111
- * @return a new instance of {@link ChatResultBuilder} for building
96
+ * @return a new chat configuration builder
112
97
*/
113
98
public static Builder <?> builder () {
114
99
return new ChatResultBuilder ();
115
100
}
116
101
117
102
/**
118
- * Abstract base class for building instances of {@link ChatResult}. This class
119
- * provides methods to set the required parameters for constructing a ChatResult
120
- * instance. The builder pattern allows for a fluent interface and ensures that
121
- * all necessary fields are set before building the final object.
103
+ * Abstract builder for chat configurations.
122
104
*
123
- * @param <T> the type of the builder extending this abstract class
105
+ * @param <T> the type of the builder
124
106
*/
125
107
public abstract static class Builder <T extends Builder <T >> {
126
108
@@ -129,21 +111,25 @@ public abstract static class Builder<T extends Builder<T>> {
129
111
private int chatWidth ;
130
112
private int chatHeight ;
131
113
132
- protected abstract T self ();
114
+ Builder () {
115
+ // no-op
116
+ }
117
+
118
+ abstract T self ();
133
119
134
120
/**
135
- * Sets the collection of UUIDs representing the viewers for this builder .
121
+ * Sets the viewers of this chat configuration .
136
122
*
137
- * @param viewers the collection of UUID objects that represent the viewers
138
- * @return the builder instance for method chaining
123
+ * @param viewers the viewers to set
124
+ * @return the builder instance for chaining
139
125
*/
140
126
public T viewers (final Collection <UUID > viewers ) {
141
127
this .viewers = viewers ;
142
128
return this .self ();
143
129
}
144
130
145
131
/**
146
- * Sets the character string for the builder .
132
+ * Sets the character string of this chat configuration .
147
133
*
148
134
* @param character the character value to be set
149
135
* @return the instance of the builder for method chaining
@@ -154,9 +140,9 @@ public T character(final String character) {
154
140
}
155
141
156
142
/**
157
- * Sets the chat width and returns the builder instance for method chaining .
143
+ * Sets the chat width of this chat configuration .
158
144
*
159
- * @param chatWidth the width of the chat, must be a positive integer
145
+ * @param chatWidth the width of the chat
160
146
* @return the builder instance for method chaining
161
147
*/
162
148
public T chatWidth (final int chatWidth ) {
@@ -165,9 +151,9 @@ public T chatWidth(final int chatWidth) {
165
151
}
166
152
167
153
/**
168
- * Sets the height of the chat interface .
154
+ * Sets the chat height of this chat configuration .
169
155
*
170
- * @param chatHeight the height of the chat in pixels; must be a positive integer
156
+ * @param chatHeight the height of the chat
171
157
* @return the builder instance for method chaining
172
158
*/
173
159
public T chatHeight (final int chatHeight ) {
@@ -176,14 +162,9 @@ public T chatHeight(final int chatHeight) {
176
162
}
177
163
178
164
/**
179
- * Builds and returns a new instance of {@link VideoFilter} with the configured
180
- * parameters. This method validates the provided parameters to ensure the
181
- * required fields are set and checks the correctness of the input values.
165
+ * Builds the chat configuration.
182
166
*
183
- * @return a newly constructed {@link VideoFilter} instance.
184
- * @throws NullPointerException if required parameters such as viewers or character
185
- * are null.
186
- * @throws IllegalArgumentException if chat width or height are non
167
+ * @return a new instance of ChatConfiguration
187
168
*/
188
169
public ChatConfiguration build () {
189
170
Preconditions .checkNotNull (this .viewers );
0 commit comments