Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6aec560
New snapshot version.
LM-Wolfert Apr 20, 2026
7ccf999
Merge remote-tracking branch 'origin/main' into develop
LM-Wolfert Apr 22, 2026
63ebb09
Base api implementation and new database indexes on relevant columns.
LM-Wolfert May 3, 2026
1039f01
Allow player skin to be null when creating a user, other issues will …
LM-Wolfert May 8, 2026
635c93e
Update the player skin in the database when a recurring user connects.
LM-Wolfert May 8, 2026
1d8d94f
Fix version in plugin.
LM-Wolfert Jun 2, 2026
04223f1
Fix SQL update for player skin.
LM-Wolfert Jun 2, 2026
0548541
Add generated sources so it is automatically recognised.
LM-Wolfert Jun 6, 2026
89f88a9
Add DTO's
LM-Wolfert Jun 6, 2026
e4b4547
Fix compilation issues for the api.
LM-Wolfert Jun 7, 2026
32cc719
Correct snapshot version.
LM-Wolfert Jun 7, 2026
39a99b2
Merge pull request #35 from BuildtheUK/feature/handle-create-user-fail
LM-Wolfert Jun 14, 2026
3c167a0
added 2 endpoints on the API for sending a player a message and getti…
Jul 12, 2026
ad616e5
created new endpoints for buildings. (AI gen mostly but have been tes…
Jul 22, 2026
70c4910
updated the grid cell count to return more info
Jul 24, 2026
54d1c1e
Merge branch 'develop' into feature/proxy-api
AMgr8 Jul 24, 2026
ed4e828
updated the opanapi.yaml so that it has the correct production url
Jul 24, 2026
4cd77f3
fixed issue
AMgr8 Jul 25, 2026
74a34b3
Bump version
george112n Jul 25, 2026
22c13b3
Merge pull request #38 from BuildtheUK/feature/proxy-api
AMgr8 Jul 27, 2026
2604a16
bumped version in a couple more places. fixed an error that shouldn't…
Jul 27, 2026
f0b7bf5
Update proxy to latest networklib version.
LM-Wolfert Aug 2, 2026
9dac81b
Revert move of ProxyController to plugin module.
LM-Wolfert Aug 2, 2026
adf2d9e
Added app module for the ProxyController to separate concerns.
LM-Wolfert Aug 2, 2026
090192b
Add app module to jitpack config.
LM-Wolfert Aug 2, 2026
7f3947a
Downgrade plugin version to work with jitpack default maven version.
LM-Wolfert Aug 2, 2026
875a7d5
Add maven wrapper to ensure correct maven version.
LM-Wolfert Aug 2, 2026
c9f66b7
Use maven wrapper in jitpack.
LM-Wolfert Aug 2, 2026
a938d2d
Add mvnw
LM-Wolfert Aug 2, 2026
d80e385
Fix mvnw permission
LM-Wolfert Aug 2, 2026
1e5b50c
Update server pinging to retry for 30 seconds.
LM-Wolfert Aug 15, 2026
90ff77b
Add the /map command back to discord for displaying the progress map.…
LM-Wolfert Aug 15, 2026
bedc1a2
Support multi-word phrases and handle punctuation in the auto mod rul…
LM-Wolfert Aug 16, 2026
fdafdec
Automod also applies to MC messages sent to discord.
LM-Wolfert Aug 16, 2026
b656eb7
Merge remote-tracking branch 'origin/proxy-api-hotfix' into feature/u…
LM-Wolfert Aug 16, 2026
f48cc24
Add /website command.
LM-Wolfert Aug 16, 2026
b209984
Only send player messages to discord
LM-Wolfert Aug 16, 2026
5716a7f
Fix issue where player was seen as disconnected when restarting a ser…
LM-Wolfert Aug 17, 2026
9755218
Review comments.
LM-Wolfert Aug 18, 2026
b84561e
Improve speed of getMatches method.
LM-Wolfert Aug 18, 2026
5d538c4
Ensure no duplicate disconnect tasks exist but cancelling the previou…
LM-Wolfert Aug 18, 2026
96d4be8
Merge pull request #39 from BuildtheUK/feature/update-networklib
LM-Wolfert Aug 18, 2026
2385a3d
Fix pom for maven compiler plugin.
LM-Wolfert Aug 19, 2026
2749ad3
Fix java version in jitpack config.
LM-Wolfert Aug 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# User-specific stuff
.idea/

*.iml
*.ipr
*.iws

# IntelliJ
out/

# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

target/

pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next

release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
.flattened-pom.xml

# Common working directory
run/

.junie
3 changes: 3 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
wrapperVersion=3.3.4
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
124 changes: 124 additions & 0 deletions api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.btuk</groupId>
<artifactId>Proxy</artifactId>
<version>1.13.0-SNAPSHOT</version>
</parent>

<groupId>org.btuk.proxy</groupId>
<artifactId>api</artifactId>
<name>Proxy API</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<openapi-generator.version>7.4.0</openapi-generator.version>
<build-helper-maven-plugin.version>3.6.0</build-helper-maven-plugin.version>
<jakarta-ws-rs-api.version>3.1.0</jakarta-ws-rs-api.version>
<jersey.version>3.1.5</jersey.version>
<grizzly.version>4.0.2</grizzly.version>
</properties>

<dependencies>
<dependency>
<groupId>org.btuk.proxy</groupId>
<artifactId>database</artifactId>
</dependency>

<dependency>
<groupId>org.btuk.proxy</groupId>
<artifactId>core</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>${jakarta-ws-rs-api.version}</version>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>2.1.1</version>
<scope>provided</scope>
</dependency>

<!-- Jersey + Grizzly for API -->
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-http</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${openapi-generator.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec>
<generatorName>jaxrs-spec</generatorName>
<apiPackage>org.btuk.proxy.api</apiPackage>
<modelPackage>org.btuk.proxy.api.model</modelPackage>
<configOptions>
<interfaceOnly>true</interfaceOnly>
<useTags>true</useTags>
<returnResponse>true</returnResponse>
<useJakartaEe>true</useJakartaEe>
<generatePom>false</generatePom>
<useSwaggerAnnotations>false</useSwaggerAnnotations>
<openApiNullable>false</openApiNullable>
<useBeanValidation>false</useBeanValidation>
<performBeanValidation>false</performBeanValidation>
</configOptions>
<generateSupportingFiles>false</generateSupportingFiles>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${build-helper-maven-plugin.version}</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/openapi/src/gen/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
106 changes: 106 additions & 0 deletions api/src/main/java/org/btuk/proxy/api/impl/BuildingsApiImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
package org.btuk.proxy.api.impl;

import jakarta.inject.Inject;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.Response;
import org.btuk.proxy.api.BuildingsApi;
import org.btuk.proxy.api.model.Building;
import org.btuk.proxy.api.model.BuildingCount;
import org.btuk.proxy.api.model.BuildingGridResponse;
import org.btuk.proxy.api.model.GridCell;
import org.btuk.proxy.database.dto.BuildingDTO;
import org.btuk.proxy.database.dto.GridCellDTO;
import org.btuk.proxy.database.sql.GlobalSQL;

import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;

@Path("/buildings")
public class BuildingsApiImpl implements BuildingsApi {

private final GlobalSQL globalSQL;

@Inject
public BuildingsApiImpl(GlobalSQL globalSQL) {
this.globalSQL = globalSQL;
}

@Override
public Response getBuildingsByArea(Double minLat, Double maxLat, Double minLon, Double maxLon, UUID playerUuid) {
String playerUuidStr = playerUuid != null ? playerUuid.toString() : null;
List<BuildingDTO> buildingDTOs = globalSQL.getBuildingsByArea(minLat, maxLat, minLon, maxLon, playerUuidStr);

List<Building> buildings = buildingDTOs.stream()
.map(this::mapBuilding)
.collect(Collectors.toList());
return Response.ok(buildings).build();
}

@Override
public Response getBuildingCount(List<UUID> playerUuid, Double minLat, Double maxLat, Double minLon, Double maxLon, Boolean isPublic, Boolean playerBuilt) {
List<String> playerUuidStrs = null;
if (playerUuid != null && !playerUuid.isEmpty()) {
playerUuidStrs = playerUuid.stream()
.map(UUID::toString)
.collect(Collectors.toList());
}

int count = globalSQL.getBuildingCount(playerUuidStrs, minLat, maxLat, minLon, maxLon, isPublic, playerBuilt);

BuildingCount buildingCount = new BuildingCount();
buildingCount.setCount(count);

return Response.ok(buildingCount).build();
}

@Override
public Response getBuildingGridCount(Double minLat, Double maxLat, Double minLon, Double maxLon, Double stepLat, Double stepLon, UUID playerUuid) {
if (stepLat == null || stepLat <= 0 || stepLon == null || stepLon <= 0) {
return Response.status(Response.Status.BAD_REQUEST).entity("stepLat and stepLon must be greater than 0").build();
}

String playerUuidStr = (playerUuid != null) ? playerUuid.toString() : null;

List<GridCellDTO> dbGridCounts = globalSQL.getBuildingGridCounts(minLat, maxLat, minLon, maxLon, stepLat, stepLon, playerUuidStr);

List<GridCell> cells = new ArrayList<>();

for (GridCellDTO dbCell : dbGridCounts) {
GridCell cell = new GridCell();
cell.setLat(dbCell.lat());
cell.setLon(dbCell.lon());
cell.setMinLat(dbCell.minLat());
cell.setMaxLat(dbCell.maxLat());
cell.setMinLon(dbCell.minLon());
cell.setMaxLon(dbCell.maxLon());
cell.setRow(dbCell.row());
cell.setCol(dbCell.col());
cell.setCount(dbCell.count());
cells.add(cell);
}

BuildingGridResponse response = new BuildingGridResponse();
response.setCells(cells);

return Response.ok(response).build();
}

private Building mapBuilding(BuildingDTO dto) {
Building building = new Building();
building.setBuildingId(dto.buildingId());
building.setPlayerName(dto.playerName());
building.setPlayerId(dto.playerId() != null ? UUID.fromString(dto.playerId()) : null);
building.setIsPublic(dto.isPublic());
building.setPlayerBuilt(dto.playerBuilt());
if (dto.timeAdded() != null) {
building.setTimeAdded(Date.from(dto.timeAdded().toInstant(ZoneOffset.UTC)));
}
building.setLat(dto.lat());
building.setLon(dto.lon());
return building;
}
}
Loading