1 package net.pterodactylus.xdcc.core;
3 import static java.lang.System.currentTimeMillis;
4 import static java.util.concurrent.TimeUnit.HOURS;
6 import java.util.HashMap;
9 import net.pterodactylus.xdcc.data.Channel;
12 * Manages banned channels and their re-join times.
14 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
16 public class ChannelBanManager {
18 private static final long BAN_TIME = HOURS.toMillis(24);
19 private final Map<Channel, Long> channelBanTimes = new HashMap<>();
21 public boolean isBanned(Channel channel) {
22 return channelBanTimes.containsKey(channel)
23 && ((currentTimeMillis() - channelBanTimes.get(channel))
27 public void ban(Channel channel) {
28 channelBanTimes.put(channel, currentTimeMillis());
31 public void unban(Channel channel) {
32 channelBanTimes.remove(channel);