// Path: bukkit/src/main/java/me/leoko/advancedban/bukkit/event/PunishmentEvent.java
// public class PunishmentEvent extends Event {
// 	
//     private static final HandlerList handlers = new HandlerList();
//     
//     private final Punishment punishment;
// 
//     public PunishmentEvent(Punishment punishment) {
//         super(false);
//         this.punishment = punishment;
//     }
// 
//     public static HandlerList getHandlerList() {
//         return handlers;
//     }
// 
//     @Override
//     public HandlerList getHandlers() {
//         return handlers;
//     }
// 
//     public Punishment getPunishment() {
//         return this.punishment;
//     }
// }
// 
// Path: bukkit/src/main/java/me/leoko/advancedban/bukkit/event/RevokePunishmentEvent.java
// public class RevokePunishmentEvent extends Event {
//     private static final HandlerList handlers = new HandlerList();
//     private final Punishment punishment;
//     private final boolean massClear;
// 
//     public RevokePunishmentEvent(Punishment punishment, boolean massClear) {
//         super(false);
//         this.punishment = punishment;
//         this.massClear = massClear;
//     }
// 
//     public Punishment getPunishment() {
//         return punishment;
//     }
// 
//     public boolean isMassClear() {
//         return massClear;
//     }
// 
//     public static HandlerList getHandlerList() {
//         return handlers;
//     }
// 
//     @Override
//     public HandlerList getHandlers() {
//         return handlers;
//     }
// }
// 
// Path: core/src/main/java/me/leoko/advancedban/utils/PunishmentType.java
// public enum PunishmentType {
//     BAN("Ban", null, false, "ab.ban.perma"),
//     TEMP_BAN("Tempban", BAN, true, "ab.ban.temp"),
//     IP_BAN("Ipban", BAN, false, "ab.ipban.perma"),
//     TEMP_IP_BAN("Tempipban", BAN, true, "ab.ipban.temp"),
//     MUTE("Mute", null, false, "ab.mute.perma"),
//     TEMP_MUTE("Tempmute", MUTE, true, "ab.mute.temp"),
//     WARNING("Warn", null, false, "ab.warn.perma"),
//     TEMP_WARNING("Tempwarn", WARNING, true, "ab.warn.temp"),
//     KICK("Kick", null, false, "ab.kick.use"),
//     NOTE("Note", null, false, "ab.note.use");
// 
//     private final String name;
//     private final String perms;
//     private final PunishmentType basic;
//     private final boolean temp;
// 
//     PunishmentType(String name, PunishmentType basic, boolean temp, String perms) {
//         this.name = name;
//         this.basic = basic;
//         this.temp = temp;
//         this.perms = perms;
//     }
// 
//     public static PunishmentType fromCommandName(String cmd) {
//         switch (cmd) {
//             case "ban":
//                 return BAN;
//             case "tempban":
//                 return TEMP_BAN;
//             case "ban-ip":
//             case "banip":
//             case "ipban":
//                 return IP_BAN;
//             case "tempipban":
//             case "tipban":
//                 return TEMP_IP_BAN;
//             case "mute":
//                 return MUTE;
//             case "tempmute":
//                 return TEMP_MUTE;
//             case "warn":
//                 return WARNING;
//             case "note":
//                 return NOTE;
//             case "tempwarn":
//                 return TEMP_WARNING;
//             case "kick":
//                 return KICK;
//             default:
//                 return null;
//         }
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public String getPerms() {
//         return perms;
//     }
// 
//     public boolean isTemp() {
//         return temp;
//     }
// 
//     public String getConfSection(String path) {
//         return name+"."+path;
//     }
// 
//     public PunishmentType getBasic() {
//         return basic == null ? this : basic;
//     }
// 
//     public PunishmentType getPermanent() {
//         if(this == IP_BAN || this == TEMP_IP_BAN)
//             return IP_BAN;
// 
//         return getBasic();
//     }
// 
//     public boolean isIpOrientated() {
//         return this == IP_BAN || this == TEMP_IP_BAN;
//     }
// }


import me.leoko.advancedban.bukkit.event.PunishmentEvent;
import me.leoko.advancedban.bukkit.event.RevokePunishmentEvent;
import me.leoko.advancedban.utils.PunishmentType;
import org.bukkit.BanList;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import java.util.Date;
package me.leoko.advancedban.bukkit.listener;



/**
 *
 * @author Beelzebu
 */
public class InternalListener implements Listener {
    
    @EventHandler
    public void onPunish(PunishmentEvent e) {
        BanList banlist;
        if (e.getPunishment().getType().equals(PunishmentType.BAN) || e.getPunishment().getType().equals(PunishmentType.TEMP_BAN)) {
            banlist = Bukkit.getBanList(BanList.Type.NAME);
            banlist.addBan(e.getPunishment().getName(), e.getPunishment().getReason(), new Date(e.getPunishment().getEnd()), e.getPunishment().getOperator());
        } else if (e.getPunishment().getType().equals(PunishmentType.IP_BAN) || e.getPunishment().getType().equals(PunishmentType.TEMP_IP_BAN)) {
            banlist = Bukkit.getBanList(BanList.Type.IP);
            banlist.addBan(e.getPunishment().getName(), e.getPunishment().getReason(), new Date(e.getPunishment().getEnd()), e.getPunishment().getOperator());
        }
    }
    
    @EventHandler
// Path: bukkit/src/main/java/me/leoko/advancedban/bukkit/event/PunishmentEvent.java
// public class PunishmentEvent extends Event {
// 	
//     private static final HandlerList handlers = new HandlerList();
//     
//     private final Punishment punishment;
// 
//     public PunishmentEvent(Punishment punishment) {
//         super(false);
//         this.punishment = punishment;
//     }
// 
//     public static HandlerList getHandlerList() {
//         return handlers;
//     }
// 
//     @Override
//     public HandlerList getHandlers() {
//         return handlers;
//     }
// 
//     public Punishment getPunishment() {
//         return this.punishment;
//     }
// }
// 
// Path: bukkit/src/main/java/me/leoko/advancedban/bukkit/event/RevokePunishmentEvent.java
// public class RevokePunishmentEvent extends Event {
//     private static final HandlerList handlers = new HandlerList();
//     private final Punishment punishment;
//     private final boolean massClear;
// 
//     public RevokePunishmentEvent(Punishment punishment, boolean massClear) {
//         super(false);
//         this.punishment = punishment;
//         this.massClear = massClear;
//     }
// 
//     public Punishment getPunishment() {
//         return punishment;
//     }
// 
//     public boolean isMassClear() {
//         return massClear;
//     }
// 
//     public static HandlerList getHandlerList() {
//         return handlers;
//     }
// 
//     @Override
//     public HandlerList getHandlers() {
//         return handlers;
//     }
// }
// 
// Path: core/src/main/java/me/leoko/advancedban/utils/PunishmentType.java
// public enum PunishmentType {
//     BAN("Ban", null, false, "ab.ban.perma"),
//     TEMP_BAN("Tempban", BAN, true, "ab.ban.temp"),
//     IP_BAN("Ipban", BAN, false, "ab.ipban.perma"),
//     TEMP_IP_BAN("Tempipban", BAN, true, "ab.ipban.temp"),
//     MUTE("Mute", null, false, "ab.mute.perma"),
//     TEMP_MUTE("Tempmute", MUTE, true, "ab.mute.temp"),
//     WARNING("Warn", null, false, "ab.warn.perma"),
//     TEMP_WARNING("Tempwarn", WARNING, true, "ab.warn.temp"),
//     KICK("Kick", null, false, "ab.kick.use"),
//     NOTE("Note", null, false, "ab.note.use");
// 
//     private final String name;
//     private final String perms;
//     private final PunishmentType basic;
//     private final boolean temp;
// 
//     PunishmentType(String name, PunishmentType basic, boolean temp, String perms) {
//         this.name = name;
//         this.basic = basic;
//         this.temp = temp;
//         this.perms = perms;
//     }
// 
//     public static PunishmentType fromCommandName(String cmd) {
//         switch (cmd) {
//             case "ban":
//                 return BAN;
//             case "tempban":
//                 return TEMP_BAN;
//             case "ban-ip":
//             case "banip":
//             case "ipban":
//                 return IP_BAN;
//             case "tempipban":
//             case "tipban":
//                 return TEMP_IP_BAN;
//             case "mute":
//                 return MUTE;
//             case "tempmute":
//                 return TEMP_MUTE;
//             case "warn":
//                 return WARNING;
//             case "note":
//                 return NOTE;
//             case "tempwarn":
//                 return TEMP_WARNING;
//             case "kick":
//                 return KICK;
//             default:
//                 return null;
//         }
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public String getPerms() {
//         return perms;
//     }
// 
//     public boolean isTemp() {
//         return temp;
//     }
// 
//     public String getConfSection(String path) {
//         return name+"."+path;
//     }
// 
//     public PunishmentType getBasic() {
//         return basic == null ? this : basic;
//     }
// 
//     public PunishmentType getPermanent() {
//         if(this == IP_BAN || this == TEMP_IP_BAN)
//             return IP_BAN;
// 
//         return getBasic();
//     }
// 
//     public boolean isIpOrientated() {
//         return this == IP_BAN || this == TEMP_IP_BAN;
//     }
// }


// Path: bukkit/src/main/java/me/leoko/advancedban/bukkit/listener/InternalListener.java
import me.leoko.advancedban.bukkit.event.PunishmentEvent;
import me.leoko.advancedban.bukkit.event.RevokePunishmentEvent;
import me.leoko.advancedban.utils.PunishmentType;
import org.bukkit.BanList;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import java.util.Date;

package me.leoko.advancedban.bukkit.listener;



/**
 *
 * @author Beelzebu
 */
public class InternalListener implements Listener {
    
    @EventHandler
    public void onPunish(PunishmentEvent e) {
        BanList banlist;
        if (e.getPunishment().getType().equals(PunishmentType.BAN) || e.getPunishment().getType().equals(PunishmentType.TEMP_BAN)) {
            banlist = Bukkit.getBanList(BanList.Type.NAME);
            banlist.addBan(e.getPunishment().getName(), e.getPunishment().getReason(), new Date(e.getPunishment().getEnd()), e.getPunishment().getOperator());
        } else if (e.getPunishment().getType().equals(PunishmentType.IP_BAN) || e.getPunishment().getType().equals(PunishmentType.TEMP_IP_BAN)) {
            banlist = Bukkit.getBanList(BanList.Type.IP);
            banlist.addBan(e.getPunishment().getName(), e.getPunishment().getReason(), new Date(e.getPunishment().getEnd()), e.getPunishment().getOperator());
        }
    }
    
    @EventHandler
    public void onRevokePunishment(RevokePunishmentEvent e) {