Add commands /ignore and /unignore. Fixed mutes not working with private messaging

This commit is contained in:
libraryaddict 2015-02-10 02:31:33 +13:00
parent cf0134a577
commit ce7db289a7
9 changed files with 623 additions and 181 deletions

View File

@ -0,0 +1,244 @@
package mineplex.core.ignore;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.jsonchat.ChildJsonMessage;
import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.ignore.command.Ignore;
import mineplex.core.ignore.command.Unignore;
import mineplex.core.ignore.data.IgnoreData;
import mineplex.core.ignore.data.IgnoreRepository;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class IgnoreManager extends MiniDbClientPlugin<IgnoreData>
{
private PreferencesManager _preferenceManager;
private IgnoreRepository _repository;
private Portal _portal;
public IgnoreManager(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences, Portal portal)
{
super("Ignore", plugin, clientManager);
_preferenceManager = preferences;
_repository = new IgnoreRepository(plugin);
_portal = portal;
}
public PreferencesManager getPreferenceManager()
{
return _preferenceManager;
}
public Portal getPortal()
{
return _portal;
}
public boolean isIgnoring(Player caller, Player target)
{
return isIgnoring(caller, target.getName());
}
public boolean isIgnoring(Player caller, String target)
{
IgnoreData data = Get(caller);
for (String ignored : data.getIgnored())
{
if (ignored.equalsIgnoreCase(target))
{
return true;
}
}
return false;
}
@Override
public void AddCommands()
{
addCommand(new Ignore(this));
addCommand(new Unignore(this));
}
@Override
protected IgnoreData AddPlayer(String player)
{
return new IgnoreData();
}
@EventHandler
public void onChat(AsyncPlayerChatEvent event)
{
if (ClientManager.Get(event.getPlayer()).GetRank().Has(Rank.HELPER))
return;
Iterator<Player> itel = event.getRecipients().iterator();
while (itel.hasNext())
{
Player player = itel.next();
IgnoreData info = Get(player);
for (String ignored : info.getIgnored())
{
if (ignored.equalsIgnoreCase(event.getPlayer().getName()))
{
itel.remove();
break;
}
}
}
}
public void addIgnore(final Player caller, final String name)
{
if (caller.getName().equalsIgnoreCase(name))
{
caller.sendMessage(F.main(getName(), ChatColor.GRAY + "You cannot ignore yourself"));
return;
}
for (String status : Get(caller).getIgnored())
{
if (status.equalsIgnoreCase(name))
{
caller.sendMessage(F.main(getName(), ChatColor.GREEN + name + ChatColor.GRAY + " has already been ignored."));
return;
}
}
IgnoreData ignoreData = Get(caller);
if (ignoreData != null)
{
ignoreData.getIgnored().add(name);
}
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
{
public void run()
{
_repository.addIgnore(caller, name);
Bukkit.getServer().getScheduler().runTask(_plugin, new Runnable()
{
public void run()
{
caller.sendMessage(F.main(getName(), "Now ignoring " + ChatColor.GREEN + name));
}
});
}
});
}
public void removeIgnore(final Player caller, final String name)
{
IgnoreData ignoreData = Get(caller);
if (ignoreData != null)
{
Iterator<String> itel = ignoreData.getIgnored().iterator();
while (itel.hasNext())
{
String ignored = itel.next();
if (ignored.equalsIgnoreCase(name))
{
itel.remove();
break;
}
}
}
caller.sendMessage(F.main(getName(), "No longer ignoring " + ChatColor.GREEN + name + ChatColor.GRAY + "!"));
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
{
public void run()
{
_repository.removeIgnore(caller.getName(), name);
}
});
}
public void showIgnores(Player caller)
{
List<String> ignoredPlayers = Get(caller).getIgnored();
caller.sendMessage(C.cAqua + C.Strike + "=====================[" + ChatColor.RESET + C.cWhite + C.Bold + "Ignoring"
+ ChatColor.RESET + C.cAqua + C.Strike + "]======================");
ArrayList<ChildJsonMessage> sentLines = new ArrayList<ChildJsonMessage>();
for (String ignored : ignoredPlayers)
{
ChildJsonMessage message = new JsonMessage("").color("white").extra("").color("white");
message.add("Ignoring " + ignored).color("gray");
message.add(" - ").color("white");
message.add("Unignore").color("red").bold().click("run_command", "/unignore " + ignored)
.hover("show_text", "Stop ignoring " + ignored);
sentLines.add(message);
}
// Send In Order
for (JsonMessage msg : sentLines)
msg.sendToPlayer(caller);
if (sentLines.isEmpty())
{
caller.sendMessage(" ");
caller.sendMessage("Welcome to your Ignore List!");
caller.sendMessage(" ");
caller.sendMessage("To ignore people, type " + C.cGreen + "/ignore <Player Name>");
caller.sendMessage(" ");
caller.sendMessage("Type " + C.cGreen + "/ignore" + ChatColor.RESET + " at any time to view the ignored!");
caller.sendMessage(" ");
}
ChildJsonMessage message = new JsonMessage("").extra(C.cAqua + C.Strike
+ "=====================================================");
message.sendToPlayer(caller);
}
@Override
public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException
{
Set(playerName, _repository.loadClientInformation(resultSet));
}
@Override
public String getQuery(String uuid, String name)
{
return "SELECT tA.Name FROM accountIgnore INNER Join accounts AS fA ON fA.uuid = uuidIgnorer INNER JOIN accounts AS tA ON tA.uuid = uuidIgnored LEFT JOIN playerMap ON tA.name = playerName WHERE uuidIgnorer = '"
+ uuid + "';";
}
}

