API

How to use EpicGuard's API.

Adding Gradle/Maven dependency

EpicGuard's artifacts are distributed on JitPack so you have to also add it as a repository.

Gradle Setup (build.gradle)

repositories {
maven {
url 'https://jitpack.io'
}
}
dependencies {
compileOnly 'com.github.xxneox.EpicGuard:epicguard-core:6.0.0'
}

Maven Setup (pom.xml)

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.xxneox.EpicGuard</groupId>
<artifactId>epicguard-core</artifactId>
<version>6.0.0</version>
</dependency>
</dependencies>

Accessing the API

Make sure that EpicGuard is fully loaded before using any methods from the API. While you can obtain the instance of EpicGuardAPI, trying to use any methods will throw an exception, if EpicGuard is not initialized yet.
The EpicGuardAPI class is located in the me.xneox.epicguard.core package. This is how you can obtain an instance of the API.
EpicGuardAPI api = EpicGuardAPI.INSTANCE;

API methods

Here are the methods available for use. If you feel like there's something missing in here, contact us in our support Discord.
/**
* The {@link GeoManager} class contains methods that you may
* find useful if you want to check country/city of an address.
*/
@Nonnull
public GeoManager getGeoManager()
/**
* @return true if server is under attack, false if not.
*/
public boolean isUnderAttack()
/**
* @return An immutable Collection which contains whitelisted addresses.
*/
@Nonnull
public Collection<String> getWhitelistedAddresses()
/**
* @return An immutable Collection which contains blacklisted addresses.
*/
@Nonnull
public Collection<String> getBlacklistedAddresses()
/**
* @return An immutable Collection which contains whitelisted nicknames.
*/
@Nonnull
public Collection<String> getWhitelistedNicknames()
/**
* @return An immutable Collection which contains blacklisted nicknames.
*/
@Nonnull
public Collection<String> getBlacklistedNicknames()
/**
* @return Current connections per second.
*/
public int getConnectionsPerSecond()
/**
* Adds the provided address to blacklist, if it is not already there.
*/
public void blacklistAddress(String address)
/**
* Adds the provided address to whitelist.
* Also, removes the address from blacklist.
*/
public void whitelistAddress(String address)
/**
* Checks if the EpicGuard has been initialized already.
*/
public void isAvailable()
Last modified 2yr ago