Merge branch 'master' of ssh://dev.mineplex.com:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2013-11-06 20:38:41 -08:00
commit 079a58d2cd
11 changed files with 421 additions and 160 deletions

View File

@ -279,6 +279,9 @@ public class ItemStackFactory extends MiniPlugin
ItemStack stack = new ItemStack(id, 1, data); ItemStack stack = new ItemStack(id, 1, data);
String name = CraftItemStack.asNMSCopy(stack).getName(); String name = CraftItemStack.asNMSCopy(stack).getName();
if (id == 140)
name = "Flower Pot";
if (name.length() == 0) if (name.length() == 0)
name = Clean(mat.toString()); name = Clean(mat.toString());

View File

@ -6,7 +6,9 @@ public enum Category
Advertisement, Advertisement,
Exploiting, Exploiting,
Hacking, Hacking,
Other; Warning,
PermMute,
Other; // Represents perm ban - (or old perm mutes)
public static boolean contains(String s) public static boolean contains(String s)
{ {

View File

@ -18,7 +18,7 @@ public class PunishCommand extends CommandBase<Punish>
{ {
public PunishCommand(Punish plugin) public PunishCommand(Punish plugin)
{ {
super(plugin, Rank.MODERATOR, "punish", "p"); super(plugin, Rank.HELPER, "punish", "p");
} }
@Override @Override

View File

@ -3,7 +3,7 @@ package mineplex.core.punish;
import java.util.HashMap; import java.util.HashMap;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.event.ClientWebRequestEvent; import mineplex.core.account.CoreClientManager;
import mineplex.core.account.event.ClientWebResponseEvent; import mineplex.core.account.event.ClientWebResponseEvent;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -32,12 +32,14 @@ public class Punish extends MiniPlugin
{ {
private HashMap<String, PunishClient> _punishClients; private HashMap<String, PunishClient> _punishClients;
private PunishRepository _repository; private PunishRepository _repository;
private CoreClientManager _clientManager;
public Punish(JavaPlugin plugin, String webServerAddress) public Punish(JavaPlugin plugin, String webServerAddress, CoreClientManager clientManager)
{ {
super("Punish", plugin); super("Punish", plugin);
_punishClients = new HashMap<String, PunishClient>(); _punishClients = new HashMap<String, PunishClient>();
_clientManager = clientManager;
_repository = new PunishRepository(webServerAddress); _repository = new PunishRepository(webServerAddress);
} }
@ -256,4 +258,9 @@ public class Punish extends MiniPlugin
{ {
_repository.RemoveBan(name, reason); _repository.RemoveBan(name, reason);
} }
public CoreClientManager GetClients()
{
return _clientManager;
}
} }

View File

@ -6,15 +6,14 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import mineplex.core.common.Rank;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.punish.Category; import mineplex.core.punish.Category;
import mineplex.core.punish.Punish; import mineplex.core.punish.Punish;
import mineplex.core.punish.PunishClient; import mineplex.core.punish.PunishClient;
import mineplex.core.punish.PunishTrackUtil;
import mineplex.core.punish.Punishment; import mineplex.core.punish.Punishment;
import mineplex.core.punish.PunishmentResponse; import mineplex.core.punish.PunishmentResponse;
import mineplex.core.punish.PunishmentSorter; import mineplex.core.punish.PunishmentSorter;
@ -41,159 +40,339 @@ public class PunishPage extends CraftInventoryCustom implements Listener
private String _target; private String _target;
private String _reason; private String _reason;
private ShopItem _chatOffenseButton; private ShopItem _chatOffenseButton;
private ShopItem _advertisingButton;
private ShopItem _exploitingButton; private ShopItem _exploitingButton;
private ShopItem _hackingButton; 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) public PunishPage(Punish plugin, Player player, String target, String reason)
{ {
super(null, 54, " Punish"); super(null, 54, " Punish");
_plugin = plugin; _plugin = plugin;
_buttonMap = new NautHashMap<Integer, IButton>(); _buttonMap = new NautHashMap<Integer, IButton>();
_player = player; _player = player;
_target = target; _target = target;
_reason = reason; _reason = reason;
BuildPage(); BuildPage();
_player.openInventory(this); _player.openInventory(this);
_plugin.RegisterEvents(this); _plugin.RegisterEvents(this);
} }
private void BuildPage() private void BuildPage()
{ {
// Player head // Player head
getInventory().setItem(4, new ShopItem(Material.SKULL_ITEM, (byte)3, _target, new String[] { ChatColor.RESET + _reason }, 1, false, true).getHandle()); 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); PunishClient client = _plugin.GetClient(_target);
int chatOffenseCount = 0; int chatOffenseCount = 0;
int advertisingCount = 0;
int exploitingCount = 0; int exploitingCount = 0;
int hackingCount = 0; int hackingCount = 0;
int otherCount = 0;
List<Entry<Category, Punishment>> punishments = new ArrayList<Entry<Category, Punishment>>(); List<Entry<Category, Punishment>> punishments = new ArrayList<Entry<Category, Punishment>>();
for (Category category : client.GetPunishments().keySet()) for (Category category : client.GetPunishments().keySet())
{ {
for (Punishment punishment : client.GetPunishments().get(category)) for (Punishment punishment : client.GetPunishments().get(category))
{ {
punishments.add(new AbstractMap.SimpleEntry<Category, Punishment>(category, punishment)); punishments.add(new AbstractMap.SimpleEntry<Category, Punishment>(category, punishment));
} }
switch (category) switch (category)
{ {
case ChatOffense: case ChatOffense:
chatOffenseCount = client.GetPunishments().get(category).size(); chatOffenseCount = client.GetPunishments().get(category).size();
break; break;
case Advertisement: case Exploiting:
advertisingCount = client.GetPunishments().get(category).size(); exploitingCount = client.GetPunishments().get(category).size();
break; break;
case Exploiting: case Hacking:
exploitingCount = client.GetPunishments().get(category).size(); hackingCount = client.GetPunishments().get(category).size();
break; break;
case Hacking: default:
hackingCount = client.GetPunishments().get(category).size(); break;
break;
case Other:
otherCount = client.GetPunishments().get(category).size();
break;
default:
break;
} }
} }
String examplePrefix = ChatColor.RESET + "" + ChatColor.GRAY; 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); _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, "General Offense", new String[] { ChatColor.RESET + "Past offenses : " + ChatColor.YELLOW + exploitingCount, examplePrefix + "Commmand/Map/Class/Skill exploits, etc" }, 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, "Client Mod", new String[] { ChatColor.RESET + "Past offenses : " + ChatColor.YELLOW + hackingCount, examplePrefix + "X-ray, Forcefield, Speed, Fly, Inventory Hacks, 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); _warningButton = new ShopItem(Material.PAPER, (byte)0, "Warning", new String[] { }, 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); _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(9, _chatOffenseButton.getHandle());
getInventory().setItem(11, _advertisingButton.getHandle()); getInventory().setItem(10, _chatOffenseButton.getHandle());
getInventory().setItem(13, _exploitingButton.getHandle()); getInventory().setItem(12, _exploitingButton.getHandle());
getInventory().setItem(15, _hackingButton.getHandle()); getInventory().setItem(14, _hackingButton.getHandle());
getInventory().setItem(17, _otherButton.getHandle());
//Mute
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)); AddButton(19, new ShopItem(Material.INK_SACK, (byte)2, "Severity 1", new String[] {
punishTime = PunishTrackUtil.GetPunishTime(_plugin.GetClient(_target), Category.ChatOffense, 2); ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + "2 Hours",
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); examplePrefix + "Spamming same thing in chat (3-5 times)",
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)); " ",
examplePrefix + "Light Advertising;",
punishTime = PunishTrackUtil.GetPunishTime(_plugin.GetClient(_target), Category.Advertisement, 1); examplePrefixEx + " 'anyone want to play on minecade?'",
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); examplePrefix + "Trolling",
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)); examplePrefix + "Constantly just talking crap",
" ",
punishTime = PunishTrackUtil.GetPunishTime(_plugin.GetClient(_target), Category.Exploiting, 1); examplePrefix + "Pestering staff in admin chat",
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)); examplePrefix + "Accusing a player of hacks in chat",
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)); " ",
examplePrefixNote + "Use Severity 2 if many Severity 1 past offences",
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)); }, 1, false, true), new PunishButton(this, Category.ChatOffense, 1, false, 2));
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)); if (_plugin.GetClients().Get(_player).GetRank().Has(Rank.MODERATOR))
{
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(28, new ShopItem(Material.INK_SACK, (byte)11, "Severity 2", new String[] {
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)); 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()); Collections.sort(punishments, new PunishmentSorter());
int slot = 45; int slot = 45;
for (Entry<Category, Punishment> punishmentEntry : punishments) for (Entry<Category, Punishment> punishmentEntry : punishments)
{ {
if (punishmentEntry.getKey() == Category.Advertisement)
continue;
if (slot >= 54) if (slot >= 54)
break; break;
ShopItem button = null; ShopItem button = null;
switch (punishmentEntry.getKey()) switch (punishmentEntry.getKey())
{ {
case ChatOffense: case ChatOffense:
button = _chatOffenseButton.clone(); button = _chatOffenseButton.clone();
break; break;
case Advertisement: case Exploiting:
button = _advertisingButton.clone(); button = _exploitingButton.clone();
break; break;
case Exploiting: case Hacking:
button = _exploitingButton.clone(); button = _hackingButton.clone();
break; break;
case Hacking: case Warning:
button = _hackingButton.clone(); button = _warningButton.clone();
break; break;
case Other: case PermMute:
button = _otherButton.clone(); button = _permMuteButton.clone();
break; break;
default: case Other:
break; button = _permBanButton.clone();
break;
default:
break;
} }
Punishment punishment = punishmentEntry.getValue(); 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(), if (punishment.GetRemoved())
ChatColor.RESET + "Severity: " + ChatColor.YELLOW + punishment.GetSeverity(), {
ChatColor.RESET + "Reason: " + ChatColor.YELLOW + punishment.GetReason(), button.SetLore(new String[]
ChatColor.RESET + "Admin: " + ChatColor.YELLOW + punishment.GetAdmin(), {
ChatColor.RESET + "Date of Ban: " + ChatColor.YELLOW + UtilTime.when(punishment.GetTime()), ChatColor.RESET + "Punishment Type: " + ChatColor.YELLOW + punishment.GetCategory().toString(),
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 + "Severity: " + ChatColor.YELLOW + punishment.GetSeverity(),
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 + "Reason: " + ChatColor.YELLOW + punishment.GetReason(),
ChatColor.RESET + "Remove Reason: " + (punishment.GetRemoved() ? ChatColor.GREEN + punishment.GetRemoveReason() : ChatColor.RED + "Not Removed"), " ",
}); 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()) if ((punishment.GetHours() == -1 || punishment.GetRemaining() > 0) && !punishment.GetRemoved() && punishment.GetActive())
{ {
button.addUnsafeEnchantment(Enchantment.DURABILITY, 1); button.addUnsafeEnchantment(Enchantment.DURABILITY, 1);
@ -203,11 +382,11 @@ public class PunishPage extends CraftInventoryCustom implements Listener
{ {
getInventory().setItem(slot, button.getHandle()); getInventory().setItem(slot, button.getHandle());
} }
slot++; slot++;
} }
} }
@EventHandler @EventHandler
public void OnInventoryClick(InventoryClickEvent event) public void OnInventoryClick(InventoryClickEvent event)
{ {
@ -220,11 +399,11 @@ public class PunishPage extends CraftInventoryCustom implements Listener
_buttonMap.get(event.getRawSlot()).Clicked((Player)event.getWhoClicked()); _buttonMap.get(event.getRawSlot()).Clicked((Player)event.getWhoClicked());
} }
} }
event.setCancelled(true); event.setCancelled(true);
} }
} }
@EventHandler @EventHandler
public void OnInventoryClose(InventoryCloseEvent event) public void OnInventoryClose(InventoryCloseEvent event)
{ {
@ -246,7 +425,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener
_player.closeInventory(); _player.closeInventory();
ClosePunish(); ClosePunish();
} }
private void ClosePunish() private void ClosePunish()
{ {
HandlerList.unregisterAll(this); HandlerList.unregisterAll(this);
@ -255,12 +434,12 @@ public class PunishPage extends CraftInventoryCustom implements Listener
public void RemovePunishment(final Punishment punishment, final ItemStack item) public void RemovePunishment(final Punishment punishment, final ItemStack item)
{ {
_plugin.RemovePunishment(punishment.GetPunishmentId(), _target, _player, _reason, new Callback<String>() _plugin.RemovePunishment(punishment.GetPunishmentId(), _target, _player, _reason, new Callback<String>()
{ {
@Override @Override
public void run(String result) public void run(String result)
{ {
PunishmentResponse punishResponse = PunishmentResponse.valueOf(result); PunishmentResponse punishResponse = PunishmentResponse.valueOf(result);
if (punishResponse != PunishmentResponse.PunishmentRemoved) if (punishResponse != PunishmentResponse.PunishmentRemoved)
{ {
_player.sendMessage(F.main(_plugin.GetName(), "There was a problem removing the punishment.")); _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(); ClosePunish();
} }
} }
}); });
} }
} }

