From a97ba5d1fd06c9df26a4266521aa3f076eb4c4b4 Mon Sep 17 00:00:00 2001 From: samczsun Date: Thu, 9 Mar 2017 21:48:40 -0500 Subject: [PATCH] PC-941 --- .../mineplex/core/message/MessageManager.java | 96 ++++++++++--------- .../core/message/commands/AdminCommand.java | 4 +- .../message/commands/MessageAdminCommand.java | 20 +++- .../core/message/commands/MessageCommand.java | 11 ++- .../message/commands/ResendAdminCommand.java | 15 ++- .../mineplex/core/preferences/Preference.java | 4 +- 6 files changed, 98 insertions(+), 52 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java index eec908cdf..cbb4950e9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java @@ -41,7 +41,9 @@ import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; +import java.util.List; import java.util.UUID; public class MessageManager extends MiniClientPlugin @@ -55,7 +57,7 @@ public class MessageManager extends MiniClientPlugin private PreferencesManager _preferences; private Punish _punish; private Chat _chat; - private ArrayList _randomMessage; + private List _randomMessage; private String _serverName; public MessageManager(JavaPlugin plugin, IncognitoManager incognitoManager, CoreClientManager clientManager, PreferencesManager preferences, @@ -301,44 +303,50 @@ public class MessageManager extends MiniClientPlugin @Override public void enable() { - _randomMessage = new ArrayList(); - _randomMessage.clear(); - _randomMessage.add("Hello, do you have any wild boars for purchase?"); - _randomMessage.add("There's a snake in my boot!"); - _randomMessage.add("Monk, I need a Monk!"); - _randomMessage.add("Hi, I'm from planet minecraft, op me plz dooooood!"); - _randomMessage.add("Somebody's poisoned the waterhole!"); - _randomMessage.add("MORE ORBZ MORE ORBZ MORE ORBZ MORE ORBZ!"); - _randomMessage.add("Chiss is a chiss and chiss chiss."); - _randomMessage.add("*_*"); - _randomMessage.add("#swag"); - _randomMessage.add("Everything went better then I thought."); - _randomMessage.add("HAVE A CHICKEN!"); - _randomMessage.add("follow me, i have xrays"); - _randomMessage.add("I'm making a java"); - _randomMessage.add("Do you talk to strangers? I have candy if it helps."); - _randomMessage.add("Solid 2.9/10"); - _randomMessage.add("close your eyes to sleep"); - _randomMessage.add("I crashed because my internet ran out."); - _randomMessage.add("I saw morgan freeman on a breaking bad ad on a bus."); - _randomMessage.add("Where is the volume control?"); - _randomMessage.add("I saw you playing on youtube with that guy and stuff."); - _randomMessage.add("Your worms must be worse than useless."); - _randomMessage.add("meow"); - _randomMessage.add("7"); - _randomMessage.add("Don't you wish your girlfriend was hot like me?"); - _randomMessage.add("how do you play mindcrafts?"); - _randomMessage.add("7 cats meow meow meow meow meow meow meow"); - _randomMessage.add("For King Jonalon!!!!!"); - _randomMessage.add("Do you like apples?"); - _randomMessage.add("I'm Happy Happy Happy."); - _randomMessage.add("kthxbye"); - _randomMessage.add("i like pie."); - _randomMessage.add("Do you play Clash of Clans?"); - _randomMessage.add("Mmm...Steak!"); - _randomMessage.add("Poop! Poop everywhere!"); - _randomMessage.add("I'm so forgetful. Like I was going to say somethin...wait what were we talking about?"); - _randomMessage.add("Mmm...Steak!"); + _randomMessage = Arrays.asList( + "The FitnessGramâ„¢ Pacer Test is a multistage aerobic capacity test that progressively gets more difficult as it continues", + "do you feel it now mr krabs?!", + "hisssssssss", + "what's a leader?", + "what guardians?", + "rawr!", + "where were you when the emus won the great emu war?", + "Hello, do you have any wild boars for purchase?", + "There's a snake in my boot!", + "Monk, I need a Monk!", + "Hi, I'm from planet minecraft, op me plz dooooood!", + "Somebody's poisoned the waterhole!", + "MORE ORBZ MORE ORBZ MORE ORBZ MORE ORBZ!", + "Chiss is a chiss and chiss chiss.", + "*_*", + "#swag", + "Everything went better then I thought.", + "HAVE A CHICKEN!", + "follow me, i have xrays", + "I'm making a java", + "Solid 2.9/10", + "close your eyes to sleep", + "I crashed because my internet ran out.", + "I saw morgan freeman on a breaking bad ad on a bus.", + "Where is the volume control?", + "I saw you playing on youtube with that guy and stuff.", + "Your worms must be worse than useless.", + "meow", + "7", + "Don't you wish your girlfriend was hot like me?", + "how do you play mindcrafts?", + "7 cats meow meow meow meow meow meow meow", + "For King Jonalon!!!!!", + "Do you like apples?", + "I'm Happy Happy Happy.", + "kthxbye", + "i like pie.", + "Do you play Clash of Clans?", + "Mmm...Steak!", + "Poop! Poop everywhere!", + "I'm so forgetful. Like I was going to say somethin...wait what were we talking about?", + "Mmm...Steak!" + ); } public CoreClientManager GetClientManager() @@ -354,11 +362,6 @@ public class MessageManager extends MiniClientPlugin return _randomMessage.get(UtilMath.r(_randomMessage.size())); } - public ArrayList GetRandomMessages() - { - return _randomMessage; - } - public void Help(Player caller) { Help(caller, null); @@ -641,4 +644,9 @@ public class MessageManager extends MiniClientPlugin { return _incognitoManager; } + + public PreferencesManager getPreferences() + { + return this._preferences; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/AdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/AdminCommand.java index 24cd9db26..8630d80ad 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/AdminCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/AdminCommand.java @@ -22,8 +22,8 @@ public class AdminCommand extends CommandBase public void Execute(Player caller, String[] args) { if (args == null || args.length == 0) - { - Plugin.Help(caller); + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Usage: " + F.elem("/a "))); } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java index 3dab673b8..192cf3c0d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java @@ -10,6 +10,7 @@ import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.message.MessageManager; +import mineplex.core.preferences.Preference; public class MessageAdminCommand extends CommandBase { @@ -27,7 +28,24 @@ public class MessageAdminCommand extends CommandBase } else { - String message = args.length > 1 ? F.combine(args, 1, null, false) : Plugin.GetRandomMessage(); + // Parse Message + String message; + if (args.length > 1) + { + message = F.combine(args, 1, null, false); + } + else + { + if (Plugin.getPreferences().get(caller).isActive(Preference.RANDOM_MESSAGES)) + { + message = Plugin.GetRandomMessage(); + } + else + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Cat got your tongue?")); + return; + } + } Plugin.sendMessage(caller, args[0], message, false, true); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageCommand.java index 03ceaa5fd..0dd7724e7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageCommand.java @@ -10,6 +10,7 @@ import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.message.MessageManager; +import mineplex.core.preferences.Preference; public class MessageCommand extends CommandBase { @@ -35,7 +36,15 @@ public class MessageCommand extends CommandBase } else { - message = Plugin.GetRandomMessage(); + if (Plugin.getPreferences().get(caller).isActive(Preference.RANDOM_MESSAGES)) + { + message = Plugin.GetRandomMessage(); + } + else + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Cat got your tongue?")); + return; + } } Plugin.sendMessage(caller, args[0], message, false, false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/ResendAdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/ResendAdminCommand.java index 3d5b1ce93..492f8d7bb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/ResendAdminCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/ResendAdminCommand.java @@ -7,6 +7,7 @@ import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.message.MessageManager; +import mineplex.core.preferences.Preference; public class ResendAdminCommand extends CommandBase { @@ -19,8 +20,8 @@ public class ResendAdminCommand extends CommandBase public void Execute(Player caller, String[] args) { if (args == null || args.length == 0) - { - Plugin.Help(caller); + { + UtilPlayer.message(caller, F.help(Plugin.getName(), "/ra [message]", GetRequiredRank())); } else { @@ -41,7 +42,15 @@ public class ResendAdminCommand extends CommandBase } else { - message = Plugin.GetRandomMessage(); + if (Plugin.getPreferences().get(caller).isActive(Preference.RANDOM_MESSAGES)) + { + message = Plugin.GetRandomMessage(); + } + else + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Cat got your tongue?")); + return; + } } Plugin.sendMessage(caller, lastTo, message, true, true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/Preference.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/Preference.java index fbeb15eb2..66c0f116c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/Preference.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/Preference.java @@ -46,7 +46,9 @@ public enum Preference COMMUNITY_INVITES(true, PreferenceCategory.SOCIAL, Material.BOOK, "Show Community Invites"), - PARTY_DISPLAY_INVENTORY_UI(true, PreferenceCategory.SOCIAL, Material.CHEST, "Display Parties GUI") + PARTY_DISPLAY_INVENTORY_UI(true, PreferenceCategory.SOCIAL, Material.CHEST, "Display Parties GUI"), + + RANDOM_MESSAGES(true, PreferenceCategory.USER, Material.COMMAND, "Send random messages", "Got nothing to say? We got you covered!") ; private static final Map PREFERENCE_MAP = Maps.newHashMap();