API
The EtriaBans API exists so other plugins may hook into EtriaBans to retrieve data. The API is added to from time to time, so I recommend that plugin developers come back and look at this page often if your project hooks into EtriaBans. Rarely will a method just disappear without notice, they will likely be deprecated for a newer alternative.
All Methods are located at the com.etriacraft.EtriaBans.Methods class.
Notes
- To prevent Null Pointers, it is always good to check if a player is banned / muted before doing anything with the data you plan to retrieve. If they aren't banned, don't run a method assuming they are.
Methods
- loadIPBans()
- This will load all IP bans. This is already done when EtriaBans is loaded, you should never have to use this method.
- loadBans()
- This will load all bans. this is already done when EtriaBans is loaded, you should never have to use this method.
- loadMutes()
- This will load all mutes. This is already done when EtriaBans is loaded, you should never have to use this method.
- getBannedPlayers()
- Returns a Set containing all of the names of banned players.
- getMutedPlayers()
- Returns a Set contaning all of the names of muted players.
- getBannedIPs()
- Returns a Set containing all banned IP addresses.
- banIP(String ip, String reason, String bannedby)
- This will ban an IP address for the specified reason by the specific user.
- getPlayersWithIP(String ip)
- Returns a set of all logged players with the specified IP address.
- isIPBanned(String ip)
- Checks if an IP is banned, returns true if it is banned, false if not.
- isBanned(String player)
- Checks if a player is banned, returns true if is banned, false if not.
- isMuted(String player)
- Checks if a player is muted, returns true if they are muted, false if not.
- isBanTemp(String player)
- Checks if a player's ban is temporary. Returns true if it is.
- isMuteTemp(String player)
- Checks if a player's mute is temporary. Returns true if it is.
- getBanReason(String player)
- Returns the reason for the current ban of a player. (Make sure the player is actually banned first).
- getMuteReason(String player)
- Returns the reason for the current mute of a player. (Make sure the player is actually banned first).
- banPlayer(String player, String reason, String banner)
- Bans a player (Not Temporary).
- tempBanPlayer(String player, String reason, String banner, int length)
- Length is in seconds. Temporarily bans a player.
- editBan(String player, int length)
- Edit the time on a ban.
- editMute(String player, int length)
- Edits the time on a mute.
- mutePlayer(String player, String reason, String muter)
- Mutes a player. (Not Temporary)
- tempMutePlayer(String player, String reason, String muter, int length)
- Temporarily Mutes a player. Length is in seconds.
- warnPlayer(String player, String warner, String reason)
- Give a player a warning. Make sure the player is online to warn.
- kickPlayer(String player, String kicker, String reason)
- Kicks a player from the server. Make sure the player is online to kick.
- logNewIP(String player, String ip)
- Logs info on a player who has not yet been logged in the eb_players table.
- updateIP(String player, String ip) {
- Updates the IP of a player that has already been logged.
- getLoggedIP(String player) {
- Returns the IP address as a String of a player. (They may be offline, returns null if the player is not in the eb_players table)
- checkMutes()
- Checks for expired Temp Mutes. Unmutes any that have expired.
- getAllBans()
- Returns all bans as a result set.
- getAllMutes()
- Returns all current mutes as a result set.
- getAllPreviousBans()
- Returns all previous bans as a result set.
- getAllPreviousMutes()
- Returns all previous mutes as a result set.
- getAllWarns()
- Returns all warnings as a result set.
- getAllKicks()
- Returns all kicks as a result set.
- getAlPlayerData()
- Returns everything in the eb_players table as a result set.
- getAllIPBans()
- Returns all IP Bans as a result set.
- importData()
- Imports all data in the exportedData.yml file to the database.
- exportData()
- Exports all data in the database to exportedData.yml.
- checkBans()
- Checks all Temp Bans to make sure that none have expired. Unbans expired bans.
- unbanPlayer(String player, String unbanner)
- Unbans a player.
- unMutePlayer(String player, String unmuter) {
- Unmutes a player.
- getCurrentDate()
- Returns the date formatted like so: yyyy/MM/dd HH:mm:ss as a String.
- getCurrentDateAsDate()
- Returns the current date formatted like so: yyy/MM/dd HH:mm:ss as a Date Object.
- getUnbanDate(String player)
- Returns the date a player is set to be unbanned. (Make sure the player is temp banned first)
- getUnmuteDate(String player)
- Returns the date a player is set to be unmuted. Make sure the player is temp muted first.
The rest of this page will be filled out soon
Comments