Skip to content

Commit

Permalink
Add sendMessage methods
Browse files Browse the repository at this point in the history
  • Loading branch information
esotericenderman committed Aug 7, 2024
1 parent 8e7d969 commit c9840a1
Showing 1 changed file with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,54 @@ public Component getMessage(Message message, PlayerProfile playerProfile, Object
return getMessage(message, playerProfile, true, arguments);
}

public void sendMessage(Message message, CommandSender commandSender, boolean fallbackOnDefaultLanguage, Component... arguments) {
commandSender.sendMessage(getMessage(message, getLanguage(commandSender), fallbackOnDefaultLanguage, arguments));
}

public void sendMessage(Message message, CommandSender commandSender, Component... arguments) {
commandSender.sendMessage(getMessage(message, commandSender, true, arguments));
}

public void sendMessage(Message message, CommandSender commandSender, boolean fallbackOnDefaultLanguage, Object... arguments) {
commandSender.sendMessage(getMessage(message, commandSender, fallbackOnDefaultLanguage, toComponents(arguments)));
}

public void sendMessage(Message message, CommandSender commandSender, Object... arguments) {
commandSender.sendMessage(getMessage(message, commandSender, true, arguments));
}

public void sendMessage(Message message, UUID uuid, boolean fallbackOnDefaultLanguage, Component... arguments) {
Bukkit.getPlayer(uuid).sendMessage(getMessage(message, getLanguage(uuid), fallbackOnDefaultLanguage, arguments));
}

public void sendMessage(Message message, UUID uuid, Component... arguments) {
Bukkit.getPlayer(uuid).sendMessage(getMessage(message, uuid, true, arguments));
}

public void sendMessage(Message message, UUID uuid, boolean fallbackOnDefaultLanguage, Object... arguments) {
Bukkit.getPlayer(uuid).sendMessage(getMessage(message, uuid, fallbackOnDefaultLanguage, toComponents(arguments)));
}

public void sendMessage(Message message, UUID uuid, Object... arguments) {
Bukkit.getPlayer(uuid).sendMessage(getMessage(message, uuid, true, arguments));
}

public void sendMessage(Message message, PlayerProfile playerProfile, boolean fallbackOnDefaultLanguage, Component... arguments) {
Bukkit.getPlayer(playerProfile.getUuid()).sendMessage(getMessage(message, getLanguage(playerProfile), fallbackOnDefaultLanguage, arguments));
}

public void sendMessage(Message message, PlayerProfile playerProfile, Component... arguments) {
Bukkit.getPlayer(playerProfile.getUuid()).sendMessage(getMessage(message, playerProfile, true, arguments));
}

public void sendMessage(Message message, PlayerProfile playerProfile, boolean fallbackOnDefaultLanguage, Object... arguments) {
Bukkit.getPlayer(playerProfile.getUuid()).sendMessage(getMessage(message, playerProfile, fallbackOnDefaultLanguage, toComponents(arguments)));
}

public void sendMessage(Message message, PlayerProfile playerProfile, Object... arguments) {
Bukkit.getPlayer(playerProfile.getUuid()).sendMessage(getMessage(message, playerProfile, true, arguments));
}

public Component[] toComponents(Object ...objects) {
return Stream.of(objects).map((object) -> toComponent(object)).toArray(Component[]::new);
}
Expand Down

0 comments on commit c9840a1

Please sign in to comment.