Merge pull request #2612 from BentoBoxWorld/remove_dynmap

Remove dynmap
This commit is contained in:
tastybento 2025-02-02 08:36:56 -08:00 committed by GitHub
commit cd0b251e28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 0 additions and 101 deletions

11
pom.xml
View File

@ -77,7 +77,6 @@
<vault.version>1.7.1</vault.version>
<placeholderapi.version>2.10.9</placeholderapi.version>
<githubapi.version>d5f5e0bbd8</githubapi.version>
<dynmap.version>3.0-SNAPSHOT</dynmap.version>
<myworlds.version>1.19.3-v1</myworlds.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
@ -153,10 +152,6 @@
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
<repository>
<id>dynmap-repo</id>
<url>https://repo.mikeprimm.com/</url>
</repository>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
@ -326,12 +321,6 @@
<scope>provided</scope>
</dependency>
<!-- Hooks -->
<dependency>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-api</artifactId>
<version>${dynmap.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.bergerkiller.bukkit</groupId>
<artifactId>MyWorlds</artifactId>

View File

@ -1,90 +0,0 @@
package world.bentobox.bentobox.hooks;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Material;
import org.dynmap.DynmapAPI;
import org.dynmap.markers.MarkerAPI;
import org.dynmap.markers.MarkerSet;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.hooks.Hook;
/**
* @author Poslovitch
* @since 1.5.0
*/
public class DynmapHook extends Hook {
private MarkerAPI markerAPI;
@NonNull
private final Map<@NonNull GameModeAddon, @NonNull MarkerSet> markerSets;
public DynmapHook() {
super("dynmap", Material.FILLED_MAP);
this.markerSets = new HashMap<>();
}
@Override
public boolean hook() {
try {
DynmapAPI dynmapAPI = (DynmapAPI) getPlugin();
MarkerAPI markers = dynmapAPI.getMarkerAPI();
if (markers == null) {
return false;
}
markerAPI = markers;
BentoBox.getInstance().getAddonsManager().getGameModeAddons().forEach(this::registerMarkerSet);
return true;
} catch (Exception e) {
return false;
}
}
public void registerMarkerSet(@NonNull GameModeAddon addon) {
String name = addon.getDescription().getName();
if (getMarkerSet(addon) == null) {
// From the javadoc: createMarkerSet(String id, String label, Set<MarkerIcon> allowedIcons, boolean persistent)
MarkerSet set = markerAPI.createMarkerSet(name.toLowerCase(Locale.ENGLISH) + ".markers", name, null, true);
markerSets.put(addon, set);
}
}
@NonNull
public Map<GameModeAddon, MarkerSet> getMarkerSets() {
return markerSets;
}
@Nullable
public MarkerSet getMarkerSet(@NonNull GameModeAddon addon) {
if (markerSets.containsKey(addon)) {
return markerSets.get(addon);
} else {
return markerAPI.getMarkerSet(addon.getDescription().getName().toLowerCase(Locale.ENGLISH) + ".markers");
}
}
/**
* Returns the MarkerAPI instance. Not null.
* @return the MarkerAPI instance.
*/
@NonNull
public MarkerAPI getMarkerAPI() {
return markerAPI;
}
@Override
public String getFailureCause() {
return "the version of dynmap you're using is incompatible with this hook. Use a newer version.";
}
}