Skip to content

Instantly share code, notes, and snippets.

@AustinLMayes
Created February 25, 2014 00:20
Show Gist options
  • Save AustinLMayes/9200126 to your computer and use it in GitHub Desktop.
Save AustinLMayes/9200126 to your computer and use it in GitHub Desktop.
@EventHandler(priority = EventPriority.NORMAL)
public void onLogin(PlayerLoginEvent e) {
Player player = e.getPlayer();
List<Infraction> permanantBans = getInfractions(query, InfractionPacket.PunishmentType.PERMANANT_BAN);
if(!permanantBans.isEmpty()){
Infraction last = permanantBans.get(permanantBans.size() - 1);
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, ChatColor.DARK_RED + "Permanently Banned! " + ChatColor.GOLD + "» " + ChatColor.AQUA + last.getReason());
}
List<Infraction> tempBans = getInfractions(query, InfractionPacket.PunishmentType.BAN);
if(!tempBans.isEmpty()){
for (Infraction stringBan : tempBans) {
Infraction inf = stringBan;
if (!inf.getExpires().before(new Date()))
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, ChatColor.DARK_RED + "Temporary Banned! " + ChatColor.GOLD + "» " + ChatColor.AQUA + inf.getReason() + "\n" + ChatColor.YELLOW + "Expires: " + ChatColor.AQUA + inf.getExpires());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment