Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex

This commit is contained in:
Mini-Chiss 2015-02-10 12:23:28 +13:00
commit c1f9f94c2a
17 changed files with 754 additions and 205 deletions

Binary file not shown.

View File

@ -13,5 +13,6 @@
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-3.4.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/NoCheatPlus.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -4,6 +4,8 @@ import java.lang.reflect.Field;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.UUID;
import mineplex.core.common.DummyEntity;
import mineplex.core.common.util.NautHashMap;
@ -32,8 +34,13 @@ import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.plugin.java.JavaPlugin;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
public class CustomTagFix extends MiniPlugin implements IPacketHandler
{
private NautHashMap<String, NautHashMap<Integer, Integer>> _entityMap = new NautHashMap<String, NautHashMap<Integer, Integer>>();
@ -42,6 +49,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
private HashSet<String> _loggedIn = new HashSet<String>();
private HashSet<Integer> _ignoreSkulls = new HashSet<Integer>();
private NautHashMap<UUID, Long> _exemptTimeMap = new NautHashMap<UUID, Long>();
private Field _destroyId;
public CustomTagFix(JavaPlugin plugin, PacketHandler packetHandler)
@ -71,6 +80,75 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
_loggedIn.remove(event.getPlayer());
}
@EventHandler
public void ncpExempt(final PlayerToggleFlightEvent event)
{
if (_exemptTimeMap.containsKey(event.getPlayer().getUniqueId()))
{
_exemptTimeMap.put(event.getPlayer().getUniqueId(), System.currentTimeMillis() + 1500);
return;
}
try
{
NCPExemptionManager.exemptPermanently(event.getPlayer());
}
catch (Exception exception)
{
}
_exemptTimeMap.put(event.getPlayer().getUniqueId(), System.currentTimeMillis() + 1500);
}
@EventHandler
public void ncpExemptVelocity(final PlayerVelocityEvent event)
{
if (_exemptTimeMap.containsKey(event.getPlayer().getUniqueId()))
{
_exemptTimeMap.put(event.getPlayer().getUniqueId(), System.currentTimeMillis() + 1500);
return;
}
try
{
NCPExemptionManager.exemptPermanently(event.getPlayer());
}
catch (Exception exception)
{
}
_exemptTimeMap.put(event.getPlayer().getUniqueId(), System.currentTimeMillis() + 1500);
}
@EventHandler
public void unexempt(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Iterator<Entry<UUID, Long>> iterator = _exemptTimeMap.entrySet().iterator(); iterator.hasNext();)
{
Entry<UUID, Long> entry = iterator.next();
if (System.currentTimeMillis() > entry.getValue())
{
iterator.remove();
try
{
NCPExemptionManager.unexempt(entry.getKey());
}
catch (Exception exception)
{
}
}
}
}
@EventHandler
public void cleanMap(UpdateEvent event)
{

View File

@ -58,19 +58,20 @@ public class CommandCenter implements Listener
ICommand command = Commands.get(commandName.toLowerCase());
if (command != null && ClientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), command.GetRequiredRank(), command.GetSpecificRanks(), true))
if (command != null)
{
if (!Recharge.Instance.use(event.getPlayer(), "Command", 500, false, false))
{
event.getPlayer().sendMessage(F.main("Command Center", "You can't spam commands that fast."));
event.setCancelled(true);
return;
}
command.SetAliasUsed(commandName.toLowerCase());
command.Execute(event.getPlayer(), args);
event.setCancelled(true);
if (ClientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), command.GetRequiredRank(), command.GetSpecificRanks(), true))
{
if (!Recharge.Instance.use(event.getPlayer(), "Command", 500, false, false))
{
event.getPlayer().sendMessage(F.main("Command Center", "You can't spam commands that fast."));
return;
}
command.SetAliasUsed(commandName.toLowerCase());
command.Execute(event.getPlayer(), args);
}
event.setCancelled(true);
}
}

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 CoreClientManager _clientManager;
private PreferencesManager _preferences;
private LinkedList<String> _randomMessage;
public MessageManager(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences)
{
super("Message", plugin);
_clientManager = clientManager;
_preferences = preferences;
ServerCommandManager.getInstance().registerCommandType("AnnouncementCommand", AnnouncementCommand.class, new AnnouncementHandler());
}
private CoreClientManager _clientManager;
private PreferencesManager _preferences;
private IgnoreManager _ignoreManager;
private Punish _punish;
//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 MessageManager(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences,
IgnoreManager ignoreManager, Punish punish)
{
super("Message", plugin);
public void AddCommands()
{
addCommand(new MessageCommand(this));
addCommand(new ResendCommand(this));
addCommand(new MessageAdminCommand(this));
addCommand(new ResendAdminCommand(this));
addCommand(new AnnounceCommand(this));
addCommand(new GlobalCommand(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)
{
Help(caller, null);
}
_clientManager = clientManager;
_preferences = preferences;
_ignoreManager = ignoreManager;
_punish = punish;
ServerCommandManager.getInstance().registerCommandType("AnnouncementCommand", AnnouncementCommand.class,
new AnnouncementHandler());
}
/* XXX Incorporate this
PunishChatEvent event = new PunishChatEvent(caller);
GetPlugin().getServer().getPluginManager().callEvent(event);
if (event.isCancelled())
return;
*/
// 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 DoMessage(Player from, Player to, String message)
{
if (!_preferences.Get(to).PrivateMessaging)
{
UtilPlayer.message(from, C.cPurple + to.getName() + " has private messaging disabled.");
return;
}
//Inform
UtilPlayer.message(from, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message);
public void AddCommands()
{
addCommand(new MessageCommand(this));
addCommand(new ResendCommand(this));
//Save
Get(from).LastTo = to.getName();
addCommand(new MessageAdminCommand(this));
addCommand(new ResendAdminCommand(this));
//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.");
}
addCommand(new AnnounceCommand(this));
addCommand(new GlobalCommand(this));
//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.");
}
//Log
//Logger().logChat("Private Message", from, to.getName(), message);
addCommand(new AdminCommand(this));
}
//Ignored XXX
//if (Get(to).Ignore().IsIgnored(from.getName()))
// return;
//Sound
from.playSound(to.getLocation(), Sound.NOTE_PIANO, 1f, 1f);
to.playSound(to.getLocation(), Sound.NOTE_PIANO, 2f, 2f);
public void Help(Player caller, String message)
{
UtilPlayer.message(caller, F.main(_moduleName, ChatColor.RED + "Err...something went wrong?"));
}
//Send
UtilPlayer.message(to, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message);
}
public void Help(Player caller)
{
Help(caller, null);
}
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);
/* XXX Incorporate this
PunishChatEvent event = new PunishChatEvent(caller);
GetPlugin().getServer().getPluginManager().callEvent(event);
if (event.isCancelled())
return;
*/
//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);
public boolean canMessage(Player from, Player to)
{
PunishClient client = _punish.GetClient(from.getName());
//Save
Get(from).LastAdminTo = to.getName();
if (client != null && client.IsMuted())
{
Punishment punishment = client.GetPunishment(PunishmentSentence.Mute);
//Send
UtilPlayer.message(to, C.cPurple + "<- " + F.rank(_clientManager.Get(from).GetRank()) + " " + from.getName() + " " + C.cPurple + message);
from.sendMessage(F.main(_punish.getName(), "Shh, you're muted because "
//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);
}
+ punishment.GetReason()
@Override
protected ClientMessage AddPlayer(String player)
{
Set(player, new ClientMessage());
return Get(player);
}
+ " by "
public LinkedList<String> GetRandomMessages()
{
return _randomMessage;
}
+ punishment.GetAdmin()
public String GetRandomMessage()
{
if (_randomMessage.isEmpty())
return "meow";
return _randomMessage.get(UtilMath.r(_randomMessage.size()));
}
+ " for "
public CoreClientManager GetClientManager()
{
return _clientManager;
}
+ C.cGreen
+ UtilTime.convertString(punishment.GetRemaining(), 1, TimeUnit.FIT) + "."));
return false;
}
// 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;
}
if (_ignoreManager.isIgnoring(from, to))
{
from.sendMessage(F.main(_ignoreManager.getName(), ChatColor.GRAY + "You are ignoring that player"));
return false;
}
// 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"));
return false;
}
return true;
}
public void DoMessage(Player from, Player to, String message)
{
if (!canMessage(from, to))
{
return;
}
// Inform
UtilPlayer.message(from, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message);
// Save
Get(from).LastTo = to.getName();
// 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.");
}
// Log
// Logger().logChat("Private Message", from, to.getName(), message);
// Ignored XXX
// if (Get(to).Ignore().IsIgnored(from.getName()))
// return;
// 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

