Skip to content

Commit

Permalink
"Rebase" on BMNativeTemplate v0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
TechnicJelle committed Jun 18, 2024
1 parent a0d2648 commit beb95a2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.technicjelle</groupId>
<artifactId>BlueMapSpawnMarker</artifactId>
<version>0.1</version>
<version>0.2</version>

<properties>
<maven.compiler.source>16</maven.compiler.source>
Expand All @@ -24,15 +24,15 @@
<relocations>
<relocation>
<pattern>com.technicjelle.BMUtils</pattern>
<shadedPattern>com.technicjelle.BlueMapSpawnMarker.shade.BMUtils</shadedPattern>
<shadedPattern>${project.groupId}.${project.artifactId}.shade.BMUtils</shadedPattern>
</relocation>
<relocation>
<pattern>com.technicjelle.UpdateChecker</pattern>
<shadedPattern>com.technicjelle.BlueMapSpawnMarker.shade.UpdateChecker</shadedPattern>
<shadedPattern>${project.groupId}.${project.artifactId}.shade.UpdateChecker</shadedPattern>
</relocation>
<relocation>
<pattern>org.spongepowered.configurate</pattern>
<shadedPattern>com.technicjelle.BlueMapSpawnMarker.shade.configurate</shadedPattern>
<shadedPattern>${project.groupId}.${project.artifactId}.shade.configurate</shadedPattern>
</relocation>
</relocations>
</configuration>
Expand Down Expand Up @@ -96,18 +96,18 @@
<dependency>
<groupId>com.github.TechnicJelle</groupId>
<artifactId>UpdateCheckerJava</artifactId>
<version>v2.3</version>
<version>v2.5</version>
</dependency>
<dependency>
<groupId>de.bluecolored.bluemap</groupId>
<artifactId>BlueMapCommon</artifactId>
<version>5.1</version>
<version>5.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.TechnicJelle</groupId>
<artifactId>BMUtils</artifactId>
<version>v4.1</version>
<version>v4.2</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import com.flowpowered.math.vector.Vector3i;
import com.technicjelle.BMUtils.BMCopy;
import com.technicjelle.BMUtils.BMNative;
import com.technicjelle.BMUtils.BMNative.BMNLogger;
import com.technicjelle.BMUtils.BMNative.BMNMetadata;
import com.technicjelle.UpdateChecker;
import de.bluecolored.bluemap.api.BlueMapAPI;
import de.bluecolored.bluemap.api.BlueMapMap;
Expand All @@ -13,31 +14,30 @@

import java.io.IOException;
import java.util.function.Consumer;
import java.util.logging.Logger;

public class BlueMapSpawnMarker implements Runnable {
private Logger logger;
private BMNLogger logger;
private UpdateChecker updateChecker;

@Override
public void run() {
String addonID;
String addonVersion;
try {
addonID = BMNative.getAddonID(this.getClass().getClassLoader());
addonVersion = BMNative.getAddonMetadataKey(this.getClass().getClassLoader(), "version");
addonID = BMNMetadata.getAddonID(this.getClass().getClassLoader());
addonVersion = BMNMetadata.getKey(this.getClass().getClassLoader(), "version");
logger = new BMNLogger(this.getClass().getClassLoader());
} catch (IOException e) {
throw new RuntimeException(e);
}
logger = Logger.getLogger(addonID);
logger.log(java.util.logging.Level.INFO, "Starting " + addonID + " " + addonVersion);
updateChecker = new UpdateChecker("TechnicJelle", "BlueMapSpawnMarker", addonVersion);
logger.logInfo("Starting " + addonID + " " + addonVersion);
updateChecker = new UpdateChecker("TechnicJelle", addonID, addonVersion);
updateChecker.checkAsync();
BlueMapAPI.onEnable(onEnableListener);
}

final private Consumer<BlueMapAPI> onEnableListener = api -> {
updateChecker.logUpdateMessage(logger);
updateChecker.getUpdateMessage().ifPresent(logger::logWarning);

Config config;
try {
Expand All @@ -63,7 +63,7 @@ public void run() {

//Add markerSet to all maps
for (BlueMapMap map : world.getMaps()) {
logger.info("Adding spawn marker to map " + map.getId());
logger.logInfo("Adding spawn marker to map " + map.getId());
map.getMarkerSets().put("spawn", markerSet);
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/com/technicjelle/BlueMapSpawnMarker/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import com.flowpowered.math.vector.Vector2i;
import com.flowpowered.math.vector.Vector3i;
import com.technicjelle.BMUtils.BMCopy;
import com.technicjelle.BMUtils.BMNative;
import com.technicjelle.BMUtils.BMNative.BMNConfigDirectory;
import de.bluecolored.bluemap.api.BlueMapAPI;
import de.bluecolored.bluemap.api.markers.MarkerSet;
import de.bluecolored.bluemap.api.markers.POIMarker;
Expand Down Expand Up @@ -40,8 +39,8 @@ public class Config {
private @Nullable Double maxDistance;

public static Config load(BlueMapAPI api) throws IOException {
BMCopy.Native.jarResourceToAllocatedConfigDirectory(api, Config.class.getClassLoader(), fileName, fileName, false);
Path configDirectory = BMNative.getAllocatedConfigDirectory(api, Config.class.getClassLoader());
BMNConfigDirectory.BMNCopy.fromJarResource(api, Config.class.getClassLoader(), fileName, fileName, false);
Path configDirectory = BMNConfigDirectory.getAllocatedDirectory(api, Config.class.getClassLoader());
Path configFile = configDirectory.resolve(fileName);

HoconConfigurationLoader loader = HoconConfigurationLoader.builder()
Expand Down

0 comments on commit beb95a2

Please sign in to comment.