Fixed start message not showing

This commit is contained in:
Norbi Peti 2017-01-04 20:56:00 +01:00
parent b7ef8f4048
commit d50e9a23ce

View file

@ -74,6 +74,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
public static IGuild devServer; public static IGuild devServer;
private static volatile BukkitTask task; private static volatile BukkitTask task;
private static volatile boolean sent = false;
@Override @Override
public void handle(ReadyEvent event) { public void handle(ReadyEvent event) {
@ -110,6 +111,11 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
SafeMode = false; SafeMode = false;
if (task != null) if (task != null)
task.cancel(); task.cancel();
if (!sent) {
sendMessageToChannel(chatchannel, "", new EmbedBuilder().withColor(Color.GREEN)
.withTitle("Server started - chat connected.").build());
sent = true;
}
}, 0, 10); }, 0, 10);
for (IListener<?> listener : CommandListener.getListeners()) for (IListener<?> listener : CommandListener.getListeners())
dc.getDispatcher().registerListener(listener); dc.getDispatcher().registerListener(listener);
@ -120,9 +126,6 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
Bukkit.getPluginManager().registerEvents(new ExceptionListener(), this); Bukkit.getPluginManager().registerEvents(new ExceptionListener(), this);
TBMCCoreAPI.RegisterEventsForExceptions(new MCListener(), this); TBMCCoreAPI.RegisterEventsForExceptions(new MCListener(), this);
TBMCChatAPI.AddCommands(this, DiscordMCCommandBase.class); TBMCChatAPI.AddCommands(this, DiscordMCCommandBase.class);
Bukkit.getScheduler().runTaskAsynchronously(this, () -> sendMessageToChannel(chatchannel, "",
new EmbedBuilder().withColor(Color.GREEN).withTitle("Server started - chat connected.").build()));
Runnable r = new Runnable() { Runnable r = new Runnable() {
public void run() { public void run() {
AnnouncementGetterThreadMethod(); AnnouncementGetterThreadMethod();