9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2025-12-27 02:39:07 +00:00

Add dynmap support, remove legacy

This commit is contained in:
SamB440
2021-05-11 21:27:32 +01:00
parent d3f0a5e4f8
commit d3e8880012
18 changed files with 160 additions and 172 deletions

View File

@@ -13,6 +13,8 @@ import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerMoveEvent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
@@ -77,4 +79,7 @@ public interface IntegrationManager {
}
return true;
}
@NotNull
List<Location> getBoundingBoxPoints(Location regionLocation, @Nullable String regionId);
}

View File

@@ -60,7 +60,6 @@ public interface IStorageManager {
default void timing(long ms) {
if (TIMINGS.size() >= 3) TIMINGS.remove(2);
TIMINGS.add(ms);
System.out.println(ms);
if (ms >= 20) {
RPGRegionsAPI.getAPI().getLogger().warning("Grabbing accounts is taking a long time! (" + ms + "ms)");
}

View File

@@ -74,6 +74,9 @@ public class ConfiguredRegion {
@EditableField(material = XMaterial.NETHER_STAR, name = "Set teleport cooldown", description = "Set the cooldown for teleportation")
private int teleportCooldown;
private boolean showActionbar;
@EditableField(material = XMaterial.RED_DYE, name = "Hex display colour", description = "Set the colour of the region. It is a hex colour (e.g 0x42f4f1 for red) and is used in dynmap.")
private final String colour;
private final String lineColour;
public ConfiguredRegion(@Nullable World world, String id, String customName,
List<DiscoveryReward> rewards, List<RegionEffect> effects) {
@@ -98,6 +101,8 @@ public class ConfiguredRegion {
this.alwaysShowTitles = false;
this.teleportCooldown = 0;
this.showActionbar = true;
this.colour = String.valueOf(13369344);
this.lineColour = String.valueOf(13369344);
}
public ConfiguredRegion(@Nullable World world, String id, String customName,
@@ -314,6 +319,21 @@ public class ConfiguredRegion {
this.showActionbar = showActionbar;
}
@Nullable
public List<Location> getBoundingBox() {
return RPGRegionsAPI.getAPI().getManagers().getIntegrationManager().getBoundingBoxPoints(location, id);
}
public String getColour() {
if (colour == null) return "0";
return colour;
}
public String getLineColour() {
if (lineColour == null) return "0";
return lineColour;
}
public void save(IRPGRegionsAPI plugin) {
try {
File file = this.findFile(plugin);