File tree Expand file tree Collapse file tree
bukkit/src/main/java/cn/afternode/commons/bukkit/message Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -151,14 +151,31 @@ public ComponentStyle obfuscated(boolean obfuscated) {
151151 * @see Style
152152 */
153153 public Style build () {
154+ return this .makeBuilder ().build ();
155+ }
156+
157+ /**
158+ * Build to {@link Style} without color
159+ * @return result
160+ */
161+ public Style buildNoColor () {
154162 Style .Builder builder = Style .style ();
155- builder .color (color );
156163 builder .decoration (TextDecoration .ITALIC , italic );
157164 builder .decoration (TextDecoration .BOLD , bold );
158165 builder .decoration (TextDecoration .UNDERLINED , underline );
159166 builder .decoration (TextDecoration .STRIKETHROUGH , strike );
160167 builder .decoration (TextDecoration .OBFUSCATED , obfuscated );
161-
162168 return builder .build ();
163169 }
170+
171+ Style .Builder makeBuilder () {
172+ Style .Builder builder = Style .style ();
173+ builder .color (color );
174+ builder .decoration (TextDecoration .ITALIC , italic );
175+ builder .decoration (TextDecoration .BOLD , bold );
176+ builder .decoration (TextDecoration .UNDERLINED , underline );
177+ builder .decoration (TextDecoration .STRIKETHROUGH , strike );
178+ builder .decoration (TextDecoration .OBFUSCATED , obfuscated );
179+ return builder ;
180+ }
164181}
Original file line number Diff line number Diff line change @@ -184,7 +184,11 @@ public MessageBuilder text(String text) {
184184 * @see java.awt.Color
185185 */
186186 public MessageBuilder text (String text , Color color ) {
187- this .component .append (Component .text (text ).color (TextColor .color (color .getRGB ())));
187+ TextComponent builder = Component .text (text );
188+ ComponentStyle style = this .style ();
189+ if (style != null )
190+ builder = builder .style (style .buildNoColor ());
191+ this .component .append (builder .color (TextColor .color (color .getRGB ())));
188192 return this ;
189193 }
190194
You can’t perform that action at this time.
0 commit comments