View File

@ -54,40 +54,40 @@ public class Hub extends JavaPlugin implements INautilusPlugin, IRelation
private String WEB_CONFIG = "webServer"; private String WEB_CONFIG = "webServer";
@Override @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)); getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
saveConfig(); saveConfig();
//Core Modules //Core Modules
CoreClientManager clientManager = CoreClientManager.Initialize(this, GetWebServerAddress()); CoreClientManager clientManager = CoreClientManager.Initialize(this, GetWebServerAddress());
//Static Modules //Static Modules
CommandCenter.Initialize(this, clientManager); CommandCenter.Initialize(this, clientManager);
ItemStackFactory.Initialize(this, false); ItemStackFactory.Initialize(this, false);
Recharge.Initialize(this); Recharge.Initialize(this);
Punish punish = new Punish(this, GetWebServerAddress()); Punish punish = new Punish(this, GetWebServerAddress(), clientManager);
Portal portal = new Portal(this); Portal portal = new Portal(this);
AntiHack.Initialize(this, punish, portal); AntiHack.Initialize(this, punish, portal);
DonationManager donationManager = new DonationManager(this, GetWebServerAddress()); DonationManager donationManager = new DonationManager(this, GetWebServerAddress());
//Other Modules //Other Modules
Creature creature = new Creature(this); Creature creature = new Creature(this);
new MessageManager(this, clientManager); new MessageManager(this, clientManager);
NpcManager npcManager = new NpcManager(this, creature); NpcManager npcManager = new NpcManager(this, creature);
new PetManager(this, clientManager, donationManager, creature, GetWebServerAddress()); new PetManager(this, clientManager, donationManager, creature, GetWebServerAddress());
//Main Modules //Main Modules
PacketHandler packetHandler = new PacketHandler(this); PacketHandler packetHandler = new PacketHandler(this);
PartyManager partyManager = new PartyManager(this, clientManager); 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); 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 ServerManager(this, clientManager, donationManager, portal, partyManager, new ServerStatusManager(this, new LagMeter(this, clientManager)), hubManager, new StackerManager(hubManager));
new Chat(this, clientManager); new Chat(this, clientManager);
new MemoryFix(this); new MemoryFix(this);
new FileUpdater(this, portal); new FileUpdater(this, portal);
CombatManager combatManager = new CombatManager(this); CombatManager combatManager = new CombatManager(this);
@ -114,9 +114,9 @@ public class Hub extends JavaPlugin implements INautilusPlugin, IRelation
@Override @Override
public void onDisable() public void onDisable()
{ {
} }
@Override @Override
public JavaPlugin GetPlugin() public JavaPlugin GetPlugin()
{ {

View File

@ -104,7 +104,7 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin
ItemStackFactory.Initialize(this, false); ItemStackFactory.Initialize(this, false);
Recharge.Initialize(this); Recharge.Initialize(this);
_donationManager = new DonationManager(this, GetWebServerAddress()); _donationManager = new DonationManager(this, GetWebServerAddress());
ConditionManager conditionManager = new ConditionManager(this); ConditionManager conditionManager = new ConditionManager(this);
@ -112,7 +112,7 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin
AntiStack antistack = new AntiStack(this); AntiStack antistack = new AntiStack(this);
GetCreature(); GetCreature();
GetSpawn(); GetSpawn();
GetTeleport(); GetTeleport();
new FileUpdater(this, new Portal(this)); new FileUpdater(this, new Portal(this));
@ -131,7 +131,7 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin
//Unreferenced Modules //Unreferenced Modules
Scheduler.Initialize(this); Scheduler.Initialize(this);
Punish punish = new Punish(this, GetWebServerAddress()); Punish punish = new Punish(this, GetWebServerAddress(), _clientManager);
AntiHack.Initialize(this, punish, portal); AntiHack.Initialize(this, punish, portal);
new MemoryFix(this); new MemoryFix(this);

View File

@ -44,8 +44,11 @@ public class HideSeek extends TeamGame
private GameTeam _hiders; private GameTeam _hiders;
private GameTeam _seekers; private GameTeam _seekers;
private long _hideTime = 15000;
private long _gameTime = 300000; private long _gameTime = 300000;
private boolean _started = false;
private HashMap<Player, DisguiseBase> _disguises = new HashMap<Player, DisguiseBase>(); private HashMap<Player, DisguiseBase> _disguises = new HashMap<Player, DisguiseBase>();
private HashMap<Player, Block> _disguiseBlock = new HashMap<Player, Block>(); private HashMap<Player, Block> _disguiseBlock = new HashMap<Player, Block>();
private HashMap<Player, Location> _disguiseMovement = new HashMap<Player, Location>(); private HashMap<Player, Location> _disguiseMovement = new HashMap<Player, Location>();
@ -150,7 +153,7 @@ public class HideSeek extends TeamGame
@EventHandler @EventHandler
public void InitialDisguise(GameStateChangeEvent event) public void InitialDisguise(GameStateChangeEvent event)
{ {
if (event.GetState() != GameState.Live) if (event.GetState() != GameState.Prepare)
return; return;
for (Player player : _hiders.GetPlayers(true)) for (Player player : _hiders.GetPlayers(true))
@ -161,7 +164,7 @@ public class HideSeek extends TeamGame
{ {
DisguiseBlock disguise = new DisguiseBlock(player, type.getId(), 0); DisguiseBlock disguise = new DisguiseBlock(player, type.getId(), 0);
_disguises.put(player, disguise); _disguises.put(player, disguise);
Manager.GetDisguise().disguise(disguise); //Manager.GetDisguise().disguise(disguise);
//Inform //Inform
UtilPlayer.message(player, F.main("Game", C.cWhite + "You are now a " + F.elem(ItemStackFactory.Instance.GetName(type, (byte)0, false) + " Block") + "!")); 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 //Self
player.sendBlockChange(player.getLocation(), 36, (byte)0); player.sendBlockChange(player.getLocation(), 36, (byte)0);
} }
@EventHandler @EventHandler
public void BlockDamage(BlockDamageEvent event) public void BlockDamage(BlockDamageEvent event)
{ {
@ -394,30 +397,53 @@ public class HideSeek extends TeamGame
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
return; return;
long timeLeft = _gameTime - (System.currentTimeMillis() - GetStateTime()); //Hide Time
if (!_started)
if (timeLeft > 0)
{ {
GetObjectiveSide().setDisplayName( long timeLeft = _gameTime - (System.currentTimeMillis() - GetStateTime());
ChatColor.WHITE + "§lTime: " + C.cGreen + "§l"
+ UtilTime.MakeStr(timeLeft)); 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 else
{ {
GetObjectiveSide().setDisplayName( long timeLeft = _gameTime - (System.currentTimeMillis() - GetStateTime());
ChatColor.WHITE + "§lTime: " + C.cGreen + "§l"
+ UtilTime.MakeStr(0));
SetState(GameState.End);
AnnounceEnd(_hiders);
for (Player player : _hiders.GetPlayers(true)) if (timeLeft > 0)
AddGems(player, 10, "Winning Team", false); {
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)) for (Player player : _hiders.GetPlayers(true))
if (player.isOnline()) AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Participation", false);
} for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
}
}
} }
} }

View File

@ -32,6 +32,7 @@ public class KitHiderShocker extends Kit
new Perk[] new Perk[]
{ {
new PerkShockingStrike()
}, },
EntityType.SLIME, EntityType.SLIME,
new ItemStack(Material.REDSTONE_LAMP_OFF)); new ItemStack(Material.REDSTONE_LAMP_OFF));

View File

@ -17,7 +17,6 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitHiderSwapper extends Kit public class KitHiderSwapper extends Kit
{ {
@ -27,7 +26,7 @@ public class KitHiderSwapper extends Kit
new String[] new String[]
{ {
"Can transform between different blocks!" "Can change form multiple times!"
}, },
new Perk[] new Perk[]
@ -41,7 +40,7 @@ public class KitHiderSwapper extends Kit
@Override @Override
public void GiveItems(Player player) 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 @Override

View File

@ -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);
}
}