Made smaller API changes

This commit is contained in:
Norbi Peti 2017-11-30 22:15:34 +01:00
parent 4c8a1c4582
commit 6fc92d5083

View file

@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
import buttondevteam.discordplugin.listeners.MCChatListener; import buttondevteam.discordplugin.listeners.MCChatListener;
@ -79,7 +80,7 @@ public class ChromaBot {
* @param color * @param color
* The color of the line before the text * The color of the line before the text
*/ */
public void sendFancyMessage(String message, Color color) { public void sendMessage(String message, Color color) {
MCChatListener.forAllMCChat(ch -> DiscordPlugin.sendMessageToChannel(ch, message, MCChatListener.forAllMCChat(ch -> DiscordPlugin.sendMessageToChannel(ch, message,
new EmbedBuilder().withTitle(message).withColor(color).build())); new EmbedBuilder().withTitle(message).withColor(color).build()));
} }
@ -94,7 +95,7 @@ public class ChromaBot {
* @param mcauthor * @param mcauthor
* The name of the Minecraft player who is the author of this message * The name of the Minecraft player who is the author of this message
*/ */
public void sendFancyMessage(String message, Color color, String mcauthor) { public void sendMessage(String message, Color color, String mcauthor) {
MCChatListener.forAllMCChat(ch -> DiscordPlugin.sendMessageToChannel(ch, message, MCChatListener.forAllMCChat(ch -> DiscordPlugin.sendMessageToChannel(ch, message,
DPUtils.embedWithHead(new EmbedBuilder().withTitle(message).withColor(color), mcauthor).build())); DPUtils.embedWithHead(new EmbedBuilder().withTitle(message).withColor(color), mcauthor).build()));
} }
@ -111,11 +112,26 @@ public class ChromaBot {
* @param authorimg * @param authorimg
* The URL of the avatar image for this message's author * The URL of the avatar image for this message's author
*/ */
public void sendFancyMessage(String message, Color color, String authorname, String authorimg) { public void sendMessage(String message, Color color, String authorname, String authorimg) {
MCChatListener.forAllMCChat(ch -> DiscordPlugin.sendMessageToChannel(ch, message, new EmbedBuilder() MCChatListener.forAllMCChat(ch -> DiscordPlugin.sendMessageToChannel(ch, message, new EmbedBuilder()
.withTitle(message).withColor(color).withAuthorName(authorname).withAuthorIcon(authorimg).build())); .withTitle(message).withColor(color).withAuthorName(authorname).withAuthorIcon(authorimg).build()));
} }
/**
* Send a message to the chat channel. This will show a bold text with a colored line.
*
* @param message
* The message to send, duh
* @param color
* The color of the line before the text
* @param sender
* The player who sends this message
*/
public void sendMessage(String message, Color color, Player sender) {
MCChatListener.forAllMCChat(ch -> DiscordPlugin.sendMessageToChannel(ch, message, DPUtils
.embedWithHead(new EmbedBuilder().withTitle(message).withColor(color), sender.getName()).build()));
}
public void updatePlayerList() { public void updatePlayerList() {
DPUtils.performNoWait(() -> { DPUtils.performNoWait(() -> {
String[] s = DiscordPlugin.chatchannel.getTopic().split("\\n----\\n"); String[] s = DiscordPlugin.chatchannel.getTopic().split("\\n----\\n");