This commit is contained in:
samczsun 2017-03-09 21:48:40 -05:00 committed by cnr
parent f03df67219
commit a97ba5d1fd
6 changed files with 98 additions and 52 deletions

View File

@ -41,7 +41,9 @@ import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.UUID; import java.util.UUID;
public class MessageManager extends MiniClientPlugin<ClientMessage> public class MessageManager extends MiniClientPlugin<ClientMessage>
@ -55,7 +57,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
private PreferencesManager _preferences; private PreferencesManager _preferences;
private Punish _punish; private Punish _punish;
private Chat _chat; private Chat _chat;
private ArrayList<String> _randomMessage; private List<String> _randomMessage;
private String _serverName; private String _serverName;
public MessageManager(JavaPlugin plugin, IncognitoManager incognitoManager, CoreClientManager clientManager, PreferencesManager preferences, public MessageManager(JavaPlugin plugin, IncognitoManager incognitoManager, CoreClientManager clientManager, PreferencesManager preferences,
@ -301,44 +303,50 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
@Override @Override
public void enable() public void enable()
{ {
_randomMessage = new ArrayList<String>(); _randomMessage = Arrays.asList(
_randomMessage.clear(); "The FitnessGram™ Pacer Test is a multistage aerobic capacity test that progressively gets more difficult as it continues",
_randomMessage.add("Hello, do you have any wild boars for purchase?"); "do you feel it now mr krabs?!",
_randomMessage.add("There's a snake in my boot!"); "hisssssssss",
_randomMessage.add("Monk, I need a Monk!"); "what's a leader?",
_randomMessage.add("Hi, I'm from planet minecraft, op me plz dooooood!"); "what guardians?",
_randomMessage.add("Somebody's poisoned the waterhole!"); "rawr!",
_randomMessage.add("MORE ORBZ MORE ORBZ MORE ORBZ MORE ORBZ!"); "where were you when the emus won the great emu war?",
_randomMessage.add("Chiss is a chiss and chiss chiss."); "Hello, do you have any wild boars for purchase?",
_randomMessage.add("*_*"); "There's a snake in my boot!",
_randomMessage.add("#swag"); "Monk, I need a Monk!",
_randomMessage.add("Everything went better then I thought."); "Hi, I'm from planet minecraft, op me plz dooooood!",
_randomMessage.add("HAVE A CHICKEN!"); "Somebody's poisoned the waterhole!",
_randomMessage.add("follow me, i have xrays"); "MORE ORBZ MORE ORBZ MORE ORBZ MORE ORBZ!",
_randomMessage.add("I'm making a java"); "Chiss is a chiss and chiss chiss.",
_randomMessage.add("Do you talk to strangers? I have candy if it helps."); "*_*",
_randomMessage.add("Solid 2.9/10"); "#swag",
_randomMessage.add("close your eyes to sleep"); "Everything went better then I thought.",
_randomMessage.add("I crashed because my internet ran out."); "HAVE A CHICKEN!",
_randomMessage.add("I saw morgan freeman on a breaking bad ad on a bus."); "follow me, i have xrays",
_randomMessage.add("Where is the volume control?"); "I'm making a java",
_randomMessage.add("I saw you playing on youtube with that guy and stuff."); "Solid 2.9/10",
_randomMessage.add("Your worms must be worse than useless."); "close your eyes to sleep",
_randomMessage.add("meow"); "I crashed because my internet ran out.",
_randomMessage.add("7"); "I saw morgan freeman on a breaking bad ad on a bus.",
_randomMessage.add("Don't you wish your girlfriend was hot like me?"); "Where is the volume control?",
_randomMessage.add("how do you play mindcrafts?"); "I saw you playing on youtube with that guy and stuff.",
_randomMessage.add("7 cats meow meow meow meow meow meow meow"); "Your worms must be worse than useless.",
_randomMessage.add("For King Jonalon!!!!!"); "meow",
_randomMessage.add("Do you like apples?"); "7",
_randomMessage.add("I'm Happy Happy Happy."); "Don't you wish your girlfriend was hot like me?",
_randomMessage.add("kthxbye"); "how do you play mindcrafts?",
_randomMessage.add("i like pie."); "7 cats meow meow meow meow meow meow meow",
_randomMessage.add("Do you play Clash of Clans?"); "For King Jonalon!!!!!",
_randomMessage.add("Mmm...Steak!"); "Do you like apples?",
_randomMessage.add("Poop! Poop everywhere!"); "I'm Happy Happy Happy.",
_randomMessage.add("I'm so forgetful. Like I was going to say somethin...wait what were we talking about?"); "kthxbye",
_randomMessage.add("Mmm...Steak!"); "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() public CoreClientManager GetClientManager()
@ -354,11 +362,6 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
return _randomMessage.get(UtilMath.r(_randomMessage.size())); return _randomMessage.get(UtilMath.r(_randomMessage.size()));
} }
public ArrayList<String> GetRandomMessages()
{
return _randomMessage;
}
public void Help(Player caller) public void Help(Player caller)
{ {
Help(caller, null); Help(caller, null);
@ -641,4 +644,9 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
{ {
return _incognitoManager; return _incognitoManager;
} }
public PreferencesManager getPreferences()
{
return this._preferences;
}
} }

View File

@ -22,8 +22,8 @@ public class AdminCommand extends CommandBase<MessageManager>
public void Execute(Player caller, String[] args) public void Execute(Player caller, String[] args)
{ {
if (args == null || args.length == 0) if (args == null || args.length == 0)
{ {
Plugin.Help(caller); UtilPlayer.message(caller, F.main(Plugin.getName(), "Usage: " + F.elem("/a <message>")));
} }
else else
{ {

View File

@ -10,6 +10,7 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.message.MessageManager; import mineplex.core.message.MessageManager;
import mineplex.core.preferences.Preference;
public class MessageAdminCommand extends CommandBase<MessageManager> public class MessageAdminCommand extends CommandBase<MessageManager>
{ {
@ -27,7 +28,24 @@ public class MessageAdminCommand extends CommandBase<MessageManager>
} }
else 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); Plugin.sendMessage(caller, args[0], message, false, true);
} }
} }

View File

@ -10,6 +10,7 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.message.MessageManager; import mineplex.core.message.MessageManager;
import mineplex.core.preferences.Preference;
public class MessageCommand extends CommandBase<MessageManager> public class MessageCommand extends CommandBase<MessageManager>
{ {
@ -35,7 +36,15 @@ public class MessageCommand extends CommandBase<MessageManager>
} }
else 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); Plugin.sendMessage(caller, args[0], message, false, false);

View File

@ -7,6 +7,7 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.message.MessageManager; import mineplex.core.message.MessageManager;
import mineplex.core.preferences.Preference;
public class ResendAdminCommand extends CommandBase<MessageManager> public class ResendAdminCommand extends CommandBase<MessageManager>
{ {
@ -19,8 +20,8 @@ public class ResendAdminCommand extends CommandBase<MessageManager>
public void Execute(Player caller, String[] args) public void Execute(Player caller, String[] args)
{ {
if (args == null || args.length == 0) if (args == null || args.length == 0)
{ {
Plugin.Help(caller); UtilPlayer.message(caller, F.help(Plugin.getName(), "/ra [message]", GetRequiredRank()));
} }
else else
{ {
@ -41,7 +42,15 @@ public class ResendAdminCommand extends CommandBase<MessageManager>
} }
else 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); Plugin.sendMessage(caller, lastTo, message, true, true);

View File

@ -46,7 +46,9 @@ public enum Preference
COMMUNITY_INVITES(true, PreferenceCategory.SOCIAL, Material.BOOK, "Show Community Invites"), 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<Integer, Preference> PREFERENCE_MAP = Maps.newHashMap(); private static final Map<Integer, Preference> PREFERENCE_MAP = Maps.newHashMap();