@ -122,22 +122,41 @@ public class PersonalServerManager extends MiniPlugin
createGroup(player, serverName, 12, 24, "Smash");
}
private void createGroup(final Player host, final String serverName, int minPlayers, int maxPlayers, String games)
private void createGroup(final Player host, final String serverName, final int minPlayers, final int maxPlayers, final String games)
{
final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), 1024, 1, 1, 0, UtilMath.random.nextInt(250) + 19999, true, "arcade.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers,
true, false, false, games, "Player", false, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU);
GetPlugin().getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
{
public void run()
{
_repository.updateServerGroup(serverGroup);
Bukkit.getScheduler().runTask(GetPlugin(), new Runnable()
for (ServerGroup existingServerGroup : _repository.getServerGroups(null))
{
if (existingServerGroup.getPrefix().equalsIgnoreCase(serverName) || existingServerGroup.getName().equalsIgnoreCase(serverName))
{
if (host.getName().equalsIgnoreCase(existingServerGroup.getHost()))
host.sendMessage(F.main(getName(), "Your server is still being created. If you haven't been connected in 20 seconds, type /server " + serverName + "-1."));
else
host.sendMessage(C.cRed + "Sorry, but you're not allowed to create a MPS server because you have chosen a name to glitch the system :)");
return;
}
}
final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), 1024, 1, 1, 0, UtilMath.random.nextInt(250) + 19999, true, "arcade.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers,
true, false, false, games, "Player", false, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU);
GetPlugin().getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
{
public void run()
{
host.sendMessage(F.main(getName(), serverName + "-1 successfully created. You will be sent to it shortly."));
host.sendMessage(F.main(getName(), "If you haven't been connected in 20 seconds, type /server " + serverName + "-1."));
_repository.updateServerGroup(serverGroup);
Bukkit.getScheduler().runTask(GetPlugin(), new Runnable()
{
public void run()
{
host.sendMessage(F.main(getName(), serverName + "-1 successfully created. You will be sent to it shortly."));
host.sendMessage(F.main(getName(), "If you haven't been connected in 20 seconds, type /server " + serverName + "-1."));
}
});
}
});
}