View File

@ -0,0 +1,38 @@
package mineplex.core.ignore.command;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.Callback;
import mineplex.core.ignore.IgnoreManager;
import org.bukkit.entity.Player;
public class Ignore extends CommandBase<IgnoreManager>
{
public Ignore(IgnoreManager plugin)
{
super(plugin, Rank.ALL, "ignore");
}
@Override
public void Execute(final Player caller, final String[] args)
{
if (args == null)
{
Plugin.showIgnores(caller);
}
else
{
CommandCenter.GetClientManager().checkPlayerName(caller, args[0], new Callback<String>()
{
public void run(String result)
{
if (result != null)
{
Plugin.addIgnore(caller, result);
}
}
});
}
}
}

View File

@ -0,0 +1,37 @@
package mineplex.core.ignore.command;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.ignore.IgnoreManager;
import org.bukkit.entity.Player;
public class Unignore extends CommandBase<IgnoreManager>
{
public Unignore(IgnoreManager plugin)
{
super(plugin, Rank.ALL, "unignore");
}
@Override
public void Execute(final Player caller, final String[] args)
{
if (args == null)
F.main(Plugin.getName(), "You need to include a player's name.");
else
{
CommandCenter.GetClientManager().checkPlayerName(caller, args[0], new Callback<String>()
{
public void run(String result)
{
if (result != null)
{
Plugin.removeIgnore(caller, result);
}
}
});
}
}
}

View File

@ -0,0 +1,14 @@
package mineplex.core.ignore.data;
import java.util.ArrayList;
public class IgnoreData
{
private ArrayList<String> _ignored = new ArrayList<String>();
public ArrayList<String> getIgnored()
{
return _ignored;
}
}

View File

@ -0,0 +1,60 @@
package mineplex.core.ignore.data;
import java.sql.ResultSet;
import java.sql.SQLException;
import mineplex.core.database.RepositoryBase;
import mineplex.core.database.column.ColumnVarChar;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class IgnoreRepository extends RepositoryBase
{
private static String ADD_IGNORE_RECORD = "INSERT INTO accountIgnore (uuidIgnorer, uuidIgnored) SELECT fA.uuid AS uuidIgnorer, tA.uuid AS uuidIgnored FROM accounts as fA LEFT JOIN accounts AS tA ON tA.name = ? WHERE fA.name = ?;";
private static String DELETE_IGNORE_RECORD = "DELETE aF FROM accountIgnore AS aF INNER JOIN accounts as fA ON aF.uuidIgnorer = fA.uuid INNER JOIN accounts AS tA ON aF.uuidIgnored = tA.uuid WHERE fA.name = ? AND tA.name = ?;";
public IgnoreRepository(JavaPlugin plugin)
{
super(plugin, "jdbc:mysql://db.mineplex.com:3306/Account?autoReconnect=true&failOverReadOnly=false&maxReconnects=10",
"root", "tAbechAk3wR7tuTh");
}
@Override
protected void initialize()
{
}
@Override
protected void update()
{
}
public boolean addIgnore(final Player caller, String name)
{
int rowsAffected = executeUpdate(ADD_IGNORE_RECORD, new ColumnVarChar("name", 100, name), new ColumnVarChar("name", 100,
caller.getName()));
return rowsAffected > 0;
}
public boolean removeIgnore(String caller, String name)
{
int rowsAffected = executeUpdate(DELETE_IGNORE_RECORD, new ColumnVarChar("name", 100, caller), new ColumnVarChar("name",
100, name));
return rowsAffected > 0;
}
public IgnoreData loadClientInformation(ResultSet resultSet) throws SQLException
{
IgnoreData ignoreData = new IgnoreData();
while (resultSet.next())
{
ignoreData.getIgnored().add(resultSet.getString(1));
}
return ignoreData;
}
}

