Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.

Commit 8c782f5

Browse files
2 parents f35dbcc + adc03f5 commit 8c782f5

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

.github/workflows/gradle.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ jobs:
1616
- name: Checkout repository
1717
uses: actions/checkout@v4
1818

19-
- name: Set up JDK 17
19+
- name: Set up JDK 21
2020
uses: actions/setup-java@v4
2121
with:
2222
distribution: 'adopt'
23-
java-version: '17'
23+
java-version: '21'
2424

2525
- name: Cache Gradle packages
2626
uses: actions/cache@v4

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@ All endpoints and response types remain the same as in the plugin.
88

99
>[!Note]
1010
> This server does not contain game state implementation and cannot be used for full-fledged gameplay.
11+
>
12+
13+
## Retrieving Data
14+
`GET /code/<6-digit code>`
15+
After the user receives the code, you should send a request to the API endpoint, which will return data about the Minecraft account.
16+
The code is valid only once and for 5 minutes (by default) after it is received. After this time, the code is deleted.
17+
18+
**Example of a Successful Response:**
19+
```json
20+
{
21+
"nickname": "AndcoolSystems",
22+
"UUID": "1420c63c-b111-4453-993f-b3479ba1d4c6",
23+
"status": "success"
24+
}
25+
```
1126

1227
## Detailed description
1328

src/main/java/com/andcool/handlers/API/APIHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ public void handle(HttpExchange exchange) throws IOException {
2525
if (matcher.matches()) {
2626
String code = matcher.group(1);
2727
JSONObject result = OAuthServer.expiringMap.get(code);
28-
if (result == null){
28+
if (result == null) {
2929
JSONObject jsonResponse = new JSONObject();
3030
jsonResponse.put("status", "error");
3131
jsonResponse.put("message", "Code not found");
3232
jsonResponse.put("status_code", 404);
3333
response = jsonResponse.toString();
3434
status_code = 404;
35-
}else{
35+
} else {
3636
response = result.toString();
3737
OAuthServer.expiringMap.remove(code);
3838
}

src/main/java/com/andcool/handlers/HandshakeHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static void handleHandshake(ChannelHandlerContext ctx, ByteBuf in, Sessio
2222
session.protocolVersion = protocolVersion;
2323
session.loginPhase = 1;
2424
session.nextState = nextState;
25-
switch (nextState){
25+
switch (nextState) {
2626
case 1 -> PingResponse.sendPingResponse(ctx, UserConfig.PROTOCOL_VERSION == -1 ? protocolVersion : UserConfig.PROTOCOL_VERSION);
2727
case 2 -> LoginStartHandler.handleLoginStart(ctx, in, session);
2828
}

src/main/java/com/andcool/pipeline/EncryptionRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static void sendEncryptionRequest(ChannelHandlerContext ctx, int protocol
2121
ByteBufUtils.writeVarInt(out, OAuthServer.VERIFY_TOKEN.length);
2222
out.writeBytes(OAuthServer.VERIFY_TOKEN);
2323

24-
if (protocolVersion >= 766) {
24+
if (protocolVersion >= 766) {
2525
out.writeBoolean(true);
2626
}
2727

0 commit comments

Comments
 (0)