---
description: This page explains some things about the name similarity check.
---

# Name similarity check

{% hint style="warning" %}
This check is currently experimental, and disabled by default.
{% endhint %}

NameSimilarity is a new check implemented in the 6.0 version. It compares the nickname of the currently connecting player, with other nicknames in connection history.

It uses the [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) algorithm to measure the distance between two strings (nicknames).

EpicGuard uses the Apache Commons Text library and [their implementation of this algorithm](https://commons.apache.org/proper/commons-text/apidocs/org/apache/commons/text/similarity/LevenshteinDistance.html#apply-java.lang.CharSequence-java.lang.CharSequence-) for this check.

The smaller the distance value, the similar the strings are. Here, you can see some examples. Note that EpicGuard skips checking identical strings to avoid detecting the same player who only just rejoined the server.

```java
 distance.apply("aaapppp", "")       = 7
 distance.apply("frog", "fog")       = 1
 distance.apply("fly", "ant")        = 3
 distance.apply("elephant", "hippo") = 7
 distance.apply("hippo", "elephant") = 7
 distance.apply("hippo", "zzzzzzzz") = 8
 distance.apply("hello", "hallo")    = 1
```

### Check configuration

```yaml
# NameSimilarityCheck will detect similar nicknames of the connecting users
# (!) Experimental! See wiki for more information.
name-similarity-check {
    # NEVER - check is disabled.
    # ATTACK - check will be performed only during bot-attack.
    # ALWAYS - check will be always performed.
    check-mode=ALWAYS
    # The lower the distance, the similar the names.
    # If the distance detected is lower or same as configured here,
    # it will be considered as a positive detection.
    # Values below 1 are ignored, as it means identical name.
    distance=-1
    # How many nicknames should be keep in the history?
    # When an user is connecting to the server, his nickname will be added to the history.
    # Then the nickname will be compared with other nicknames stored in the history.
    # (!) Requires restart to apply.
    history-size=10
}
```
