diff --git a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java index be191609e..194b12468 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java @@ -279,6 +279,9 @@ public class ItemStackFactory extends MiniPlugin ItemStack stack = new ItemStack(id, 1, data); String name = CraftItemStack.asNMSCopy(stack).getName(); + if (id == 140) + name = "Flower Pot"; + if (name.length() == 0) name = Clean(mat.toString()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Category.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Category.java index 1e6a6c567..13804d3c4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Category.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Category.java @@ -6,7 +6,9 @@ public enum Category Advertisement, Exploiting, Hacking, - Other; + Warning, + PermMute, + Other; // Represents perm ban - (or old perm mutes) public static boolean contains(String s) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java index 964a1b2fa..538736e86 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java @@ -18,7 +18,7 @@ public class PunishCommand extends CommandBase { public PunishCommand(Punish plugin) { - super(plugin, Rank.MODERATOR, "punish", "p"); + super(plugin, Rank.HELPER, "punish", "p"); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java index 23539ef83..294e6e2d4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java @@ -3,7 +3,7 @@ package mineplex.core.punish; import java.util.HashMap; import mineplex.core.MiniPlugin; -import mineplex.core.account.event.ClientWebRequestEvent; +import mineplex.core.account.CoreClientManager; import mineplex.core.account.event.ClientWebResponseEvent; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -32,12 +32,14 @@ public class Punish extends MiniPlugin { private HashMap _punishClients; private PunishRepository _repository; + private CoreClientManager _clientManager; - public Punish(JavaPlugin plugin, String webServerAddress) + public Punish(JavaPlugin plugin, String webServerAddress, CoreClientManager clientManager) { super("Punish", plugin); _punishClients = new HashMap(); + _clientManager = clientManager; _repository = new PunishRepository(webServerAddress); } @@ -256,4 +258,9 @@ public class Punish extends MiniPlugin { _repository.RemoveBan(name, reason); } + + public CoreClientManager GetClients() + { + return _clientManager; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java index b533d9522..f062aeaa2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java @@ -6,15 +6,14 @@ import java.util.Collections; import java.util.List; import java.util.Map.Entry; +import mineplex.core.common.Rank; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.punish.Category; import mineplex.core.punish.Punish; import mineplex.core.punish.PunishClient; -import mineplex.core.punish.PunishTrackUtil; import mineplex.core.punish.Punishment; import mineplex.core.punish.PunishmentResponse; import mineplex.core.punish.PunishmentSorter; @@ -41,159 +40,339 @@ public class PunishPage extends CraftInventoryCustom implements Listener private String _target; private String _reason; private ShopItem _chatOffenseButton; - private ShopItem _advertisingButton; private ShopItem _exploitingButton; private ShopItem _hackingButton; - private ShopItem _otherButton; - + private ShopItem _warningButton; + private ShopItem _permMuteButton; + private ShopItem _permBanButton; + public PunishPage(Punish plugin, Player player, String target, String reason) { super(null, 54, " Punish"); - + _plugin = plugin; _buttonMap = new NautHashMap(); - + _player = player; _target = target; _reason = reason; - + BuildPage(); - + _player.openInventory(this); _plugin.RegisterEvents(this); } - + private void BuildPage() { // Player head getInventory().setItem(4, new ShopItem(Material.SKULL_ITEM, (byte)3, _target, new String[] { ChatColor.RESET + _reason }, 1, false, true).getHandle()); - + PunishClient client = _plugin.GetClient(_target); - + int chatOffenseCount = 0; - int advertisingCount = 0; int exploitingCount = 0; int hackingCount = 0; - int otherCount = 0; - + List> punishments = new ArrayList>(); - + for (Category category : client.GetPunishments().keySet()) { for (Punishment punishment : client.GetPunishments().get(category)) { punishments.add(new AbstractMap.SimpleEntry(category, punishment)); } - + switch (category) { - case ChatOffense: - chatOffenseCount = client.GetPunishments().get(category).size(); - break; - case Advertisement: - advertisingCount = client.GetPunishments().get(category).size(); - break; - case Exploiting: - exploitingCount = client.GetPunishments().get(category).size(); - break; - case Hacking: - hackingCount = client.GetPunishments().get(category).size(); - break; - case Other: - otherCount = client.GetPunishments().get(category).size(); - break; - default: - break; - + case ChatOffense: + chatOffenseCount = client.GetPunishments().get(category).size(); + break; + case Exploiting: + exploitingCount = client.GetPunishments().get(category).size(); + break; + case Hacking: + hackingCount = client.GetPunishments().get(category).size(); + break; + default: + break; } } - + String examplePrefix = ChatColor.RESET + "" + ChatColor.GRAY; - + String examplePrefixEx = ChatColor.RESET + "" + ChatColor.WHITE; + String examplePrefixNote = ChatColor.RESET + "" + ChatColor.DARK_GREEN; + _chatOffenseButton = new ShopItem(Material.BOOK_AND_QUILL, (byte)0, "Chat Offense", new String[] { ChatColor.RESET + "Past offenses : " + ChatColor.YELLOW + chatOffenseCount, examplePrefix + "Verbal Abuse, Spam, Harassment, Trolling, etc" }, 1, false, true); - _advertisingButton = new ShopItem(Material.SIGN, (byte)0, "Advertising", new String[] { ChatColor.RESET + "Past offenses : " + ChatColor.YELLOW + advertisingCount, examplePrefix + "Broadcasting another server ip." }, 1, false, true); - _exploitingButton = new ShopItem(Material.HOPPER, (byte)0, "Gameplay Offense", new String[] { ChatColor.RESET + "Past offenses : " + ChatColor.YELLOW + exploitingCount, examplePrefix + "Commmand/Map/Class/Skill exploits, etc" }, 1, false, true); - _hackingButton = new ShopItem(Material.IRON_SWORD, (byte)0, "Hacking", new String[] { ChatColor.RESET + "Past offenses : " + ChatColor.YELLOW + hackingCount, examplePrefix + "X-ray, Forcefield, Speed, Fly, Inventory Hacks, etc" }, 1, false, true); - _otherButton = new ShopItem(Material.BEACON, (byte)0, "Other", new String[] { ChatColor.RESET + "Past offenses : " + ChatColor.YELLOW + otherCount, examplePrefix + "Permanent punishments for unique cases." }, 1, false, true); - - getInventory().setItem(9, _chatOffenseButton.getHandle()); - getInventory().setItem(11, _advertisingButton.getHandle()); - getInventory().setItem(13, _exploitingButton.getHandle()); - getInventory().setItem(15, _hackingButton.getHandle()); - getInventory().setItem(17, _otherButton.getHandle()); - - long punishTime = PunishTrackUtil.GetPunishTime(_plugin.GetClient(_target), Category.ChatOffense, 1); - AddButton(18, new ShopItem(Material.INK_SACK, (byte)2, "Severity 1", new String[] { ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + F.time(UtilTime.convertString(punishTime * 3600000, 1, TimeUnit.FIT)), examplePrefix + "Spamming LOL LOLO LOLOL", examplePrefix + "F U Bob after bob tnt'd his base", examplePrefix + "Harassing admin to revoke a punishment" }, 1, false, true), new PunishButton(this, Category.ChatOffense, 1, false, punishTime)); - punishTime = PunishTrackUtil.GetPunishTime(_plugin.GetClient(_target), Category.ChatOffense, 2); - AddButton(27, new ShopItem(Material.INK_SACK, (byte)11, "Severity 2", new String[] { ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + F.time(UtilTime.convertString(punishTime * 3600000, 1, TimeUnit.FIT)), examplePrefix + "Spamming 'I LIKE CATS I LIKE CATS I LIKE CATS' 10 times.", examplePrefix + "General rudeness between players.", examplePrefix + "'go fucking cry, you baby'.", examplePrefix + "Does not necessarily require swearing.", examplePrefix + "Shit admins are shit" }, 1, false, true), new PunishButton(this, Category.ChatOffense, 2, false, punishTime)); - punishTime = PunishTrackUtil.GetPunishTime(_plugin.GetClient(_target), Category.ChatOffense, 3); - AddButton(36, new ShopItem(Material.INK_SACK, (byte)1, "Severity 3", new String[] { ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + F.time(UtilTime.convertString(punishTime * 3600000, 1, TimeUnit.FIT)), examplePrefix + "Spam bot", examplePrefix + "Severe abuse between players, back and forth argument in chat.", examplePrefix + "'fuck off, you admins are fucking awful', 'you should go and fucking die'" }, 1, false, true), new PunishButton(this, Category.ChatOffense, 3, false, punishTime)); - - punishTime = PunishTrackUtil.GetPunishTime(_plugin.GetClient(_target), Category.Advertisement, 1); - AddButton(20, new ShopItem(Material.INK_SACK, (byte)2, "Severity 1", new String[] { ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + F.time(UtilTime.convertString(punishTime * 3600000, 1, TimeUnit.FIT)), examplePrefix + "Talking about another server, though asked not to." }, 1, false, true), new PunishButton(this, Category.Advertisement, 1, false, punishTime)); - punishTime = PunishTrackUtil.GetPunishTime(_plugin.GetClient(_target), Category.Advertisement, 2); - AddButton(29, new ShopItem(Material.INK_SACK, (byte)11, "Severity 2", new String[] { ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Joining and asking other players to come check out another server." }, 1, false, true), new PunishButton(this, Category.Advertisement, 2, false, -1)); - AddButton(38, new ShopItem(Material.INK_SACK, (byte)1, "Severity 3", new String[] { ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Joining the server and spamming 'www.crapexampleserver.com'"}, 1, false, true), new PunishButton(this, Category.Advertisement, 3, true, -1)); - - punishTime = PunishTrackUtil.GetPunishTime(_plugin.GetClient(_target), Category.Exploiting, 1); - AddButton(22, new ShopItem(Material.INK_SACK, (byte)2, "Severity 1", new String[] { ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + F.time(UtilTime.convertString(punishTime * 3600000, 1, TimeUnit.FIT)), examplePrefix + "Hearing about a new exploit, and trying it out once.", examplePrefix + "For example, a command to start a world event." }, 1, false, true), new PunishButton(this, Category.Exploiting, 1, true, punishTime)); - AddButton(31, new ShopItem(Material.INK_SACK, (byte)11, "Severity 2", new String[] { ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Something like... abusing a ban command.", examplePrefix + "Intentionally ruining experience for others via exploit." }, 1, false, true), new PunishButton(this, Category.Exploiting, 2, true, -1)); - AddButton(40, new ShopItem(Material.INK_SACK, (byte)1, "Severity 3", new String[] { ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Ruins map economy completely by exploiting a dupe bug.", examplePrefix + "Crashing server via exploit." }, 1, false, true), new PunishButton(this, Category.Exploiting, 3, true, -1)); - - AddButton(24, new ShopItem(Material.INK_SACK, (byte)2, "Severity 1", new String[] { ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Using XRay on server" }, 1, false, true), new PunishButton(this, Category.Hacking, 1, true, -1)); - AddButton(33, new ShopItem(Material.INK_SACK, (byte)11, "Severity 2", new String[] { ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Fly Hacks, Derp, Nuker, Speed." }, 1, false, true), new PunishButton(this, Category.Hacking, 2, true, -1)); - AddButton(42, new ShopItem(Material.INK_SACK, (byte)1, "Severity 3", new String[] { ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Forcefield Hacks, V/No-Clip, Impersonating accounts, etc" }, 1, false, true), new PunishButton(this, Category.Hacking, 3, true, -1)); - - AddButton(26, new ShopItem(Material.REDSTONE_BLOCK, (byte)0, "Permanent Ban", new String[] { ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Better have a good reason for using this." }, 1, false, true), new PunishButton(this, Category.Other, 1, true, -1)); - AddButton(35, new ShopItem(Material.EMERALD_BLOCK, (byte)0, "Permanent Mute", new String[] { ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Better have a good reason for using this." }, 1, false, true), new PunishButton(this, Category.Other, 1, false, -1)); - + _exploitingButton = new ShopItem(Material.HOPPER, (byte)0, "General Offense", new String[] { ChatColor.RESET + "Past offenses : " + ChatColor.YELLOW + exploitingCount, examplePrefix + "Commmand/Map/Class/Skill exploits, etc" }, 1, false, true); + _hackingButton = new ShopItem(Material.IRON_SWORD, (byte)0, "Client Mod", new String[] { ChatColor.RESET + "Past offenses : " + ChatColor.YELLOW + hackingCount, examplePrefix + "X-ray, Forcefield, Speed, Fly, Inventory Hacks, etc" }, 1, false, true); + _warningButton = new ShopItem(Material.PAPER, (byte)0, "Warning", new String[] { }, 1, false, true); + _permMuteButton = new ShopItem(Material.EMERALD_BLOCK, (byte)0, "Permanent Mute", new String[] { }, 1, false, true); + _permBanButton = new ShopItem(Material.REDSTONE_BLOCK, (byte)0, "Permanent Ban", new String[] { }, 1, false, true); + + getInventory().setItem(10, _chatOffenseButton.getHandle()); + getInventory().setItem(12, _exploitingButton.getHandle()); + getInventory().setItem(14, _hackingButton.getHandle()); + + //Mute + { + AddButton(19, new ShopItem(Material.INK_SACK, (byte)2, "Severity 1", new String[] { + ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + "2 Hours", + " ", + examplePrefix + "Spamming same thing in chat (3-5 times)", + " ", + examplePrefix + "Light Advertising;", + examplePrefixEx + " 'anyone want to play on minecade?'", + " ", + examplePrefix + "Trolling", + " ", + examplePrefix + "Constantly just talking crap", + " ", + examplePrefix + "Pestering staff in admin chat", + " ", + examplePrefix + "Accusing a player of hacks in chat", + " ", + examplePrefixNote + "Use Severity 2 if many Severity 1 past offences", + }, 1, false, true), new PunishButton(this, Category.ChatOffense, 1, false, 2)); + + if (_plugin.GetClients().Get(_player).GetRank().Has(Rank.MODERATOR)) + { + AddButton(28, new ShopItem(Material.INK_SACK, (byte)11, "Severity 2", new String[] { + ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + "24 Hours", + " ", + examplePrefix + "Spamming same thing in chat (6-14 times)", + " ", + examplePrefix + "Medium Advertising;", + examplePrefixEx + " 'check out my server! crap.server.net'", + " ", + examplePrefix + "Rudeness, arguing or abuse between players;", + examplePrefixEx + " 'go fucking cry, you baby'.", + examplePrefixEx + " 'SHIT ADMINS ARE SHIT!!!'", + examplePrefixEx + " 'youre terrible, learn to play'", + " ", + examplePrefixNote + "Use Severity 3 if many Severity 2 past offences", + }, 1, false, true), new PunishButton(this, Category.ChatOffense, 2, false, 24)); + + AddButton(37, new ShopItem(Material.INK_SACK, (byte)1, "Severity 3", new String[] { + ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + "Permanent", + " ", + examplePrefix + "Spamming same thing in chat (15+ times)", + " ", + examplePrefix + "Strong Advertising;", + examplePrefixEx + " 'JOIN MINECADE!! MINEPLEX SUCKS'", + " ", + examplePrefix + "Severe chat abuse towards players/staff", + examplePrefixEx + " 'go fucking die in a fire you fucking sack of shit'", + }, 1, false, true), new PunishButton(this, Category.ChatOffense, 3, false, -1)); + } + } + + //General + { + AddButton(21, new ShopItem(Material.INK_SACK, (byte)2, "Severity 1", new String[] { + ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "2 Hours", + " ", + examplePrefix + "Some Examples;", + examplePrefixEx + " Trolling (Gameplay Only)", + examplePrefixEx + " ", + " ", + examplePrefixNote + "Use Severity 2 if many Severity 1 past offences", + }, 1, false, true), new PunishButton(this, Category.Exploiting, 1, true, 12)); + + if (_plugin.GetClients().Get(_player).GetRank().Has(Rank.MODERATOR)) + { + + AddButton(30, new ShopItem(Material.INK_SACK, (byte)11, "Severity 2", new String[] { + ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "24", + " ", + examplePrefix + "Examples;", + examplePrefixEx + " Team killing with water in Bridges", + examplePrefixEx + " Wither Skeleton block glitching in SSM to hide", + " ", + examplePrefixNote + "Use Severity 3 if many Severity 2 past offences", + }, 1, false, true), new PunishButton(this, Category.Exploiting, 2, true, 24)); + + AddButton(39, new ShopItem(Material.INK_SACK, (byte)1, "Severity 3", new String[] { + ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "Permanent", + " ", + examplePrefix + "Examples;", + examplePrefixEx + " Repeatedly crashing server with glitch", + " ", + }, 1, false, true), new PunishButton(this, Category.Exploiting, 3, true, -1)); + } + } + + //Hacks + { + AddButton(23, new ShopItem(Material.INK_SACK, (byte)2, "Severity 1", new String[] { + ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "12 Hours", + " ", + examplePrefix + "Damage Indicators, Better Sprint, Minimaps", + " ", + examplePrefixNote + "Use this for 1st Offence" + }, 1, false, true), new PunishButton(this, Category.Hacking, 1, true, 24)); + + if (_plugin.GetClients().Get(_player).GetRank().Has(Rank.MODERATOR)) + { + AddButton(32, new ShopItem(Material.INK_SACK, (byte)11, "Severity 2", new String[] { + ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "1 Week", + " ", + examplePrefix + "Examples;", + examplePrefixEx + " Damage Indicators", + examplePrefixEx + " Better Sprint", + examplePrefixEx + " Player Radar", + " ", + examplePrefixNote + "Use this for 2nd Offence", + " ", + examplePrefixNote + "Use Severity 3 for 3rd Offence", + }, 1, false, true), new PunishButton(this, Category.Hacking, 2, true, 168)); + + AddButton(41, new ShopItem(Material.INK_SACK, (byte)1, "Severity 3", new String[] { + ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "Permanent", + " ", + examplePrefix + "Examples;", + examplePrefixEx + " Fly Hack", + examplePrefixEx + " Speed Hack", + examplePrefixEx + " Forcefield", + " ", + examplePrefixNote + "Must be 100% sure they were hacking!" + }, 1, false, true), new PunishButton(this, Category.Hacking, 3, true, -1)); + } + } + + //Other + if (_plugin.GetClients().Get(_player).GetRank().Has(Rank.MODERATOR)) + { + AddButton(25, new ShopItem(Material.PAPER, (byte)0, "Warning", new String[] { + " ", + examplePrefix + "Example Warning Input;", + examplePrefixEx + " Spam - Repeatedly writing MEOW", + examplePrefixEx + " Swearing - Saying 'fuck' and 'shit'", + examplePrefixEx + " Hack Accusation - Accused Tomp13 of hacking", + examplePrefixEx + " Trolling - was trying to make bob angry in chat", + + }, 1, false, true), new PunishButton(this, Category.Warning, 1, false, 0)); + + AddButton(34, new ShopItem(Material.REDSTONE_BLOCK, (byte)0, "Permanent Ban", new String[] { + ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "Permanent", + " ", + examplePrefixNote + "Must supply detailed reason for Ban." + }, 1, false, true), new PunishButton(this, Category.Other, 1, true, -1)); + + AddButton(43, new ShopItem(Material.EMERALD_BLOCK, (byte)0, "Permanent Mute", new String[] { + ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + "Permanent", + " ", + examplePrefixNote + "Must supply detailed reason for Mute." + }, 1, false, true), new PunishButton(this, Category.Other, 1, false, -1)); + } + Collections.sort(punishments, new PunishmentSorter()); - + int slot = 45; - + for (Entry punishmentEntry : punishments) { + if (punishmentEntry.getKey() == Category.Advertisement) + continue; + if (slot >= 54) break; - + ShopItem button = null; - + switch (punishmentEntry.getKey()) { - case ChatOffense: - button = _chatOffenseButton.clone(); - break; - case Advertisement: - button = _advertisingButton.clone(); - break; - case Exploiting: - button = _exploitingButton.clone(); - break; - case Hacking: - button = _hackingButton.clone(); - break; - case Other: - button = _otherButton.clone(); - break; - default: - break; + case ChatOffense: + button = _chatOffenseButton.clone(); + break; + case Exploiting: + button = _exploitingButton.clone(); + break; + case Hacking: + button = _hackingButton.clone(); + break; + case Warning: + button = _warningButton.clone(); + break; + case PermMute: + button = _permMuteButton.clone(); + break; + case Other: + button = _permBanButton.clone(); + break; + default: + break; } - + Punishment punishment = punishmentEntry.getValue(); - - button.SetLore(new String[] + + if (punishmentEntry.getKey() == Category.ChatOffense || + punishmentEntry.getKey() == Category.Exploiting || + punishmentEntry.getKey() == Category.Hacking) { - ChatColor.RESET + "Punishment Type: " + ChatColor.YELLOW + punishment.GetCategory().toString(), - ChatColor.RESET + "Severity: " + ChatColor.YELLOW + punishment.GetSeverity(), - ChatColor.RESET + "Reason: " + ChatColor.YELLOW + punishment.GetReason(), - ChatColor.RESET + "Admin: " + ChatColor.YELLOW + punishment.GetAdmin(), - ChatColor.RESET + "Date of Ban: " + ChatColor.YELLOW + UtilTime.when(punishment.GetTime()), - ChatColor.RESET + "Ban Duration: " + (punishment.GetCategory() == Category.Other ? ChatColor.RED + "PERMANENT" : (ChatColor.RED + "" + F.time(UtilTime.convertString((long)(punishment.GetHours() * 3600000), 1, TimeUnit.FIT)))), - ChatColor.RESET + "Expires In: " + ChatColor.RED + (punishment.GetCategory() == Category.Other ? "NEVER" : (punishment.GetRemaining() > 0 ? F.time(UtilTime.convertString((long)(punishment.GetRemaining()), 1, TimeUnit.FIT)) : ChatColor.GREEN + "EXPIRED")), - ChatColor.RESET + "Removed by: " + (punishment.GetRemoved() ? ChatColor.GREEN + punishment.GetRemoveAdmin() : ChatColor.RED + "Not Removed"), - ChatColor.RESET + "Remove Reason: " + (punishment.GetRemoved() ? ChatColor.GREEN + punishment.GetRemoveReason() : ChatColor.RED + "Not Removed"), - }); - + if (punishment.GetRemoved()) + { + button.SetLore(new String[] + { + ChatColor.RESET + "Punishment Type: " + ChatColor.YELLOW + punishment.GetCategory().toString(), + ChatColor.RESET + "Severity: " + ChatColor.YELLOW + punishment.GetSeverity(), + " ", + ChatColor.RESET + "Reason: " + ChatColor.YELLOW + punishment.GetReason(), + " ", + ChatColor.RESET + "Admin: " + ChatColor.YELLOW + punishment.GetAdmin(), + ChatColor.RESET + "Date: " + ChatColor.YELLOW + UtilTime.when(punishment.GetTime()), + " ", + ChatColor.RESET + "Removed by: " + (punishment.GetRemoved() ? ChatColor.GREEN + punishment.GetRemoveAdmin() : ChatColor.RED + "Not Removed"), + ChatColor.RESET + "Remove Reason: " + (punishment.GetRemoved() ? ChatColor.GREEN + punishment.GetRemoveReason() : ChatColor.RED + "Not Removed"), + + }); + } + else + { + button.SetLore(new String[] + { + ChatColor.RESET + "Punishment Type: " + ChatColor.YELLOW + punishment.GetCategory().toString(), + ChatColor.RESET + "Severity: " + ChatColor.YELLOW + punishment.GetSeverity(), + " ", + ChatColor.RESET + "Reason: " + ChatColor.YELLOW + punishment.GetReason(), + " ", + ChatColor.RESET + "Admin: " + ChatColor.YELLOW + punishment.GetAdmin(), + ChatColor.RESET + "Date: " + ChatColor.YELLOW + UtilTime.when(punishment.GetTime()), + }); + } + } + else + { + if (punishment.GetRemoved()) + { + button.SetLore(new String[] + { + ChatColor.RESET + "Punishment Type: " + ChatColor.YELLOW + punishment.GetCategory().toString(), + " ", + ChatColor.RESET + "Reason: " + ChatColor.YELLOW + punishment.GetReason(), + " ", + ChatColor.RESET + "Admin: " + ChatColor.YELLOW + punishment.GetAdmin(), + ChatColor.RESET + "Date: " + ChatColor.YELLOW + UtilTime.when(punishment.GetTime()), + " ", + ChatColor.RESET + "Removed by: " + (punishment.GetRemoved() ? ChatColor.GREEN + punishment.GetRemoveAdmin() : ChatColor.RED + "Not Removed"), + ChatColor.RESET + "Remove Reason: " + (punishment.GetRemoved() ? ChatColor.GREEN + punishment.GetRemoveReason() : ChatColor.RED + "Not Removed"), + }); + } + else + { + button.SetLore(new String[] + { + ChatColor.RESET + "Punishment Type: " + ChatColor.YELLOW + punishment.GetCategory().toString(), + " ", + ChatColor.RESET + "Reason: " + ChatColor.YELLOW + punishment.GetReason(), + " ", + ChatColor.RESET + "Admin: " + ChatColor.YELLOW + punishment.GetAdmin(), + ChatColor.RESET + "Date: " + ChatColor.YELLOW + UtilTime.when(punishment.GetTime()), + }); + } + + } + if ((punishment.GetHours() == -1 || punishment.GetRemaining() > 0) && !punishment.GetRemoved() && punishment.GetActive()) { button.addUnsafeEnchantment(Enchantment.DURABILITY, 1); @@ -203,11 +382,11 @@ public class PunishPage extends CraftInventoryCustom implements Listener { getInventory().setItem(slot, button.getHandle()); } - + slot++; } } - + @EventHandler public void OnInventoryClick(InventoryClickEvent event) { @@ -220,11 +399,11 @@ public class PunishPage extends CraftInventoryCustom implements Listener _buttonMap.get(event.getRawSlot()).Clicked((Player)event.getWhoClicked()); } } - + event.setCancelled(true); } } - + @EventHandler public void OnInventoryClose(InventoryCloseEvent event) { @@ -246,7 +425,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener _player.closeInventory(); ClosePunish(); } - + private void ClosePunish() { HandlerList.unregisterAll(this); @@ -255,12 +434,12 @@ public class PunishPage extends CraftInventoryCustom implements Listener public void RemovePunishment(final Punishment punishment, final ItemStack item) { _plugin.RemovePunishment(punishment.GetPunishmentId(), _target, _player, _reason, new Callback() - { + { @Override public void run(String result) { PunishmentResponse punishResponse = PunishmentResponse.valueOf(result); - + if (punishResponse != PunishmentResponse.PunishmentRemoved) { _player.sendMessage(F.main(_plugin.GetName(), "There was a problem removing the punishment.")); @@ -272,6 +451,6 @@ public class PunishPage extends CraftInventoryCustom implements Listener ClosePunish(); } } - }); + }); } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 173998596..d141d1a8d 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -54,40 +54,40 @@ public class Hub extends JavaPlugin implements INautilusPlugin, IRelation private String WEB_CONFIG = "webServer"; @Override - public void onEnable() + public void onEnable() { - getConfig().addDefault(WEB_CONFIG, "http://api.mineplex.com/"); + getConfig().addDefault(WEB_CONFIG, "http://api.mineplex.com/"); getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); saveConfig(); - - //Core Modules + + //Core Modules CoreClientManager clientManager = CoreClientManager.Initialize(this, GetWebServerAddress()); //Static Modules CommandCenter.Initialize(this, clientManager); ItemStackFactory.Initialize(this, false); Recharge.Initialize(this); - Punish punish = new Punish(this, GetWebServerAddress()); + Punish punish = new Punish(this, GetWebServerAddress(), clientManager); Portal portal = new Portal(this); AntiHack.Initialize(this, punish, portal); - + DonationManager donationManager = new DonationManager(this, GetWebServerAddress()); - //Other Modules + //Other Modules Creature creature = new Creature(this); new MessageManager(this, clientManager); NpcManager npcManager = new NpcManager(this, creature); new PetManager(this, clientManager, donationManager, creature, GetWebServerAddress()); - + //Main Modules PacketHandler packetHandler = new PacketHandler(this); PartyManager partyManager = new PartyManager(this, clientManager); HubManager hubManager = new HubManager(this, new BlockRestore(this), clientManager, donationManager, new ConditionManager(this), new DisguiseManager(this, packetHandler), new TaskManager(this, GetWebServerAddress()), portal, partyManager); new ServerManager(this, clientManager, donationManager, portal, partyManager, new ServerStatusManager(this, new LagMeter(this, clientManager)), hubManager, new StackerManager(hubManager)); new Chat(this, clientManager); - new MemoryFix(this); + new MemoryFix(this); new FileUpdater(this, portal); CombatManager combatManager = new CombatManager(this); @@ -114,9 +114,9 @@ public class Hub extends JavaPlugin implements INautilusPlugin, IRelation @Override public void onDisable() { - + } - + @Override public JavaPlugin GetPlugin() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index cf409dbf9..5f4a32e16 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -104,7 +104,7 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin ItemStackFactory.Initialize(this, false); Recharge.Initialize(this); - + _donationManager = new DonationManager(this, GetWebServerAddress()); ConditionManager conditionManager = new ConditionManager(this); @@ -112,7 +112,7 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin AntiStack antistack = new AntiStack(this); - GetCreature(); + GetCreature(); GetSpawn(); GetTeleport(); new FileUpdater(this, new Portal(this)); @@ -131,7 +131,7 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin //Unreferenced Modules Scheduler.Initialize(this); - Punish punish = new Punish(this, GetWebServerAddress()); + Punish punish = new Punish(this, GetWebServerAddress(), _clientManager); AntiHack.Initialize(this, punish, portal); new MemoryFix(this); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java index 3a5dd2cbc..2e6e3867e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java @@ -44,8 +44,11 @@ public class HideSeek extends TeamGame private GameTeam _hiders; private GameTeam _seekers; + private long _hideTime = 15000; private long _gameTime = 300000; + private boolean _started = false; + private HashMap _disguises = new HashMap(); private HashMap _disguiseBlock = new HashMap(); private HashMap _disguiseMovement = new HashMap(); @@ -150,7 +153,7 @@ public class HideSeek extends TeamGame @EventHandler public void InitialDisguise(GameStateChangeEvent event) { - if (event.GetState() != GameState.Live) + if (event.GetState() != GameState.Prepare) return; for (Player player : _hiders.GetPlayers(true)) @@ -161,7 +164,7 @@ public class HideSeek extends TeamGame { DisguiseBlock disguise = new DisguiseBlock(player, type.getId(), 0); _disguises.put(player, disguise); - Manager.GetDisguise().disguise(disguise); + //Manager.GetDisguise().disguise(disguise); //Inform UtilPlayer.message(player, F.main("Game", C.cWhite + "You are now a " + F.elem(ItemStackFactory.Instance.GetName(type, (byte)0, false) + " Block") + "!")); @@ -285,7 +288,7 @@ public class HideSeek extends TeamGame //Self player.sendBlockChange(player.getLocation(), 36, (byte)0); } - + @EventHandler public void BlockDamage(BlockDamageEvent event) { @@ -394,30 +397,53 @@ public class HideSeek extends TeamGame if (event.getType() != UpdateType.TICK) return; - - long timeLeft = _gameTime - (System.currentTimeMillis() - GetStateTime()); - - if (timeLeft > 0) + + //Hide Time + if (!_started) { - GetObjectiveSide().setDisplayName( - ChatColor.WHITE + "§lTime: " + C.cGreen + "§l" - + UtilTime.MakeStr(timeLeft)); - } + long timeLeft = _gameTime - (System.currentTimeMillis() - GetStateTime()); + + if (timeLeft > 0) + { + GetObjectiveSide().setDisplayName( + ChatColor.WHITE + "§lSeek Time: " + C.cGreen + "§l" + + UtilTime.MakeStr(timeLeft)); + } + else + { + _started = true; + Announce(C.Bold + "The " + F.elem(C.cRed + C.Bold + "Seekers") + " have been released!"); + } + } + //Seek Time else { - GetObjectiveSide().setDisplayName( - ChatColor.WHITE + "§lTime: " + C.cGreen + "§l" - + UtilTime.MakeStr(0)); - - SetState(GameState.End); - AnnounceEnd(_hiders); + long timeLeft = _gameTime - (System.currentTimeMillis() - GetStateTime()); - for (Player player : _hiders.GetPlayers(true)) - AddGems(player, 10, "Winning Team", false); + if (timeLeft > 0) + { + GetObjectiveSide().setDisplayName( + ChatColor.WHITE + "§lSeek Time: " + C.cGreen + "§l" + + UtilTime.MakeStr(timeLeft)); + } + else + { + GetObjectiveSide().setDisplayName( + ChatColor.WHITE + "§lSeek Time: " + C.cGreen + "§l" + + UtilTime.MakeStr(0)); + + SetState(GameState.End); + AnnounceEnd(_hiders); - for (Player player : GetPlayers(false)) - if (player.isOnline()) - AddGems(player, 10, "Participation", false); - } + for (Player player : _hiders.GetPlayers(true)) + AddGems(player, 10, "Winning Team", false); + + for (Player player : GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false); + } + } + + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java index 7514f0378..14532bceb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java @@ -32,6 +32,7 @@ public class KitHiderShocker extends Kit new Perk[] { + new PerkShockingStrike() }, EntityType.SLIME, new ItemStack(Material.REDSTONE_LAMP_OFF)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java index 9351e28b2..db0b64821 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java @@ -17,7 +17,6 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; public class KitHiderSwapper extends Kit { @@ -27,7 +26,7 @@ public class KitHiderSwapper extends Kit new String[] { - "Can transform between different blocks!" + "Can change form multiple times!" }, new Perk[] @@ -41,7 +40,7 @@ public class KitHiderSwapper extends Kit @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SLIME_BALL, (byte)0, 1,C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Change Form")); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SLIME_BALL, (byte)0, 32, C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Change Form")); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkShockingStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkShockingStrike.java new file mode 100644 index 000000000..cf71c9f99 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkShockingStrike.java @@ -0,0 +1,44 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.C; +import nautilus.game.arcade.kit.Perk; + +public class PerkShockingStrike extends Perk +{ + public PerkShockingStrike() + { + super("Shocking Strikes", new String[] + { + C.cGray + "Your attacks Shock/Blind/Slow opponents.", + }); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void Effect(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!Kit.HasKit(damager)) + return; + + if (!Manager.IsAlive(damager)) + return; + + Manager.GetCondition().Factory().Slow(GetName(), event.GetDamageeEntity(), damager, 2, 1, false, false, false, false); + Manager.GetCondition().Factory().Blind(GetName(), event.GetDamageeEntity(), damager, 2, 1, false, false, false); + Manager.GetCondition().Factory().Shock(GetName(), event.GetDamageeEntity(), damager, 2, false, false); + } +}