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);
String name = CraftItemStack.asNMSCopy(stack).getName();
if (id == 140)
name = "Flower Pot";
if (name.length() == 0)
name = Clean(mat.toString());

View File

@ -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)
{

View File

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

View File

@ -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<String, PunishClient> _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<String, PunishClient>();
_clientManager = clientManager;
_repository = new PunishRepository(webServerAddress);
}
@ -256,4 +258,9 @@ public class Punish extends MiniPlugin
{
_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.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,10 +40,11 @@ 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)
{
@ -71,10 +71,8 @@ public class PunishPage extends CraftInventoryCustom implements Listener
PunishClient client = _plugin.GetClient(_target);
int chatOffenseCount = 0;
int advertisingCount = 0;
int exploitingCount = 0;
int hackingCount = 0;
int otherCount = 0;
List<Entry<Category, Punishment>> punishments = new ArrayList<Entry<Category, Punishment>>();
@ -87,65 +85,186 @@ public class PunishPage extends CraftInventoryCustom implements Listener
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);
_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(9, _chatOffenseButton.getHandle());
getInventory().setItem(11, _advertisingButton.getHandle());
getInventory().setItem(13, _exploitingButton.getHandle());
getInventory().setItem(15, _hackingButton.getHandle());
getInventory().setItem(17, _otherButton.getHandle());
getInventory().setItem(10, _chatOffenseButton.getHandle());
getInventory().setItem(12, _exploitingButton.getHandle());
getInventory().setItem(14, _hackingButton.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));
//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));
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));
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));
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(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));
}
}
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));
//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));
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));
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());
@ -153,6 +272,9 @@ public class PunishPage extends CraftInventoryCustom implements Listener
for (Entry<Category, Punishment> punishmentEntry : punishments)
{
if (punishmentEntry.getKey() == Category.Advertisement)
continue;
if (slot >= 54)
break;
@ -160,39 +282,96 @@ public class PunishPage extends CraftInventoryCustom implements Listener
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())
{
@ -255,7 +434,7 @@ 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<String>()
{
{
@Override
public void run(String result)
{
@ -272,6 +451,6 @@ public class PunishPage extends CraftInventoryCustom implements Listener
ClosePunish();
}
}
});
});
}
}

View File

@ -68,7 +68,7 @@ public class Hub extends JavaPlugin implements INautilusPlugin, IRelation
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);

View File

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

View File

@ -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<Player, DisguiseBase> _disguises = new HashMap<Player, DisguiseBase>();
private HashMap<Player, Block> _disguiseBlock = new HashMap<Player, Block>();
private HashMap<Player, Location> _disguiseMovement = new HashMap<Player, Location>();
@ -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") + "!"));
@ -395,29 +398,52 @@ 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));
long timeLeft = _gameTime - (System.currentTimeMillis() - GetStateTime());
SetState(GameState.End);
AnnounceEnd(_hiders);
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));
for (Player player : _hiders.GetPlayers(true))
AddGems(player, 10, "Winning Team", false);
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);
}
}
}
}

View File

@ -32,6 +32,7 @@ public class KitHiderShocker extends Kit
new Perk[]
{
new PerkShockingStrike()
},
EntityType.SLIME,
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.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

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