View File

@ -17,7 +17,7 @@ public class TransferHandler implements CommandCallback
TransferCommand transferCommand = (TransferCommand) command;
ServerTransfer transfer = transferCommand.getTransfer();
Player player = Bukkit.getPlayer(transfer.getPlayerName());
Player player = Bukkit.getPlayerExact(transfer.getPlayerName());
if (player != null && player.isOnline())
{

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;
@ -108,19 +107,6 @@ public class Punish extends MiniPlugin
event.setCancelled(true);
}
}
@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)
{

View File

@ -18,6 +18,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;
@ -90,7 +91,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);
@ -99,8 +99,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

@ -258,7 +258,15 @@ public class ServerMonitor
if (serverGroup.getName().equals("Testing"))
continue;
handleGroupChanges(serverTracker, serverGroup, false);
try
{
handleGroupChanges(serverTracker, serverGroup, false);
}
catch (Exception exception)
{
log(exception.getMessage());
log("Can't handle group changes for " + serverGroup.getName());
}
}
int processWaits = 0;

View File

@ -72,8 +72,8 @@ public class StaffServer extends JavaPlugin
Bukkit.getWorlds().get(0).setSpawnLocation(0, 102, 0);
((CraftServer)getServer()).setWhitelist(true);
((CraftServer)getServer()).getHandle().addWhitelist(new ProfileLoader(UUIDFetcher.getUUIDOf("dooskee").toString(), "dooskee").loadProfile());
((CraftServer)getServer()).getHandle().addWhitelist(new ProfileLoader(UUIDFetcher.getUUIDOf("Morenaa").toString(), "Morenaa").loadProfile());
((CraftServer)getServer()).getHandle().addWhitelist(new ProfileLoader(UUIDFetcher.getUUIDOf("NDrew").toString(), "NDrew").loadProfile());
((CraftServer)getServer()).getHandle().addWhitelist(new ProfileLoader(UUIDFetcher.getUUIDOf("Morena").toString(), "Morena").loadProfile());
((CraftServer)getServer()).getHandle().addWhitelist(new ProfileLoader(UUIDFetcher.getUUIDOf("Revolark").toString(), "Revolark").loadProfile());
((CraftServer)getServer()).getHandle().addWhitelist(new ProfileLoader(UUIDFetcher.getUUIDOf("EvilEsther").toString(), "EvilEsther").loadProfile());
}

View File

@ -22,6 +22,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;
@ -87,7 +88,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));
@ -105,6 +105,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);