diff --git a/pom.xml b/pom.xml index 270da7f..c2d74d7 100755 --- a/pom.xml +++ b/pom.xml @@ -40,6 +40,14 @@ 1.8 1.8 + + @@ -96,6 +104,7 @@ --> maven-surefire-plugin + 2.4.2 false diff --git a/src/main/java/buttondevteam/discordplugin/announcer/AnnouncerModule.java b/src/main/java/buttondevteam/discordplugin/announcer/AnnouncerModule.java index c434dce..a0c11a0 100644 --- a/src/main/java/buttondevteam/discordplugin/announcer/AnnouncerModule.java +++ b/src/main/java/buttondevteam/discordplugin/announcer/AnnouncerModule.java @@ -20,6 +20,9 @@ import java.io.File; import java.util.List; public class AnnouncerModule extends Component { + /** + * Channel to post new posts. + */ public ConfigData channel() { return DPUtils.channelData(getConfig(), "channel", 239519012529111040L); } @@ -29,7 +32,7 @@ public class AnnouncerModule extends Component { } /** - * Set to 0 or >50 to disable + * Automatically unpins all messages except the last few. Set to 0 or >50 to disable */ public ConfigData keepPinned() { return getConfig().getData("keepPinned", (short) 40); diff --git a/src/main/java/buttondevteam/discordplugin/fun/FunModule.java b/src/main/java/buttondevteam/discordplugin/fun/FunModule.java index f5adf0d..e5faead 100644 --- a/src/main/java/buttondevteam/discordplugin/fun/FunModule.java +++ b/src/main/java/buttondevteam/discordplugin/fun/FunModule.java @@ -40,19 +40,23 @@ public class FunModule extends Component implements Listener { "When will *you* be open?" // Ali }; - private ConfigData serverReady() { - return getConfig().getData("serverReady", true); + /** + * Questions that the bot will choose a random answer to give to. + */ + private ConfigData serverReadyQuestions() { + return getConfig().getData("serverReady", ()->new String[]{"when will the server be open", + "when will the server be ready", "when will the server be done", "when will the server be complete", + "when will the server be finished", "when's the server ready", "when's the server open", + "Vhen vill ze server be open?"}); } + /** + * Answers for a recognized question. Selected randomly. + */ private ConfigData> serverReadyAnswers() { return getConfig().getData("serverReadyAnswers", () -> Lists.newArrayList(serverReadyStrings)); //TODO: Test } - private static final String[] serverReadyQuestions = new String[]{"when will the server be open", - "when will the server be ready", "when will the server be done", "when will the server be complete", - "when will the server be finished", "when's the server ready", "when's the server open", - "Vhen vill ze server be open?"}; - private static final Random serverReadyRandom = new Random(); private static final ArrayList usableServerReadyStrings = new ArrayList<>(0); @@ -93,16 +97,14 @@ public class FunModule extends Component implements Listener { return true; //Handled } lastlistp = (short) Bukkit.getOnlinePlayers().size(); //Didn't handle - if (fm.serverReady().get()) { - if (!TBMCCoreAPI.IsTestServer() - && Arrays.stream(serverReadyQuestions).anyMatch(msglowercased::contains)) { - int next; - if (usableServerReadyStrings.size() == 0) - fm.createUsableServerReadyStrings(); - next = usableServerReadyStrings.remove(serverReadyRandom.nextInt(usableServerReadyStrings.size())); - DiscordPlugin.sendMessageToChannel(message.getChannel(), serverReadyStrings[next]); - return false; //Still process it as a command/mcchat if needed - } + if (!TBMCCoreAPI.IsTestServer() + && Arrays.stream(fm.serverReadyQuestions().get()).anyMatch(msglowercased::contains)) { + int next; + if (usableServerReadyStrings.size() == 0) + fm.createUsableServerReadyStrings(); + next = usableServerReadyStrings.remove(serverReadyRandom.nextInt(usableServerReadyStrings.size())); + DiscordPlugin.sendMessageToChannel(message.getChannel(), serverReadyStrings[next]); + return false; //Still process it as a command/mcchat if needed } return false; } diff --git a/src/main/java/buttondevteam/discordplugin/mcchat/MinecraftChatModule.java b/src/main/java/buttondevteam/discordplugin/mcchat/MinecraftChatModule.java index 509ea66..94ef49d 100644 --- a/src/main/java/buttondevteam/discordplugin/mcchat/MinecraftChatModule.java +++ b/src/main/java/buttondevteam/discordplugin/mcchat/MinecraftChatModule.java @@ -25,9 +25,9 @@ import java.util.stream.Collectors; public class MinecraftChatModule extends Component { private @Getter MCChatListener listener; - public MCChatListener getListener() { //It doesn't want to generate - return listener; - } + /*public MCChatListener getListener() { //It doesn't want to generate + return listener; - And now ButtonProcessor didn't look beyond this - return instead of continue... + }*/ /** * A list of commands that can be used in public chats - Warning: Some plugins will treat players as OPs, always test before allowing a command! @@ -52,7 +52,7 @@ public class MinecraftChatModule extends Component { } /** - * 0 * The plugins to exclude from fake player events used for the 'mcchat' command - some plugins may crash, add them here + * The plugins to exclude from fake player events used for the 'mcchat' command - some plugins may crash, add them here */ public ConfigData excludedPlugins() { return getConfig().getData("excludedPlugins", new String[]{"ProtocolLib", "LibsDisguises", "JourneyMapServer"});