View File

@ -15,196 +15,251 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.ignore.IgnoreManager;
import mineplex.core.message.Commands.*;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.punish.Punish;
import mineplex.core.punish.PunishClient;
import mineplex.core.punish.Punishment;
import mineplex.core.punish.PunishmentSentence;
import mineplex.serverdata.ServerCommandManager;
import mineplex.serverdata.transfers.AnnouncementCommand;
public class MessageManager extends MiniClientPlugin<ClientMessage>
{
private LinkedList<String> _randomMessage;
private LinkedList<String> _randomMessage;
private CoreClientManager _clientManager;
private PreferencesManager _preferences;
private CoreClientManager _clientManager;
private PreferencesManager _preferences;
private IgnoreManager _ignoreManager;
private Punish _punish;
public MessageManager(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences)
{
super("Message", plugin);
public MessageManager(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences,
IgnoreManager ignoreManager, Punish punish)
{
super("Message", plugin);
_clientManager = clientManager;
_preferences = preferences;
_clientManager = clientManager;
_preferences = preferences;
_ignoreManager = ignoreManager;
_punish = punish;
ServerCommandManager.getInstance().registerCommandType("AnnouncementCommand", AnnouncementCommand.class, new AnnouncementHandler());
}
ServerCommandManager.getInstance().registerCommandType("AnnouncementCommand", AnnouncementCommand.class,
new AnnouncementHandler());
}
//Module Functions
@Override
public void Enable()
{
_randomMessage = new LinkedList<String>();
_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!");
}
// Module Functions
@Override
public void Enable()
{
_randomMessage = new LinkedList<String>();
_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!");
}
public void AddCommands()
{
addCommand(new MessageCommand(this));
addCommand(new ResendCommand(this));
public void AddCommands()
{
addCommand(new MessageCommand(this));
addCommand(new ResendCommand(this));
addCommand(new MessageAdminCommand(this));
addCommand(new ResendAdminCommand(this));
addCommand(new MessageAdminCommand(this));
addCommand(new ResendAdminCommand(this));
addCommand(new AnnounceCommand(this));
addCommand(new GlobalCommand(this));
addCommand(new AnnounceCommand(this));
addCommand(new GlobalCommand(this));
addCommand(new AdminCommand(this));
}
addCommand(new AdminCommand(this));
}
public void Help(Player caller, String message)
{
UtilPlayer.message(caller, F.main(_moduleName, ChatColor.RED + "Err...something went wrong?"));
}
public void Help(Player caller, String message)
{
UtilPlayer.message(caller, F.main(_moduleName, ChatColor.RED + "Err...something went wrong?"));
}
public void Help(Player caller)
{
Help(caller, null);
}
public void Help(Player caller)
{
Help(caller, null);
}
/* XXX Incorporate this
PunishChatEvent event = new PunishChatEvent(caller);
GetPlugin().getServer().getPluginManager().callEvent(event);
/* XXX Incorporate this
PunishChatEvent event = new PunishChatEvent(caller);
if (event.isCancelled())
return;
*/
GetPlugin().getServer().getPluginManager().callEvent(event);
public boolean canMessage(Player from, Player to)
{
PunishClient client = _punish.GetClient(from.getName());
if (event.isCancelled())
return;
*/
if (client.IsMuted())
{
Punishment punishment = client.GetPunishment(PunishmentSentence.Mute);
public void DoMessage(Player from, Player to, String message)
{
if (!_preferences.Get(to).PrivateMessaging)
{
UtilPlayer.message(from, C.cPurple + to.getName() + " has private messaging disabled.");
return;
}
from.sendMessage(F.main(_punish.getName(), "Shh, you're muted because "
//Inform
UtilPlayer.message(from, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message);
+ punishment.GetReason()
//Save
Get(from).LastTo = to.getName();
+ " by "
//Chiss
if (to.getName().equals("Chiss"))
{
UtilPlayer.message(from, C.cPurple + "Chiss is often AFK or minimized, due to plugin development.");
UtilPlayer.message(from, C.cPurple + "Please be patient if he does not reply instantly.");
}
+ punishment.GetAdmin()
//Defek
if (to.getName().equals("defek7"))
{
UtilPlayer.message(from, C.cPurple + "defek7 is often AFK or minimized, due to plugin development.");
UtilPlayer.message(from, C.cPurple + "Please be patient if he does not reply instantly.");
}
+ " for "
//Log
//Logger().logChat("Private Message", from, to.getName(), message);
+ C.cGreen
//Ignored XXX
//if (Get(to).Ignore().IsIgnored(from.getName()))
// return;
+ UtilTime.convertString(punishment.GetRemaining(), 1, TimeUnit.FIT) + "."));
return false;
}
//Sound
from.playSound(to.getLocation(), Sound.NOTE_PIANO, 1f, 1f);
to.playSound(to.getLocation(), Sound.NOTE_PIANO, 2f, 2f);
// If the receiver has turned off private messaging and the sender isn't a mod
if (!_preferences.Get(to).PrivateMessaging && !_clientManager.Get(from).GetRank().Has(Rank.HELPER))
{
UtilPlayer.message(from, C.cPurple + to.getName() + " has private messaging disabled.");
return false;
}
//Send
UtilPlayer.message(to, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message);
}
if (_ignoreManager.isIgnoring(from, to))
{
from.sendMessage(F.main(_ignoreManager.getName(), ChatColor.GRAY + "You are ignoring that player"));
public void DoMessageAdmin(Player from, Player to, String message)
{
//Inform
UtilPlayer.message(from, C.cPurple + "-> " + F.rank(_clientManager.Get(to).GetRank()) + " " + to.getName() + " " + C.cPurple + message);
return false;
}
//Inform Admins
for (Player staff : UtilServer.getPlayers())
if (!to.equals(staff))
if (!from.equals(staff))
if (_clientManager.Get(staff).GetRank().Has(Rank.HELPER))
UtilPlayer.message(staff, F.rank(_clientManager.Get(from).GetRank()) + " " + from.getName() +
C.cPurple + " -> " + F.rank(_clientManager.Get(to).GetRank()) + " " + to.getName() + " " + C.cPurple + message);
// If the receiver is ignoring the sender, and the sender isn't a mod
if (_ignoreManager.isIgnoring(to, from) && !_clientManager.Get(from).GetRank().Has(Rank.HELPER))
{
from.sendMessage(F.main(_ignoreManager.getName(), ChatColor.GRAY + "That player is ignoring you"));
//Save
Get(from).LastAdminTo = to.getName();
return false;
}
//Send
UtilPlayer.message(to, C.cPurple + "<- " + F.rank(_clientManager.Get(from).GetRank()) + " " + from.getName() + " " + C.cPurple + message);
return true;
}
//Sound
from.playSound(to.getLocation(), Sound.NOTE_PIANO, 1f, 1f);
to.playSound(to.getLocation(), Sound.NOTE_PIANO, 2f, 2f);
public void DoMessage(Player from, Player to, String message)
{
if (!canMessage(from, to))
{
return;
}
//Log XXX
//Logger().logChat("Staff Message", from, to.getName(), message);
}
// Inform
UtilPlayer.message(from, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message);
@Override
protected ClientMessage AddPlayer(String player)
{
Set(player, new ClientMessage());
return Get(player);
}
// Save
Get(from).LastTo = to.getName();
public LinkedList<String> GetRandomMessages()
{
return _randomMessage;
}
// Chiss or defek7
if (to.getName().equals("Chiss") || to.getName().equals("defek7"))
{
UtilPlayer.message(from, C.cPurple + to.getName() + "is often AFK or minimized, due to plugin development.");
UtilPlayer.message(from, C.cPurple + "Please be patient if he does not reply instantly.");
}
public String GetRandomMessage()
{
if (_randomMessage.isEmpty())
return "meow";
// Log
// Logger().logChat("Private Message", from, to.getName(), message);
return _randomMessage.get(UtilMath.r(_randomMessage.size()));
}
// Ignored XXX
// if (Get(to).Ignore().IsIgnored(from.getName()))
// return;
public CoreClientManager GetClientManager()
{
return _clientManager;
}
// Sound
from.playSound(to.getLocation(), Sound.NOTE_PIANO, 1f, 1f);
to.playSound(to.getLocation(), Sound.NOTE_PIANO, 2f, 2f);
// Send
UtilPlayer.message(to, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message);
}
public void DoMessageAdmin(Player from, Player to, String message)
{
// Inform
UtilPlayer.message(from, C.cPurple + "-> " + F.rank(_clientManager.Get(to).GetRank()) + " " + to.getName() + " "
+ C.cPurple + message);
// Inform Admins
for (Player staff : UtilServer.getPlayers())
if (!to.equals(staff))
if (!from.equals(staff))
if (_clientManager.Get(staff).GetRank().Has(Rank.HELPER))
UtilPlayer.message(staff, F.rank(_clientManager.Get(from).GetRank()) + " " + from.getName() + C.cPurple
+ " -> " + F.rank(_clientManager.Get(to).GetRank()) + " " + to.getName() + " " + C.cPurple
+ message);
// Save
Get(from).LastAdminTo = to.getName();
// Send
UtilPlayer.message(to, C.cPurple + "<- " + F.rank(_clientManager.Get(from).GetRank()) + " " + from.getName() + " "
+ C.cPurple + message);
// Sound
from.playSound(to.getLocation(), Sound.NOTE_PIANO, 1f, 1f);
to.playSound(to.getLocation(), Sound.NOTE_PIANO, 2f, 2f);
// Log XXX
// Logger().logChat("Staff Message", from, to.getName(), message);
}
@Override
protected ClientMessage AddPlayer(String player)
{
Set(player, new ClientMessage());
return Get(player);
}
public LinkedList<String> GetRandomMessages()
{
return _randomMessage;
}
public String GetRandomMessage()
{
if (_randomMessage.isEmpty())
return "meow";
return _randomMessage.get(UtilMath.r(_randomMessage.size()));
}
public CoreClientManager GetClientManager()
{
return _clientManager;
}
}

