Class RateLimiter

java.lang.Object
com.cryptomorin.xseries.profiles.mojang.RateLimiter

@Internal public final class RateLimiter extends Object
Used for MojangAPI requests. The rate limits make things difficult specially in BungeeCord servers where a single dedicated server is used for multiple subservers. This will specially not work well at all if in shared hosting that can make requests almost impossible with all the servers in a single node. Another issue is that XSeries is mostly intended to be shaded by individual plugins so while we are directly helping the internal Mojang cache, there are some requests that Mojang doesn't have a cache for, so this creates another big problem of having to use separate caches that are not shared.

However, these are all untested speculation. But one can't imagine how else they'd identify a request other than the sender's IP because the default client used by Mojang doesn't even use a User-Agent. According to a comment by a Mojang web service admin in this JIRA issue shared VPS are indeed an issue due to shared IPs.

According to Mojang API the rate limit is around 600 requests per 10 (i.e. 1 request per second) for most endpoints. However UUID to Profile and Skin/Cape is around 200 requests per minute.

  • Method Details

    • getRemainingRequests

      public int getRemainingRequests()
    • getEffectiveRequestsCount

      public int getEffectiveRequestsCount()
    • instantRateLimit

      public void instantRateLimit()
    • acquire

      public boolean acquire()
    • timeUntilNextFreeRequest

      public Duration timeUntilNextFreeRequest()
    • acquireOrWait

      public void acquireOrWait()
    • toString

      public String toString()
      Overrides:
      toString in class Object