Class AnticheatManager
- All Implemented Interfaces:
ChatPluginManager
AnticheatIntegration
's Violation
s.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
addViolation
(OfflinePlayer cheater, IntegrationType<AnticheatIntegration> anticheat, String cheatID, String component, String server, int amount, int ping, double tps, VersionUtils.Version version) Adds a violation togetViolations()
.abstract void
clearViolations
(OfflinePlayer cheater) Clears violations for the specified player.static AnticheatManager
Gets this manager's instance.Gets the list of strings a punishment's reason has to start with to be considered created automatically by the anticheat.Gets current violations' map.getViolations
(OfflinePlayer player) Gets a list of violations fromgetViolations()
.long
Gets the time required for a violation to expire, in milliseconds.abstract boolean
isAnticheatReason
(String reason) Checks if the specified punishment's reason is contained ingetReasonsStartWith()
.boolean
Checks if this manager is enabled.abstract void
removeViolation
(OfflinePlayer cheater, IntegrationType<AnticheatIntegration> anticheat, String cheatID) Removes a violation fromgetViolations()
.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface me.remigio07.chatplugin.api.common.util.manager.ChatPluginManager
checkAvailability, isReloadable, load, reload, unload
-
Constructor Details
-
AnticheatManager
public AnticheatManager()
-
-
Method Details
-
isEnabled
public boolean isEnabled()Checks if this manager is enabled.Will return
IntegrationManager.isAtLeastOneAnticheatEnabled()
.- Specified by:
isEnabled
in interfaceChatPluginManager
- Returns:
- Whether this manager is enabled
-
getViolations
Gets current violations' map.Every entry is composed of a player and the list of their
Violation
s.Do not modify the returned map. Use
addViolation(OfflinePlayer, IntegrationType, String, String, String, int, int, double, Version)
,removeViolation(OfflinePlayer, IntegrationType, String)
andclearViolations(OfflinePlayer)
to interact with it.- Returns:
- Current violations' map
-
getViolations
Gets a list of violations fromgetViolations()
.Will return
Collections.emptyList()
ifgetViolations()
does not contain the specified player.Do not modify the returned list. Use
addViolation(OfflinePlayer, IntegrationType, String, String, String, int, int, double, Version)
,removeViolation(OfflinePlayer, IntegrationType, String)
andclearViolations(OfflinePlayer)
to interact with it.- Parameters:
player
- Player to check- Returns:
- Player's current violations
-
getReasonsStartWith
Gets the list of strings a punishment's reason has to start with to be considered created automatically by the anticheat.Found at: "settings.anticheat-integration.reasons-start-with" in
ConfigurationType.CONFIG
- Returns:
- Anticheat integration's reasons
-
getViolationsExpirationTimeout
public long getViolationsExpirationTimeout()Gets the time required for a violation to expire, in milliseconds.Found at: "settings.anticheat-integration.violations-expiration-timeout" in
ConfigurationType.CONFIG
- Returns:
- Violations' expiration timeout
-
getInstance
Gets this manager's instance.- Returns:
- Manager's instance
-
addViolation
public abstract void addViolation(OfflinePlayer cheater, IntegrationType<AnticheatIntegration> anticheat, String cheatID, String component, String server, int amount, int ping, double tps, VersionUtils.Version version) Adds a violation togetViolations()
.- Parameters:
cheater
- Violation's cheateranticheat
- Anticheat that flagged the playercheatID
- Violation's cheat's IDcomponent
- Violation's cheat's display nameserver
- Violation's origin serveramount
- Amount of times the player got flaggedping
- Cheater's pingtps
- Origin server's TPSversion
- Cheater's version
-
removeViolation
public abstract void removeViolation(OfflinePlayer cheater, IntegrationType<AnticheatIntegration> anticheat, String cheatID) Removes a violation fromgetViolations()
.- Parameters:
cheater
- Violation's cheateranticheat
- Anticheat that flagged the playercheatID
- Violation's cheat's ID
-
clearViolations
Clears violations for the specified player.- Parameters:
cheater
- Player to clear the violations for
-
isAnticheatReason
Checks if the specified punishment's reason is contained ingetReasonsStartWith()
.Case will be lowered and colors will be stripped using
ChatColor.stripColor(String)
.Will return
false
ifreason == null
.- Parameters:
reason
- Punishment's reason- Returns:
- Whether the reason is an anticheat's reason
-