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

This commit is contained in:
Jonathan Williams 2015-02-10 02:12:23 -08:00
commit 4c0e6642f4
22 changed files with 808 additions and 248 deletions

View File

@ -61,11 +61,16 @@ public class PacketPlayOutPlayerInfo extends Packet {
} }
public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer player) { public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer player) {
return updateDisplayName(player, getFormattedName(player));
}
public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer player, String displayName)
{
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(); PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
packet.action = 3; packet.action = 3;
packet.username = player.listName; packet.username = player.listName;
packet.player = player.getProfile(); packet.player = player.getProfile();
packet._tabName = getFormattedName(player); packet._tabName = displayName;
return packet; return packet;
} }

View File

@ -58,19 +58,20 @@ public class CommandCenter implements Listener
ICommand command = Commands.get(commandName.toLowerCase()); 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)) if (ClientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), command.GetRequiredRank(), command.GetSpecificRanks(), true))
{ {
event.getPlayer().sendMessage(F.main("Command Center", "You can't spam commands that fast.")); if (!Recharge.Instance.use(event.getPlayer(), "Command", 500, false, false))
event.setCancelled(true); {
return; event.getPlayer().sendMessage(F.main("Command Center", "You can't spam commands that fast."));
} return;
}
command.SetAliasUsed(commandName.toLowerCase()); command.SetAliasUsed(commandName.toLowerCase());
command.Execute(event.getPlayer(), args); command.Execute(event.getPlayer(), args);
}
event.setCancelled(true); 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.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; 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.message.Commands.*;
import mineplex.core.preferences.PreferencesManager; 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.ServerCommandManager;
import mineplex.serverdata.transfers.AnnouncementCommand; import mineplex.serverdata.transfers.AnnouncementCommand;
public class MessageManager extends MiniClientPlugin<ClientMessage> public class MessageManager extends MiniClientPlugin<ClientMessage>
{ {
private LinkedList<String> _randomMessage; private LinkedList<String> _randomMessage;
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private PreferencesManager _preferences; private PreferencesManager _preferences;
private IgnoreManager _ignoreManager;
private Punish _punish;
public MessageManager(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences) public MessageManager(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences,
{ IgnoreManager ignoreManager, Punish punish)
super("Message", plugin); {
super("Message", plugin);
_clientManager = clientManager; _clientManager = clientManager;
_preferences = preferences; _preferences = preferences;
_ignoreManager = ignoreManager;
_punish = punish;
ServerCommandManager.getInstance().registerCommandType("AnnouncementCommand", AnnouncementCommand.class, new AnnouncementHandler()); ServerCommandManager.getInstance().registerCommandType("AnnouncementCommand", AnnouncementCommand.class,
} new AnnouncementHandler());
}
//Module Functions // Module Functions
@Override @Override
public void Enable() public void Enable()
{ {
_randomMessage = new LinkedList<String>(); _randomMessage = new LinkedList<String>();
_randomMessage.clear(); _randomMessage.clear();
_randomMessage.add("Hello, do you have any wild boars for purchase?"); _randomMessage.add("Hello, do you have any wild boars for purchase?");
_randomMessage.add("There's a snake in my boot!"); _randomMessage.add("There's a snake in my boot!");
_randomMessage.add("Monk, I need a Monk!"); _randomMessage.add("Monk, I need a Monk!");
_randomMessage.add("Hi, I'm from planet minecraft, op me plz dooooood!"); _randomMessage.add("Hi, I'm from planet minecraft, op me plz dooooood!");
_randomMessage.add("Somebody's poisoned the waterhole!"); _randomMessage.add("Somebody's poisoned the waterhole!");
_randomMessage.add("MORE ORBZ MORE ORBZ MORE ORBZ MORE ORBZ!"); _randomMessage.add("MORE ORBZ MORE ORBZ MORE ORBZ MORE ORBZ!");
_randomMessage.add("Chiss is a chiss and chiss chiss."); _randomMessage.add("Chiss is a chiss and chiss chiss.");
_randomMessage.add("*_*"); _randomMessage.add("*_*");
_randomMessage.add("#swag"); _randomMessage.add("#swag");
_randomMessage.add("Everything went better then I thought."); _randomMessage.add("Everything went better then I thought.");
_randomMessage.add("HAVE A CHICKEN!"); _randomMessage.add("HAVE A CHICKEN!");
_randomMessage.add("follow me, i have xrays"); _randomMessage.add("follow me, i have xrays");
_randomMessage.add("I'm making a java"); _randomMessage.add("I'm making a java");
_randomMessage.add("Do you talk to strangers? I have candy if it helps."); _randomMessage.add("Do you talk to strangers? I have candy if it helps.");
_randomMessage.add("Solid 2.9/10"); _randomMessage.add("Solid 2.9/10");
_randomMessage.add("close your eyes to sleep"); _randomMessage.add("close your eyes to sleep");
_randomMessage.add("I crashed because my internet ran out."); _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("I saw morgan freeman on a breaking bad ad on a bus.");
_randomMessage.add("Where is the volume control?"); _randomMessage.add("Where is the volume control?");
_randomMessage.add("I saw you playing on youtube with that guy and stuff."); _randomMessage.add("I saw you playing on youtube with that guy and stuff.");
_randomMessage.add("Your worms must be worse than useless."); _randomMessage.add("Your worms must be worse than useless.");
_randomMessage.add("meow"); _randomMessage.add("meow");
_randomMessage.add("7"); _randomMessage.add("7");
_randomMessage.add("Don't you wish your girlfriend was hot like me?"); _randomMessage.add("Don't you wish your girlfriend was hot like me?");
_randomMessage.add("how do you play mindcrafts?"); _randomMessage.add("how do you play mindcrafts?");
_randomMessage.add("7 cats meow meow meow meow meow meow meow"); _randomMessage.add("7 cats meow meow meow meow meow meow meow");
_randomMessage.add("For King Jonalon!!!!!"); _randomMessage.add("For King Jonalon!!!!!");
_randomMessage.add("Do you like apples?"); _randomMessage.add("Do you like apples?");
_randomMessage.add("I'm Happy Happy Happy."); _randomMessage.add("I'm Happy Happy Happy.");
_randomMessage.add("kthxbye"); _randomMessage.add("kthxbye");
_randomMessage.add("i like pie."); _randomMessage.add("i like pie.");
_randomMessage.add("Do you play Clash of Clans?"); _randomMessage.add("Do you play Clash of Clans?");
_randomMessage.add("Mmm...Steak!"); _randomMessage.add("Mmm...Steak!");
} }
public void AddCommands()
{
addCommand(new MessageCommand(this));
addCommand(new ResendCommand(this));
public void AddCommands() addCommand(new MessageAdminCommand(this));
{ addCommand(new ResendAdminCommand(this));
addCommand(new MessageCommand(this));
addCommand(new ResendCommand(this));
addCommand(new MessageAdminCommand(this)); addCommand(new AnnounceCommand(this));
addCommand(new ResendAdminCommand(this)); addCommand(new GlobalCommand(this));
addCommand(new AnnounceCommand(this)); addCommand(new AdminCommand(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, String message) public void Help(Player caller)
{ {
UtilPlayer.message(caller, F.main(_moduleName, ChatColor.RED + "Err...something went wrong?")); Help(caller, null);
} }
public void Help(Player caller) /* XXX Incorporate this
{ PunishChatEvent event = new PunishChatEvent(caller);
Help(caller, null);
}
GetPlugin().getServer().getPluginManager().callEvent(event);
/* XXX Incorporate this if (event.isCancelled())
PunishChatEvent event = new PunishChatEvent(caller); return;
*/
GetPlugin().getServer().getPluginManager().callEvent(event); public boolean canMessage(Player from, Player to)
{
PunishClient client = _punish.GetClient(from.getName());
if (event.isCancelled()) if (client != null && client.IsMuted())
return; {
*/ Punishment punishment = client.GetPunishment(PunishmentSentence.Mute);
public void DoMessage(Player from, Player to, String message) from.sendMessage(F.main(_punish.getName(), "Shh, you're muted because "
{
if (!_preferences.Get(to).PrivateMessaging)
{
UtilPlayer.message(from, C.cPurple + to.getName() + " has private messaging disabled.");
return;
}
//Inform + punishment.GetReason()
UtilPlayer.message(from, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message);
//Save + " by "
Get(from).LastTo = to.getName();
//Chiss + punishment.GetAdmin()
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.");
}
//Defek + " for "
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 + C.cGreen
//Logger().logChat("Private Message", from, to.getName(), message);
//Ignored XXX + UtilTime.convertString(punishment.GetRemaining(), 1, TimeUnit.FIT) + "."));
//if (Get(to).Ignore().IsIgnored(from.getName())) return false;
// return; }
//Sound // If the receiver has turned off private messaging and the sender isn't a mod
from.playSound(to.getLocation(), Sound.NOTE_PIANO, 1f, 1f); if (!_preferences.Get(to).PrivateMessaging && !_clientManager.Get(from).GetRank().Has(Rank.HELPER))
to.playSound(to.getLocation(), Sound.NOTE_PIANO, 2f, 2f); {
UtilPlayer.message(from, C.cPurple + to.getName() + " has private messaging disabled.");
return false;
}
//Send if (_ignoreManager.isIgnoring(from, to))
UtilPlayer.message(to, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message); {
} from.sendMessage(F.main(_ignoreManager.getName(), ChatColor.GRAY + "You are ignoring that player"));
public void DoMessageAdmin(Player from, Player to, String message) return false;
{ }
//Inform
UtilPlayer.message(from, C.cPurple + "-> " + F.rank(_clientManager.Get(to).GetRank()) + " " + to.getName() + " " + C.cPurple + message);
//Inform Admins // If the receiver is ignoring the sender, and the sender isn't a mod
for (Player staff : UtilServer.getPlayers()) if (_ignoreManager.isIgnoring(to, from) && !_clientManager.Get(from).GetRank().Has(Rank.HELPER))
if (!to.equals(staff)) {
if (!from.equals(staff)) from.sendMessage(F.main(_ignoreManager.getName(), ChatColor.GRAY + "That player is ignoring you"));
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 return false;
Get(from).LastAdminTo = to.getName(); }
//Send return true;
UtilPlayer.message(to, C.cPurple + "<- " + F.rank(_clientManager.Get(from).GetRank()) + " " + from.getName() + " " + C.cPurple + message); }
//Sound public void DoMessage(Player from, Player to, String message)
from.playSound(to.getLocation(), Sound.NOTE_PIANO, 1f, 1f); {
to.playSound(to.getLocation(), Sound.NOTE_PIANO, 2f, 2f); if (!canMessage(from, to))
{
return;
}
//Log XXX // Inform
//Logger().logChat("Staff Message", from, to.getName(), message); UtilPlayer.message(from, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message);
}
@Override // Save
protected ClientMessage AddPlayer(String player) Get(from).LastTo = to.getName();
{
Set(player, new ClientMessage());
return Get(player);
}
public LinkedList<String> GetRandomMessages() // Chiss or defek7
{ if (to.getName().equals("Chiss") || to.getName().equals("defek7"))
return _randomMessage; {
} 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() // Log
{ // Logger().logChat("Private Message", from, to.getName(), message);
if (_randomMessage.isEmpty())
return "meow";
return _randomMessage.get(UtilMath.r(_randomMessage.size())); // Ignored XXX
} // if (Get(to).Ignore().IsIgnored(from.getName()))
// return;
public CoreClientManager GetClientManager() // Sound
{ from.playSound(to.getLocation(), Sound.NOTE_PIANO, 1f, 1f);
return _clientManager; 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.AsyncPlayerChatEvent;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result; import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin; 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) public void Help(Player caller)
{ {
UtilPlayer.message(caller, F.main(_moduleName, "Commands List:")); UtilPlayer.message(caller, F.main(_moduleName, "Commands List:"));

View File

@ -74,7 +74,7 @@ public class RewardManager
} }
// Gadgets // Gadgets
addReward(new InventoryReward(inventoryManager, "Paintball Gun Ammo", "Paintball Gun", addReward(new InventoryReward(inventoryManager, "Paintballs", "Paintball Gun",
(int)(100*(minValue/500)), (int)(100*(maxValue/500)), (int)(100*(minValue/500)), (int)(100*(maxValue/500)),
new ItemStack(Material.GOLD_BARDING), rarity, 1)); new ItemStack(Material.GOLD_BARDING), rarity, 1));
@ -82,7 +82,7 @@ public class RewardManager
(int)(50*(minValue/500)), (int)(50*(maxValue/500)), (int)(50*(minValue/500)), (int)(50*(maxValue/500)),
new ItemStack(Material.FIREWORK), rarity, 1)); new ItemStack(Material.FIREWORK), rarity, 1));
addReward(new InventoryReward(inventoryManager, "Melon Launcher Ammo", "Melon Launcher", addReward(new InventoryReward(inventoryManager, "Melons", "Melon Launcher",
(int)(50*(minValue/500)), (int)(50*(maxValue/500)), (int)(50*(minValue/500)), (int)(50*(maxValue/500)),
new ItemStack(Material.MELON_BLOCK), rarity, 1)); new ItemStack(Material.MELON_BLOCK), rarity, 1));
@ -90,11 +90,11 @@ public class RewardManager
(int)(40*(minValue/500)), (int)(40*(maxValue/500)), (int)(40*(minValue/500)), (int)(40*(maxValue/500)),
new ItemStack(Material.getMaterial(131)), rarity, 1)); new ItemStack(Material.getMaterial(131)), rarity, 1));
addReward(new InventoryReward(inventoryManager, "Ethereal Pearls", "Ethereal Pearl", addReward(new InventoryReward(inventoryManager, "Pearls", "Ethereal Pearl",
(int)(30*(minValue/500)), (int)(30*(maxValue/500)), (int)(30*(minValue/500)), (int)(30*(maxValue/500)),
new ItemStack(Material.ENDER_PEARL), rarity, 1)); new ItemStack(Material.ENDER_PEARL), rarity, 1));
addReward(new InventoryReward(inventoryManager, "Bat Blaster Ammo", "Bat Blaster", addReward(new InventoryReward(inventoryManager, "Bat Swarms", "Bat Blaster",
(int)(20*(minValue/500)), (int)(20*(maxValue/500)), (int)(20*(minValue/500)), (int)(20*(maxValue/500)),
new ItemStack(Material.IRON_BARDING), rarity, 1)); new ItemStack(Material.IRON_BARDING), rarity, 1));
@ -118,7 +118,7 @@ public class RewardManager
} }
// Gadgets // Gadgets
addReward(new InventoryReward(inventoryManager, "Paintball Gun Ammo", "Paintball Gun", addReward(new InventoryReward(inventoryManager, "Paintballs", "Paintball Gun",
(int)(100*(minValue/500)), (int)(100*(maxValue/500)), (int)(100*(minValue/500)), (int)(100*(maxValue/500)),
new ItemStack(Material.GOLD_BARDING), rarity, 250)); new ItemStack(Material.GOLD_BARDING), rarity, 250));
@ -126,19 +126,19 @@ public class RewardManager
(int)(50*(minValue/500)), (int)(50*(maxValue/500)), (int)(50*(minValue/500)), (int)(50*(maxValue/500)),
new ItemStack(Material.FIREWORK), rarity, 250)); new ItemStack(Material.FIREWORK), rarity, 250));
addReward(new InventoryReward(inventoryManager, "Melon Launcher Ammo", "Melon Launcher", addReward(new InventoryReward(inventoryManager, "Melons", "Melon Launcher",
(int)(50*(minValue/500)), (int)(50*(maxValue/500)), (int)(50*(minValue/500)), (int)(50*(maxValue/500)),
new ItemStack(Material.MELON_BLOCK), rarity, 250)); new ItemStack(Material.MELON_BLOCK), rarity, 250));
addReward(new InventoryReward(inventoryManager, "Flesh Hook Ammo", "Flesh Hook", addReward(new InventoryReward(inventoryManager, "Flesh Hooks", "Flesh Hook",
(int)(40*(minValue/500)), (int)(40*(maxValue/500)), (int)(40*(minValue/500)), (int)(40*(maxValue/500)),
new ItemStack(Material.getMaterial(131)), rarity, 250)); new ItemStack(Material.getMaterial(131)), rarity, 250));
addReward(new InventoryReward(inventoryManager, "Ethereal Pearls", "Ethereal Pearl", addReward(new InventoryReward(inventoryManager, "Pearls", "Ethereal Pearl",
(int)(30*(minValue/500)), (int)(30*(maxValue/500)), (int)(30*(minValue/500)), (int)(30*(maxValue/500)),
new ItemStack(Material.ENDER_PEARL), rarity, 250)); new ItemStack(Material.ENDER_PEARL), rarity, 250));
addReward(new InventoryReward(inventoryManager, "Bat Blaster Ammo", "Bat Blaster", addReward(new InventoryReward(inventoryManager, "Bat Swarms", "Bat Blaster",
(int)(20*(minValue/500)), (int)(20*(maxValue/500)), (int)(20*(minValue/500)), (int)(20*(maxValue/500)),
new ItemStack(Material.IRON_BARDING), rarity, 250)); new ItemStack(Material.IRON_BARDING), rarity, 250));
@ -291,10 +291,11 @@ public class RewardManager
int currentReward = 0; int currentReward = 0;
Reward[] rewards = new Reward[4]; Reward[] rewards = new Reward[4];
boolean hasUncommon = false; boolean hasUncommon = false;
boolean canGiveMythical = true;
while (currentReward < 4) while (currentReward < 4)
{ {
Reward reward = nextReward(player, rewards, currentReward == 3 && !hasUncommon, type); Reward reward = nextReward(player, rewards, currentReward == 3 && !hasUncommon, type, canGiveMythical);
if (reward == null) if (reward == null)
{ {
@ -305,6 +306,13 @@ public class RewardManager
{ {
hasUncommon = true; hasUncommon = true;
} }
//Only allow 1 Mythical
if (reward.getRarity().ordinal() >= RewardRarity.MYTHICAL.ordinal())
{
canGiveMythical = false;
}
rewards[currentReward] = reward; rewards[currentReward] = reward;
currentReward++; currentReward++;
} }
@ -328,14 +336,14 @@ public class RewardManager
// return nextReward(player, excludedRewards, false, isChestOpening); // return nextReward(player, excludedRewards, false, isChestOpening);
// } // }
public Reward nextReward(Player player, Reward[] excludedRewards, boolean requiresUncommon, RewardType type) public Reward nextReward(Player player, Reward[] excludedRewards, boolean requiresUncommon, RewardType type, boolean canGiveMythical)
{ {
RewardRarity rarity = type.generateRarity(requiresUncommon); RewardRarity rarity = type.generateRarity(requiresUncommon);
//Dont give Rank Upgrade if already has Legend //Dont give Rank Upgrade if already has Legend
if (rarity == RewardRarity.MYTHICAL) if (rarity == RewardRarity.MYTHICAL)
{ {
if (_clientManager.Get(player).GetRank().Has(Rank.LEGEND)) if (!canGiveMythical || _clientManager.Get(player).GetRank().Has(Rank.LEGEND))
{ {
rarity = RewardRarity.LEGENDARY; rarity = RewardRarity.LEGENDARY;
} }

View File

@ -4,9 +4,9 @@ public enum RewardType
{ {
//% Chances Mythic Legend Rare Uncommon //% Chances Mythic Legend Rare Uncommon
GameLoot( 0.000001, 0.001, 0.004, 3), GameLoot( 0.000001, 0.001, 0.004, 3),
BasicChest( 0, 0.01, 0.04, 5), OldChest( 0, 0.01, 0.04, 5),
HeroicChest( 0, 1, 4, 25), AncientChest( 0, 1, 4, 25),
LegendaryChest( 0.5, 2.5, 10, 40); MythicalChest( 0.5, 2.5, 10, 40);
private double _mythicalChance; private double _mythicalChance;
private double _legendaryChance; private double _legendaryChance;

View File

@ -0,0 +1,25 @@
package mineplex.core.treasure;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType;
import mineplex.core.shop.item.SalesPackageBase;
public class OldChest extends SalesPackageBase
{
public OldChest()
{
super("Old Chest", Material.CHEST, (byte) 0, new String[] {}, 1000);
KnownPackage = false;
OneTimePurchaseOnly = false;
}
@Override
public void Sold(Player player, CurrencyType currencyType)
{
}
}

View File

@ -91,8 +91,7 @@ public class Treasure
_chestData[i] = new ChestData(chestBlocks[i]); _chestData[i] = new ChestData(chestBlocks[i]);
} }
if (_treasureType == TreasureType.HEROIC || _treasureType == TreasureType.LEGENDARY) _animations.add(new BlockChangeAnimation(this, _otherBlockInfo));
_animations.add(new BlockChangeAnimation(this, _otherBlockInfo));
} }
public int getFinishedTickCount() public int getFinishedTickCount()

View File

@ -99,7 +99,7 @@ public class TreasureLocation implements Listener
setHoloChestVisible(false); setHoloChestVisible(false);
if (treasureType == TreasureType.HEROIC || treasureType == TreasureType.LEGENDARY) if (treasureType == TreasureType.ANCIENT || treasureType == TreasureType.MYTHICAL)
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName())); Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName()));
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType()); Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType());

