9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2025-12-27 18:59:10 +00:00

Add dynmap support to other integrations

This commit is contained in:
SamB440
2021-05-11 21:34:30 +01:00
parent d3e8880012
commit b53b85efc3
4 changed files with 24 additions and 4 deletions

View File

@@ -70,6 +70,14 @@ public class GriefPreventionIntegration implements IntegrationManager {
@Override
public @NotNull List<Location> getBoundingBoxPoints(Location regionLocation, @Nullable String regionId) {
return null;
List<Location> points = new ArrayList<>();
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(regionLocation, false, null);
if (regionId != null && !String.valueOf(claim.getID()).equals(regionId)) {
return points;
}
points.add(claim.getGreaterBoundaryCorner());
points.add(claim.getLesserBoundaryCorner());
return points;
}
}

View File

@@ -14,6 +14,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -61,6 +62,6 @@ public class ResidenceIntegration implements IntegrationManager {
@Override
public @NotNull List<Location> getBoundingBoxPoints(Location regionLocation, @Nullable String regionId) {
return null;
return new ArrayList<>();
}
}

View File

@@ -8,6 +8,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -40,6 +41,6 @@ public class RPGRegionsIntegration implements IntegrationManager {
@Override
public @NotNull List<Location> getBoundingBoxPoints(Location regionLocation, @Nullable String regionId) {
return null;
return new ArrayList<>(); // TODO
}
}

View File

@@ -90,7 +90,17 @@ public class UltraRegionsIntegration implements IntegrationManager {
@Override
public @NotNull List<Location> getBoundingBoxPoints(Location regionLocation, @Nullable String regionId) {
return null;
List<Location> points = new ArrayList<>();
for (Region region : getProtectedRegions(regionLocation)) {
if (regionId != null && !region.getName().equals(regionId)) {
continue;
}
for (XYZ point : region.getSelection().getTracePoints()) {
points.add(new Location(regionLocation.getWorld(), point.getX(), regionLocation.getY(), point.getZ()));
}
}
return points;
}
private List<Region> getProtectedRegions(Location location) {