Skip to content

Commit d7da34a

Browse files
committed
Added CommandArguments#sendMessage(String, Object[]) method
1 parent fa8bb42 commit d7da34a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/main/java/me/despical/commandframework/CommandArguments.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.jetbrains.annotations.NotNull;
2828
import org.jetbrains.annotations.Nullable;
2929

30+
import java.text.MessageFormat;
3031
import java.util.Arrays;
3132
import java.util.Optional;
3233

@@ -166,6 +167,19 @@ public void sendMessage(String message) {
166167
commandSender.sendMessage(CommandFramework.instance.colorFormatter.apply(message));
167168
}
168169

170+
/**
171+
* Sends message to sender without receiving command
172+
* sender with the given parameters.
173+
*
174+
* @param message the message will be sent to sender.
175+
* @param params the parameters to format the message.
176+
*/
177+
public void sendMessage(String message, Object... params) {
178+
if (message == null)
179+
return;
180+
commandSender.sendMessage(CommandFramework.instance.colorFormatter.apply(MessageFormat.format(message, params)));
181+
}
182+
169183
/**
170184
* Checks if command sender is console.
171185
*

0 commit comments

Comments
 (0)