@@ -101,9 +101,10 @@ public void addPixel(@Nonnull final MapColoredPixel mapColoredPixel) {
101101 * @param x The x-coordinate of the text.
102102 * @param y The y-coordinate of the text.
103103 * @param text The text to display.
104+ * @return returns the newly created text overlay, so you could set some of the options after.
104105 */
105- public void addText (final int x , int y , final String text ) {
106- this .addText (x , y , text , null , null );
106+ public TextOverlay addText (final int x , int y , final String text ) {
107+ return this .addText (x , y , text , null , null );
107108 }
108109
109110 /**
@@ -114,9 +115,10 @@ public void addText(final int x, int y, final String text) {
114115 * @param y The y-coordinate of the text.
115116 * @param text The text to display.
116117 * @param font The font for the character.
118+ * @return returns the newly created text overlay, so you could set some of the options after.
117119 */
118- public void addText (final int x , int y , final String text , @ Nullable final Font font ) {
119- this .addText (x , y , text , null , font );
120+ public TextOverlay addText (final int x , int y , final String text , @ Nullable final Font font ) {
121+ return this .addText (x , y , text , null , font );
120122 }
121123
122124 /**
@@ -127,8 +129,9 @@ public void addText(final int x, int y, final String text, @Nullable final Font
127129 * @param text The text to display.
128130 * @param fontChars Set the characters you want to replace in your text with the font.
129131 * @param font The font for the character
132+ * @return returns the newly created text overlay, so you could set some of the options after.
130133 */
131- public void addText (final int x , int y , @ Nonnull final String text , @ Nullable final char [] fontChars , @ Nullable final Font font ) {
134+ public TextOverlay addText (final int x , int y , @ Nonnull final String text , @ Nullable final char [] fontChars , @ Nullable final Font font ) {
132135 TextOverlay textOverlay = new TextOverlay (x , y , text );
133136 if (font != null ) {
134137 if (fontChars != null && fontChars .length > 0 ) {
@@ -137,6 +140,7 @@ public void addText(final int x, int y, @Nonnull final String text, @Nullable fi
137140 textOverlay .setMapFont (this .fontChars , font );
138141 }
139142 this .addText (textOverlay );
143+ return textOverlay ;
140144 }
141145
142146 /**
0 commit comments