import java.io.*; public class ChannelUser implements Serializable { /** * Stores this channel user's hostname */ private String hostName; /** * Stores this channel user's nickname */ private String nickName; /** * Stores whether or not a user is warned * If a user is kicked once for spamming, they will be put on a timed mute and warned (this will be set to true) * If a user spams again after the timed mute and warning, they will be kickbanned, and set to be autokicked */ private boolean warned = false; /** * If a user joins and this is true, they will be automatically kicked and banned */ private boolean autoKicked = false; /** * If this is true, the bot will deop this user should they get operator */ private boolean allowOp = true; /** * If this is true, the bot will devoice this user if they get voiced */ private boolean allowVoice = true; /** * This is the time that the last line was sent from a user. * It will be set every 3 lines, and when the third line is done, it will be compared to the time the third line is sent * If 3 or more lines have been pasted in 1 to 2 seconds (eg, they've pasted something) it will temp mute them and warn them */ private long lastLineTime; /** * Keeps track of the current number of lines sent by a user */ private int lineCount; public ChannelUser(String hostName, String nickName) { this.hostName = hostName; this.nickName = nickName; } public String getHostName() { return hostName; } public String getNickName() { return nickName; } public void setNickName(String nickName) { this.nickName = nickName; } /** * Sets whether a user is warned */ public void setIsWarned(boolean warned) { this.warned = warned; } /** * Checks if a user has been warned - action taken by the bot depends on this */ public boolean getUserWarned() { return warned; } /** * Sets a user to be autokicked if they join the channel */ public void setAutoKick(boolean autoKicked) { this.autoKicked = autoKicked; } /** * Checks whether this user is meant to be autokicked or not upon joining the channel * If true, the bot will kick and ban the user */ public boolean getUserAutoKicked() { return autoKicked; } /** * Sets whether or not this user is allowed to become an operator in a channel at any time */ public void setAllowOp(boolean allowOp) { this.allowOp = allowOp; } /** * Checks to see if a user that just received op is allowed to have it - if not the bot will deop that user */ public boolean getCanHaveOp() { return allowOp; } /** * Sets whether or not a user is allowed to be voiced */ public void setAllowVoice(boolean allowVoice) { this.allowVoice = allowVoice; } /** * Checks to see if a user can have voice - if they can't, the bot will devoice them */ public boolean getCanHaveVoice() { return allowVoice; } /** * Checks the time that the first of 3 consecutive lines is sent * Used to stop channel flooding */ public long getLastLineTime() { return lastLineTime; } /** * Sets the lastLineTime when the first of 3 lines are sent to the server * This is used to stop flooding */ public void setLastLineTime(long lastLineTime) { this.lastLineTime = lastLineTime; } /** * Gets the current amount of lines that a user has sent to the channel */ public int getLineCount() { return lineCount; } /** * Adds to the lines - this is reset after every third line */ public void addToCount() { lineCount++; } /** * Resets the number of lines */ public void resetLineCount() { lineCount = 0; } }