View File

@ -1,33 +1,24 @@
package mineplex.core.treasure; package mineplex.core.treasure;
import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
/**
* Created by Shaun on 8/28/2014.
*/
public enum TreasureStyle public enum TreasureStyle
{ {
/** OLD(
* These are examples, not final!
*/
BASIC(
ParticleType.EXPLODE, ParticleType.EXPLODE,
ParticleType.EXPLODE, ParticleType.EXPLODE,
Sound.FIZZ, Sound.FIZZ,
Sound.HORSE_ARMOR), Sound.HORSE_ARMOR),
HEROIC( ANCIENT(
ParticleType.FLAME, ParticleType.FLAME,
ParticleType.LAVA, ParticleType.LAVA,
Sound.LAVA_POP, Sound.LAVA_POP,
Sound.EXPLODE), Sound.EXPLODE),
LEGENDARY( MYTHICAL(
ParticleType.HAPPY_VILLAGER, ParticleType.HAPPY_VILLAGER,
ParticleType.LARGE_EXPLODE, ParticleType.LARGE_EXPLODE,
Sound.PORTAL_TRAVEL, Sound.PORTAL_TRAVEL,

View File

@ -7,11 +7,11 @@ import mineplex.core.reward.RewardType;
public enum TreasureType public enum TreasureType
{ {
BASIC(C.cYellow + "Basic Chest", "Basic Chest", RewardType.BasicChest, Material.CHEST, TreasureStyle.BASIC), OLD(C.cYellow + "Old Chest", "Old Chest", RewardType.OldChest, Material.CHEST, TreasureStyle.OLD),
HEROIC(C.cGold + "Heroic Chest", "Heroic Chest", RewardType.HeroicChest, Material.TRAPPED_CHEST, TreasureStyle.HEROIC), ANCIENT(C.cGold + "Ancient Chest", "Ancient Chest", RewardType.AncientChest, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT),
LEGENDARY(C.cRed + "Legendary Chest", "Legendary Chest", RewardType.LegendaryChest, Material.ENDER_CHEST, TreasureStyle.LEGENDARY); MYTHICAL(C.cRed + "Mythical Chest", "Mythical Chest", RewardType.MythicalChest, Material.ENDER_CHEST, TreasureStyle.MYTHICAL);
private final String _name; private final String _name;
private final RewardType _rewardType; private final RewardType _rewardType;

View File

@ -51,13 +51,19 @@ public class BlockChangeAnimation extends Animation
} }
else if (b.getType() == Material.SMOOTH_BRICK) else if (b.getType() == Material.SMOOTH_BRICK)
{ {
Material newMaterial = getTreasure().getTreasureType() == TreasureType.HEROIC ? Material.NETHER_BRICK : Material.QUARTZ_BLOCK; if (getTreasure().getTreasureType() == TreasureType.OLD)
continue;
Material newMaterial = getTreasure().getTreasureType() == TreasureType.ANCIENT ? Material.NETHER_BRICK : Material.QUARTZ_BLOCK;
_blockInfoList.add(new BlockInfo(b)); _blockInfoList.add(new BlockInfo(b));
b.setType(newMaterial); b.setType(newMaterial);
} }
else if (b.getType() == Material.SMOOTH_STAIRS || b.getType() == Material.COBBLESTONE_STAIRS) else if (b.getType() == Material.SMOOTH_STAIRS || b.getType() == Material.COBBLESTONE_STAIRS)
{ {
Material newMaterial = getTreasure().getTreasureType() == TreasureType.HEROIC ? Material.NETHER_BRICK_STAIRS : Material.QUARTZ_STAIRS; if (getTreasure().getTreasureType() == TreasureType.OLD)
continue;
Material newMaterial = getTreasure().getTreasureType() == TreasureType.ANCIENT ? Material.NETHER_BRICK_STAIRS : Material.QUARTZ_STAIRS;
_blockInfoList.add(new BlockInfo(b)); _blockInfoList.add(new BlockInfo(b));
b.setType(newMaterial); b.setType(newMaterial);
} }

View File

@ -80,11 +80,11 @@ public class ChestSpawnAnimation extends Animation
_particleLocation.add(_particleDirection); _particleLocation.add(_particleDirection);
//Play Particels //Play Particels
if (getTreasure().getTreasureType() == TreasureType.BASIC) if (getTreasure().getTreasureType() == TreasureType.OLD)
{ {
UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), _centerLocation, 0.1f, 0.1f, 0.1f, 0, 1); UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), _centerLocation, 0.1f, 0.1f, 0.1f, 0, 1);
} }
else if (getTreasure().getTreasureType() == TreasureType.HEROIC) else if (getTreasure().getTreasureType() == TreasureType.ANCIENT)
{ {
float x = (float) (Math.sin(getTicks()/4D)); float x = (float) (Math.sin(getTicks()/4D));
float z = (float) (Math.cos(getTicks()/4D)); float z = (float) (Math.cos(getTicks()/4D));
@ -95,7 +95,7 @@ public class ChestSpawnAnimation extends Animation
UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), newLoc, 0f, 0f, 0f, 0, 1); UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), newLoc, 0f, 0f, 0f, 0, 1);
} }
else if (getTreasure().getTreasureType() == TreasureType.LEGENDARY) else if (getTreasure().getTreasureType() == TreasureType.MYTHICAL)
{ {
float y = 5 * scale; float y = 5 * scale;
double width = 0.7 * ((double) getTicks() / (double) ANIMATION_DURATION); double width = 0.7 * ((double) getTicks() / (double) ANIMATION_DURATION);

View File

@ -0,0 +1,45 @@
package mineplex.core.treasure.gui;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.treasure.OldChest;
import mineplex.core.treasure.TreasureManager;
public class BuyBasicChestButton implements IButton
{
private Player _player;
private InventoryManager _inventoryManager;
private TreasurePage _page;
public BuyBasicChestButton(Player player, InventoryManager inventoryManager, TreasurePage page)
{
_player = player;
_inventoryManager = inventoryManager;
_page = page;
}
@Override
public void onClick(final Player player, ClickType clickType)
{
_page.getShop().OpenPageForPlayer(player, new ConfirmationPage<TreasureManager, TreasureShop>(
_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), new Runnable()
{
public void run()
{
_inventoryManager.addItemToInventory(player, "Item", "Old Chest", 1);
_page.Refresh();
}
}, _page, new OldChest(), CurrencyType.Coins, player));
}
}

View File

@ -8,12 +8,17 @@ import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.treasure.TreasureKey;
import mineplex.core.treasure.TreasureLocation; import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.TreasureManager; import mineplex.core.treasure.TreasureManager;
import mineplex.core.treasure.TreasureType; import mineplex.core.treasure.TreasureType;
@ -36,38 +41,71 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
@Override @Override
protected void BuildPage() protected void BuildPage()
{ {
int basicCount = _inventoryManager.Get(Player).getItemCount(TreasureType.BASIC.getItemName()); int basicCount = _inventoryManager.Get(Player).getItemCount(TreasureType.OLD.getItemName());
int heroicCount = _inventoryManager.Get(Player).getItemCount(TreasureType.HEROIC.getItemName()); int heroicCount = _inventoryManager.Get(Player).getItemCount(TreasureType.ANCIENT.getItemName());
int legendaryCount = _inventoryManager.Get(Player).getItemCount(TreasureType.LEGENDARY.getItemName()); int legendaryCount = _inventoryManager.Get(Player).getItemCount(TreasureType.MYTHICAL.getItemName());
List<String> basicLore = new ArrayList<String>(); List<String> basicLore = new ArrayList<String>();
basicLore.add(" "); basicLore.add(" ");
basicLore.add(F.value("Basic Chests Owned", "" + basicCount)); basicLore.add(F.value("Old Chests Owned", "" + basicCount));
basicLore.add(" ");
basicLore.add(C.cGray + "We've scoured the lands of Minecraft");
basicLore.add(C.cGray + "and found these abandoned chests.");
basicLore.add(C.cGray + "The contents are unknown, but");
basicLore.add(C.cGray + "according to the inscriptions on the");
basicLore.add(C.cGray + "the straps they appear to contain");
basicLore.add(C.cGray + "many kinds of loot.");
basicLore.add(" "); basicLore.add(" ");
if (basicCount > 0) if (basicCount > 0)
basicLore.add(ChatColor.RESET + "Click to open!"); basicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
else
{
basicLore.add(ChatColor.RESET + "Cost: " + C.cYellow + "1000 Coins");
basicLore.add(ChatColor.RESET + "Click to Purchase!");
}
List<String> heroicLore = new ArrayList<String>(); List<String> heroicLore = new ArrayList<String>();
heroicLore.add(" "); heroicLore.add(" ");
heroicLore.add(F.value("Heroic Chests Owned", "" + heroicCount)); heroicLore.add(F.value("Ancient Chests Owned", "" + heroicCount));
heroicLore.add(" ");
heroicLore.add(C.cGray + "Some of our bravest adventurers");
heroicLore.add(C.cGray + "have discovered these chests within ");
heroicLore.add(C.cGray + "temples hidden in Minecrafts worlds.");
heroicLore.add(" "); heroicLore.add(" ");
if (heroicCount > 0) if (heroicCount > 0)
heroicLore.add(ChatColor.RESET + "Click to open!"); heroicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
else
{
heroicLore.add(ChatColor.RESET + "Purchase at: " + C.cYellow + "www.mineplex.com/shop");
}
List<String> legendaryLore = new ArrayList<String>(); List<String> legendaryLore = new ArrayList<String>();
legendaryLore.add(" "); legendaryLore.add(" ");
legendaryLore.add(F.value("Legendary Chests Owned", "" + legendaryCount)); legendaryLore.add(F.value("Mythical Chests Owned", "" + legendaryCount));
legendaryLore.add(" ");
legendaryLore.add(C.cGray + "All our previous adventurers have");
legendaryLore.add(C.cGray + "perished in search of these chests.");
legendaryLore.add(C.cGray + "However, legends of their existence");
legendaryLore.add(C.cGray + "convinced Sterling, Chiss and Defek7");
legendaryLore.add(C.cGray + "to venture out and discover the");
legendaryLore.add(C.cGray + "location of these chests on their own.");
legendaryLore.add(" "); legendaryLore.add(" ");
if (legendaryCount > 0) if (legendaryCount > 0)
legendaryLore.add(ChatColor.RESET + "Click to open!"); legendaryLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
else
{
legendaryLore.add(ChatColor.RESET + "Purchase at: " + C.cYellow + "www.mineplex.com/shop");
}
ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Chest", basicLore.toArray(new String[0]), 0, false, false);
ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Ancient Chest", heroicLore.toArray(new String[0]), 0, false, false);
ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Mythical Chest", legendaryLore.toArray(new String[0]), 0, false, false);
ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Basic Chest", basicLore.toArray(new String[0]), 0, false, false); if (basicCount > 0)
ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Heroic Chest", heroicLore.toArray(new String[0]), 0, false, false); AddButton(2, basic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.OLD));
ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Legendary Chest", legendaryLore.toArray(new String[0]), 0, false, false); else
AddButton(2, basic, new BuyBasicChestButton(Player, _inventoryManager, this));
AddButton(2, basic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.BASIC)); AddButton(4, heroic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.ANCIENT));
AddButton(4, heroic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.HEROIC)); AddButton(6, legendary, new OpenTreasureButton(Player, _treasureLocation, TreasureType.MYTHICAL));
AddButton(6, legendary, new OpenTreasureButton(Player, _treasureLocation, TreasureType.LEGENDARY));
} }
} }

View File

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

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