Skip to main content

Introduction

What is JDash?

JDash is a fast, reactive and un-opinionated Geometry Dash API wrapper for Java. This library aims at providing Java developers tools to deal with game data in the highest standards of quality and developer experience.

Overview

JDash is a multi-module library requiring JDK 17 or above since version 5.0.0. There are currently 4 modules.

JDash Client module

Provides a high-level client to request data from Geometry Dash servers. It is powered by Project Reactor which allows to make requests in an efficient and non-blocking manner with backpressure handling (requests are queued internally and processed when resources are available, allowing requests to fail-fast in case the queue is full).

GDClient client = GDClient.create();

// Block until request completes
GDLevel level = client.findLevelById(10565740).block();
System.out.println(level);

// But we can also choose to make it asychronous and non-blocking
client.getUserProfile(98006).subscribe(System.out::println); // will not block

Maven dependency:

<dependency>
<groupId>com.alex1304.jdash</groupId>
<artifactId>jdash-client</artifactId>
<version>${version}</version> <!-- replace with latest version -->
</dependency>

JDash Events module

Provides an event loop that can be subscribed to in order to periodically send requests with a GDClient and emit events when changes are detected on the server. It comes with default implementations that can detect when new levels or lists get rated, and when the Daily level or Weekly demon changes. You may also implement your own events with the GDEventProducer interface.

GDClient client = GDClient.create();
GDEventLoop eventLoop = GDEventLoop.startWithDefaults(client);

eventLoop.on(AwardedLevelAdd.class)
.subscribe(event -> System.out.println("New level rated: "
+ event.addedLevel().name()));

eventLoop.on(DailyLevelChange.class)
.subscribe(event -> System.out.println("New Daily level: "
+ event.after().name()));

Maven dependency:

<dependency>
<groupId>com.alex1304.jdash</groupId>
<artifactId>jdash-events</artifactId>
<version>${version}</version> <!-- replace with latest version -->
</dependency>

JDash Graphics module

Allows to generate player icons and level difficulty icons from game assets.

Example 1: Generate an arbitrary player icon

IconRenderer renderer = IconRenderer.load(IconType.SPIDER, 15);
ColorSelection color = new ColorSelection(12, 9, OptionalInt.of(9));
BufferedImage output = renderer.render(color);

icon

Example 2: Generate the full icon set of a GDUserProfile

GDClient client = GDClient.create();
GDUserProfile user = client.getUserProfile(98006).block();
IconSetFactory factory = IconSetFactory.forUser(user);
BufferedImage output = factory.createIconSet();

icon

Example 3: Generate an arbitrary difficulty icon

BufferedImage image = DifficultyRenderer.create(DemonDifficulty.EASY)
.withMoons(10)
.withQualityRating(QualityRating.LEGENDARY)
.render();

icon

Example 4: Generate the difficulty icon of a GDLevel

GDClient client = GDClient.create();
GDLevel level = client.findLevelById(10565740).block();
BufferedImage image = DifficultyRenderer.forLevel(level).render();

icon

Maven dependency:

<dependency>
<groupId>com.alex1304.jdash</groupId>
<artifactId>jdash-graphics</artifactId>
<version>${version}</version> <!-- replace with latest version -->
</dependency>

JDash Common module

Contains utility classes and data types to encode the different entities of Geometry Dash (levels, users...) required by all other modules.

If you are already using one of the other modules, you don't need to add this dependency as other modules transitively require it.

<dependency>
<groupId>com.alex1304.jdash</groupId>
<artifactId>jdash-common</artifactId>
<version>${version}</version> <!-- replace with latest version -->
</dependency>

Read the next guides to have more in-depth understanding on each of the modules described above.