View File

@ -27,7 +27,6 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
@ -109,19 +108,6 @@ public class Punish extends MiniPlugin
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void PunishChatEvent(PlayerCommandPreprocessEvent event)
{
PunishClient client = GetClient(event.getPlayer().getName());
if (client != null && client.IsMuted() && event.getMessage().startsWith("/msg"))
{
event.getPlayer().sendMessage(F.main(getName(), "Shh, you're muted because " + client.GetPunishment(PunishmentSentence.Mute).GetReason() + " by " + client.GetPunishment(PunishmentSentence.Mute).GetAdmin() + " for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + "."));
event.setMessage(" ");
event.setCancelled(true);
}
}
public void Help(Player caller)
{
UtilPlayer.message(caller, F.main(_moduleName, "Commands List:"));

View File

@ -17,6 +17,7 @@ import mineplex.core.elo.EloManager;
import mineplex.core.energy.Energy;
import mineplex.core.friend.FriendManager;
import mineplex.core.hologram.HologramManager;
import mineplex.core.ignore.IgnoreManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.memory.MemoryFix;
import mineplex.core.message.MessageManager;
@ -89,7 +90,6 @@ public class Hub extends JavaPlugin implements IRelation
DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler);
PreferencesManager preferenceManager = new PreferencesManager(this, clientManager, donationManager);
preferenceManager.GiveItem = true;
new MessageManager(this, clientManager, preferenceManager);
Creature creature = new Creature(this);
NpcManager npcManager = new NpcManager(this, creature);
PetManager petManager = new PetManager(this, clientManager, donationManager, disguiseManager, creature, blockRestore, webServerAddress);
@ -98,8 +98,13 @@ public class Hub extends JavaPlugin implements IRelation
//Main Modules
ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager));
PartyManager partyManager = new PartyManager(this, clientManager, preferenceManager);
Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName());
AntiHack.Initialize(this, punish, portal, preferenceManager, clientManager);
IgnoreManager ignoreManager = new IgnoreManager(this, clientManager, preferenceManager, portal);
new MessageManager(this, clientManager, preferenceManager, ignoreManager, punish);
StatsManager statsManager = new StatsManager(this, clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager);
HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, new ConditionManager(this), disguiseManager, new TaskManager(this, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this));

View File

@ -21,6 +21,7 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.friend.FriendManager;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.hologram.HologramManager;
import mineplex.core.ignore.IgnoreManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.memory.MemoryFix;
@ -86,7 +87,6 @@ public class Arcade extends JavaPlugin
_serverConfiguration = new ServerConfiguration(this);
PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager);
new MessageManager(this, _clientManager, preferenceManager);
Creature creature = new Creature(this);
ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager));
@ -104,6 +104,9 @@ public class Arcade extends JavaPlugin
AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager);
AntiHack.Instance.setKick(false);
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
new MessageManager(this, _clientManager, preferenceManager, ignoreManager, punish);
BlockRestore blockRestore = new BlockRestore(this);
ProjectileManager projectileManager = new ProjectileManager(this);