Added some things
- Made the chat connect message only show up when everything is ready (probably) - Made the plugin enable/disable errors send if possible - Added /mwiki as an allowed cmd - Added DiscordPlayerSender with a metric shit ton of overridden methods
This commit is contained in:
parent
a2dd94f501
commit
13a3616a47
3 changed files with 1640 additions and 9 deletions
1632
src/main/java/buttondevteam/discordplugin/DiscordPlayerSender.java
Normal file
1632
src/main/java/buttondevteam/discordplugin/DiscordPlayerSender.java
Normal file
File diff suppressed because it is too large
Load diff
|
@ -73,7 +73,6 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
|||
public static IChannel genchannel;
|
||||
public static IChannel chatchannel;
|
||||
public static IChannel issuechannel;
|
||||
public static IChannel debugchannel;
|
||||
public static IChannel botroomchannel;
|
||||
public static IGuild mainServer;
|
||||
public static IGuild devServer;
|
||||
|
@ -83,18 +82,18 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
|||
@Override
|
||||
public void handle(ReadyEvent event) {
|
||||
try {
|
||||
int retryc = 0;
|
||||
do {
|
||||
mainServer = event.getClient().getGuildByID("125813020357165056");
|
||||
devServer = event.getClient().getGuildByID("219529124321034241");
|
||||
Thread.sleep(100);
|
||||
} while (mainServer == null || devServer == null);
|
||||
} while ((mainServer == null || devServer == null) && retryc++ < 10);
|
||||
if (!Test) {
|
||||
botchannel = mainServer.getChannelByID("209720707188260864"); // bot
|
||||
annchannel = mainServer.getChannelByID("126795071927353344"); // announcements
|
||||
genchannel = mainServer.getChannelByID("125813020357165056"); // general
|
||||
chatchannel = mainServer.getChannelByID("249663564057411596"); // minecraft_chat
|
||||
issuechannel = devServer.getChannelByID("219643416496046081"); // server-issues
|
||||
debugchannel = devServer.getChannelByID("250332016199860224"); // debug-channel
|
||||
botroomchannel = devServer.getChannelByID("239519012529111040");// bot-room
|
||||
dc.changeStatus(Status.game("on TBMC"));
|
||||
} else {
|
||||
|
@ -103,11 +102,11 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
|||
genchannel = devServer.getChannelByID("239519012529111040"); // bot-room
|
||||
botroomchannel = devServer.getChannelByID("239519012529111040");// bot-room
|
||||
issuechannel = devServer.getChannelByID("239519012529111040"); // bot-room
|
||||
debugchannel = devServer.getChannelByID("239519012529111040"); // bot-room
|
||||
chatchannel = devServer.getChannelByID("248185455508455424"); // minecraft_chat_test
|
||||
dc.changeStatus(Status.game("testing"));
|
||||
}
|
||||
sendMessageToChannel(chatchannel, "Server started - chat connected.");
|
||||
Bukkit.getScheduler().runTaskAsynchronously(this,
|
||||
() -> sendMessageToChannel(chatchannel, "Server started - chat connected."));
|
||||
Runnable r = new Runnable() {
|
||||
public void run() {
|
||||
AnnouncementGetterThreadMethod();
|
||||
|
@ -116,14 +115,14 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
|||
Thread t = new Thread(r);
|
||||
t.start();
|
||||
List<IMessage> msgs = genchannel.getPinnedMessages();
|
||||
for (int i = msgs.size() - 1; i >= 10; i--) {
|
||||
for (int i = msgs.size() - 1; i >= 10; i--) { // Unpin all pinned messages except the newest 10
|
||||
genchannel.unpin(msgs.get(i));
|
||||
}
|
||||
setupProviders();
|
||||
TBMCCoreAPI.SendUnsentExceptions();
|
||||
TBMCCoreAPI.SendUnsentDebugMessages();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
TBMCCoreAPI.SendException("An error occured while enabling DiscordPlugin!", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +137,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
|||
dc.changeStatus(Status.game("on TBMC"));
|
||||
dc.logout();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
TBMCCoreAPI.SendException("An error occured while disabling DiscordPlugin!", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class MCChatListener implements Listener, IListener<MessageReceivedEvent>
|
|||
"<" + e.getSender().getName() + "> " + e.getMessage());
|
||||
}
|
||||
|
||||
private static final String[] UnconnectedCmds = new String[] { "list", "u", "shrug", "tableflip", "unflip" };
|
||||
private static final String[] UnconnectedCmds = new String[] { "list", "u", "shrug", "tableflip", "unflip", "mwiki" };
|
||||
|
||||
public static final HashMap<String, DiscordSender> UnconnectedSenders = new HashMap<>();
|
||||
|
||||
|
|
Loading…
Reference in a new issue