From 7bec6d539677426c94619c870471f961c9a3404c Mon Sep 17 00:00:00 2001 From: Mysticdrew Date: Fri, 27 Jun 2025 15:52:37 -0500 Subject: [PATCH 1/7] start of server api and cleanup --- .../journeymap/api/v2/client/IClientAPI.java | 4 +- .../api/v2/client/IClientPlugin.java | 8 +- .../api/v2/client/JourneyMapPlugin.java | 4 + .../api/v2/client/util/PluginHelper.java | 198 ------------------ .../api/v2/client/util/tuple/Tuple2.java | 5 - .../api/v2/common/IJourneyMapPlugin.java | 13 ++ .../api/v2/common/JourneyMapPlugin.java | 51 +++++ .../api/v2/common/tuple/Tuple2.java | 5 + .../{client/util => common}/tuple/Tuple3.java | 2 +- .../{client/util => common}/tuple/Tuple4.java | 2 +- .../journeymap/api/v2/server/IServerAPI.java | 45 ++++ .../api/v2/server/IServerPlugin.java | 24 +++ .../v2/server/event/ServerEventRegistry.java | 8 + 13 files changed, 157 insertions(+), 212 deletions(-) delete mode 100644 common/src/main/java/journeymap/api/v2/client/util/PluginHelper.java delete mode 100644 common/src/main/java/journeymap/api/v2/client/util/tuple/Tuple2.java create mode 100644 common/src/main/java/journeymap/api/v2/common/IJourneyMapPlugin.java create mode 100644 common/src/main/java/journeymap/api/v2/common/JourneyMapPlugin.java create mode 100644 common/src/main/java/journeymap/api/v2/common/tuple/Tuple2.java rename common/src/main/java/journeymap/api/v2/{client/util => common}/tuple/Tuple3.java (52%) rename common/src/main/java/journeymap/api/v2/{client/util => common}/tuple/Tuple4.java (56%) create mode 100644 common/src/main/java/journeymap/api/v2/server/IServerAPI.java create mode 100644 common/src/main/java/journeymap/api/v2/server/IServerPlugin.java create mode 100644 common/src/main/java/journeymap/api/v2/server/event/ServerEventRegistry.java diff --git a/common/src/main/java/journeymap/api/v2/client/IClientAPI.java b/common/src/main/java/journeymap/api/v2/client/IClientAPI.java index d0af11fb0..d13b594eb 100644 --- a/common/src/main/java/journeymap/api/v2/client/IClientAPI.java +++ b/common/src/main/java/journeymap/api/v2/client/IClientAPI.java @@ -268,7 +268,7 @@ void requestMapTile(String modId, ResourceKey dimension, Context.MapType /** * Removes a waypoint group. - * Setting deleteWaypoints to false, will move all waypoints in the Default group. + * Setting deleteWaypoints to false will move all waypoints in the Default group. * * @param group the group * @param deleteWaypoints to delete all waypoints in group @@ -277,7 +277,7 @@ void requestMapTile(String modId, ResourceKey dimension, Context.MapType /** * Removes groups for a modId. - * Setting deleteWaypoints to false, will move all waypoints in the Default group. + * Setting deleteWaypoints to false will move all waypoints in the Default group. * * @param modId - the modId * @param deleteWaypoints to delete all waypoints in group diff --git a/common/src/main/java/journeymap/api/v2/client/IClientPlugin.java b/common/src/main/java/journeymap/api/v2/client/IClientPlugin.java index ebc77e8b6..7814d89f0 100644 --- a/common/src/main/java/journeymap/api/v2/client/IClientPlugin.java +++ b/common/src/main/java/journeymap/api/v2/client/IClientPlugin.java @@ -20,6 +20,8 @@ package journeymap.api.v2.client; +import journeymap.api.v2.common.IJourneyMapPlugin; +import journeymap.api.v2.common.JourneyMapPlugin; import journeymap.api.v2.common.event.ClientEventRegistry; import javax.annotation.ParametersAreNonnullByDefault; @@ -30,7 +32,7 @@ * Implementation classes must have a no-arg constructor and also have the {@link JourneyMapPlugin} annotation. */ @ParametersAreNonnullByDefault -public interface IClientPlugin +public interface IClientPlugin extends IJourneyMapPlugin { /** * Called by JourneyMap during the init phase of mod loading. Your implementation @@ -44,8 +46,4 @@ public interface IClientPlugin */ void initialize(final IClientAPI jmClientApi); - /** - * Used by JourneyMap to associate your mod id with your plugin instance. - */ - String getModId(); } diff --git a/common/src/main/java/journeymap/api/v2/client/JourneyMapPlugin.java b/common/src/main/java/journeymap/api/v2/client/JourneyMapPlugin.java index 0506eed46..12df2a7bc 100644 --- a/common/src/main/java/journeymap/api/v2/client/JourneyMapPlugin.java +++ b/common/src/main/java/journeymap/api/v2/client/JourneyMapPlugin.java @@ -31,9 +31,13 @@ *

* Classes with this annotation must have a no-arg constructor * and must also implement the {@link IClientPlugin} interface. + * + * @deprecated this will be removed, please use {@link journeymap.api.v2.common.JourneyMapPlugin} + * This will be removed when the API is out of snapshot phase. */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) +@Deprecated(forRemoval = true, since = "2.0.0") public @interface JourneyMapPlugin { /** diff --git a/common/src/main/java/journeymap/api/v2/client/util/PluginHelper.java b/common/src/main/java/journeymap/api/v2/client/util/PluginHelper.java deleted file mode 100644 index 4a680c710..000000000 --- a/common/src/main/java/journeymap/api/v2/client/util/PluginHelper.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * JourneyMap API (http://journeymap.info) - * http://github.com/TeamJM/journeymap-api - * - * Copyright (c) 2011-2016 Techbrew. All Rights Reserved. - * The following limited rights are granted to you: - * - * You MAY: - * + Write your own code that uses the API source code in journeymap.* packages as a dependency. - * + Write and distribute your own code that uses, modifies, or extends the example source code in example.* packages - * + Fork and modify any source code for the purpose of submitting Pull Requests to the TeamJM/journeymap-api repository. - * Submitting new or modified code to the repository means that you are granting Techbrew all rights to the submitted code. - * - * You MAY NOT: - * - Distribute source code or classes (whether modified or not) from journeymap.* packages. - * - Submit any code to the TeamJM/journeymap-api repository with a different license than this one. - * - Use code or artifacts from the repository in any way not explicitly granted by this license. - * - */ - -package journeymap.api.v2.client.util; - -import com.google.common.base.Strings; -import journeymap.api.v2.client.IClientAPI; -import journeymap.api.v2.client.IClientPlugin; -import journeymap.api.v2.client.JourneyMapPlugin; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import javax.annotation.ParametersAreNonnullByDefault; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -/** - * Enum singleton used by JourneyMap to load and initialize plugins. A plugin class must be annotated with - * the {@link JourneyMapPlugin} annotation and also implement the {@link IClientPlugin} interface. - */ -@ParametersAreNonnullByDefault -public enum PluginHelper -{ - INSTANCE; - - public final static Logger LOGGER = LogManager.getLogger("journeymap"); - // public final static Type PLUGIN_ANNOTATION_NAME = Type.getType(ClientPlugin.class); - public final static String PLUGIN_INTERFACE_NAME = IClientPlugin.class.getSimpleName(); - - protected Map plugins = null; - protected boolean initialized; - - - /** - * Called by JourneyMap during it's preInitialization phase to find plugin classes - * included in other mods and then instantiate them. - *

- * Mods which are testing integration can also call this in a dev environment - * and pass in a stub implementation, but must never do so in production code. - * - * @return map of instantiated plugins, keyed by modId - */ - public Map preInitPlugins(List pluginList) - { - if (plugins == null) - { - HashMap discovered = new HashMap(); - - for (String className : pluginList) - { - try - { - Class pluginClass = Class.forName(className); - if (IClientPlugin.class.isAssignableFrom(pluginClass)) - { - if (pluginClass.isAnnotationPresent(JourneyMapPlugin.class)) - { - Class interfaceImplClass = pluginClass.asSubclass(IClientPlugin.class); - JourneyMapPlugin annotationClass = pluginClass.getDeclaredAnnotation(JourneyMapPlugin.class); - if (inVersionRange(annotationClass.apiVersion())) - { - IClientPlugin instance = interfaceImplClass.getDeclaredConstructor().newInstance(); - String modId = instance.getModId(); - if (Strings.isNullOrEmpty(modId)) - { - throw new Exception("IClientPlugin.getModId() must return a non-empty, non-null value"); - } - if (discovered.containsKey(modId)) - { - Class otherPluginClass = discovered.get(modId).getClass(); - throw new Exception(String.format("Multiple plugins trying to use the same modId: %s and %s", interfaceImplClass, otherPluginClass)); - } - discovered.put(modId, instance); - LOGGER.info(String.format("Found @%s: %s", JourneyMapPlugin.class.getSimpleName(), className)); - } - else - { - LOGGER.error("Found @{}: {}, but there is a version incompatibility, skipping plugin version {}, required version {}", - PLUGIN_INTERFACE_NAME, className, annotationClass.apiVersion(), "2.0.0"); - } - } - else - { - LOGGER.error(String.format("Found @%s: %s, but it is not annotated with %s", - PLUGIN_INTERFACE_NAME, className, JourneyMapPlugin.class.getSimpleName())); - } - } - else - { - LOGGER.error(String.format("Found @%s: %s, but it doesn't implement %s", - JourneyMapPlugin.class.getSimpleName(), className, PLUGIN_INTERFACE_NAME)); - System.out.println(List.of(pluginClass.getInterfaces())); - } - } - catch (Exception e) - { - LOGGER.error(String.format("Found @%s: %s, but failed to instantiate it: %s", - JourneyMapPlugin.class.getSimpleName(), className, e.getMessage()), e); - } - } - - if (discovered.isEmpty()) - { - LOGGER.info("No plugins for JourneyMap API discovered."); - } - - plugins = Collections.unmodifiableMap(discovered); - } - - return plugins; - } - - static boolean inVersionRange(String pluginApiVersion) - { - // TODO: add version parsing logic - return true; - } - - /** - * Called by JourneyMap during its initialization phase. Can only be called once per runtime. - *

- * Mods which are testing integration can also call this in a dev environment - * and pass in a stub implementation, but must never do so in production code. - * - * @param clientAPI Client API implementation - * @return list of initialized plugins, null if plugin discovery never occurred - */ - public Map initPlugins(IClientAPI clientAPI) - { - if (plugins == null) - { - // Exception used just to show a trace back to whoever shouldn't have called this. - LOGGER.warn("Plugin discovery never occurred.", new IllegalStateException()); - } - else if (!initialized) - { - LOGGER.info(String.format("Initializing plugins with Client API: %s", clientAPI.getClass().getName())); - - HashMap discovered = new HashMap(plugins); - Iterator iter = discovered.values().iterator(); - while (iter.hasNext()) - { - IClientPlugin plugin = iter.next(); - try - { - plugin.initialize(clientAPI); - LOGGER.info(String.format("Initialized %s: %s", PLUGIN_INTERFACE_NAME, plugin.getClass().getName())); - } - catch (Exception e) - { - LOGGER.error("Failed to initialize IClientPlugin: " + plugin.getClass().getName(), e); - iter.remove(); - } - } - - // Finalize the list - plugins = Collections.unmodifiableMap(discovered); - initialized = true; - } - else - { - // Exception used just to show a trace back to whoever shouldn't have called this. - LOGGER.warn("Plugins already initialized!", new IllegalStateException()); - } - - return plugins; - } - - /** - * Get the map of plugins, keyed by modId. - * - * @return null if {@link #preInitPlugins(List)} hasn't been called yet - */ - public Map getPlugins() - { - return plugins; - } -} diff --git a/common/src/main/java/journeymap/api/v2/client/util/tuple/Tuple2.java b/common/src/main/java/journeymap/api/v2/client/util/tuple/Tuple2.java deleted file mode 100644 index b7035a01f..000000000 --- a/common/src/main/java/journeymap/api/v2/client/util/tuple/Tuple2.java +++ /dev/null @@ -1,5 +0,0 @@ -package journeymap.api.v2.client.util.tuple; - -public record Tuple2(A a, B b) -{ -} diff --git a/common/src/main/java/journeymap/api/v2/common/IJourneyMapPlugin.java b/common/src/main/java/journeymap/api/v2/common/IJourneyMapPlugin.java new file mode 100644 index 000000000..ff285115a --- /dev/null +++ b/common/src/main/java/journeymap/api/v2/common/IJourneyMapPlugin.java @@ -0,0 +1,13 @@ +package journeymap.api.v2.common; + +import org.jetbrains.annotations.ApiStatus; + +@ApiStatus.Internal +public interface IJourneyMapPlugin +{ + /** + * Used by JourneyMap to associate your mod id with your plugin instance. + */ + String getModId(); + +} diff --git a/common/src/main/java/journeymap/api/v2/common/JourneyMapPlugin.java b/common/src/main/java/journeymap/api/v2/common/JourneyMapPlugin.java new file mode 100644 index 000000000..0c30193b1 --- /dev/null +++ b/common/src/main/java/journeymap/api/v2/common/JourneyMapPlugin.java @@ -0,0 +1,51 @@ +/* + * JourneyMap API (http://journeymap.info) + * http://github.com/TeamJM/journeymap-api + * + * Copyright (c) 2011-2016 Techbrew. All Rights Reserved. + * The following limited rights are granted to you: + * + * You MAY: + * + Write your own code that uses the API source code in journeymap.* packages as a dependency. + * + Write and distribute your own code that uses, modifies, or extends the example source code in example.* packages + * + Fork and modify any source code for the purpose of submitting Pull Requests to the TeamJM/journeymap-api repository. + * Submitting new or modified code to the repository means that you are granting Techbrew all rights to the submitted code. + * + * You MAY NOT: + * - Distribute source code or classes (whether modified or not) from journeymap.* packages. + * - Submit any code to the TeamJM/journeymap-api repository with a different license than this one. + * - Use code or artifacts from the repository in any way not explicitly granted by this license. + * + */ + +package journeymap.api.v2.common; + +import journeymap.api.v2.client.IClientPlugin; +import journeymap.api.v2.server.IServerPlugin; + +import javax.annotation.Nullable; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Used by JourneyMap to discover and classload plugin classes. + *

+ * Classes with this annotation must have a no-arg constructor + * and must also implement the {@link IClientPlugin} interface for client plugins + * or {@link IServerPlugin} interface for server plugins. + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface JourneyMapPlugin +{ + /** + * Mod Devs can supply the version of journeymap-api the mod was built against, + * so that it will not load the plugin if there is a breaking change. + * + * @return - The Api Version + */ + @Nullable + String apiVersion(); +} diff --git a/common/src/main/java/journeymap/api/v2/common/tuple/Tuple2.java b/common/src/main/java/journeymap/api/v2/common/tuple/Tuple2.java new file mode 100644 index 000000000..fd49d327f --- /dev/null +++ b/common/src/main/java/journeymap/api/v2/common/tuple/Tuple2.java @@ -0,0 +1,5 @@ +package journeymap.api.v2.common.tuple; + +public record Tuple2(A a, B b) +{ +} diff --git a/common/src/main/java/journeymap/api/v2/client/util/tuple/Tuple3.java b/common/src/main/java/journeymap/api/v2/common/tuple/Tuple3.java similarity index 52% rename from common/src/main/java/journeymap/api/v2/client/util/tuple/Tuple3.java rename to common/src/main/java/journeymap/api/v2/common/tuple/Tuple3.java index 63cd20e77..89a737a58 100644 --- a/common/src/main/java/journeymap/api/v2/client/util/tuple/Tuple3.java +++ b/common/src/main/java/journeymap/api/v2/common/tuple/Tuple3.java @@ -1,4 +1,4 @@ -package journeymap.api.v2.client.util.tuple; +package journeymap.api.v2.common.tuple; public record Tuple3(A a, B b, C c) { diff --git a/common/src/main/java/journeymap/api/v2/client/util/tuple/Tuple4.java b/common/src/main/java/journeymap/api/v2/common/tuple/Tuple4.java similarity index 56% rename from common/src/main/java/journeymap/api/v2/client/util/tuple/Tuple4.java rename to common/src/main/java/journeymap/api/v2/common/tuple/Tuple4.java index b769b943e..eeaaec545 100644 --- a/common/src/main/java/journeymap/api/v2/client/util/tuple/Tuple4.java +++ b/common/src/main/java/journeymap/api/v2/common/tuple/Tuple4.java @@ -1,4 +1,4 @@ -package journeymap.api.v2.client.util.tuple; +package journeymap.api.v2.common.tuple; public record Tuple4(A a, B b, C c, D d) { diff --git a/common/src/main/java/journeymap/api/v2/server/IServerAPI.java b/common/src/main/java/journeymap/api/v2/server/IServerAPI.java new file mode 100644 index 000000000..04ac7e90e --- /dev/null +++ b/common/src/main/java/journeymap/api/v2/server/IServerAPI.java @@ -0,0 +1,45 @@ +package journeymap.api.v2.server; + +import journeymap.api.v2.common.waypoint.Waypoint; +import net.minecraft.server.level.ServerPlayer; + +import java.util.List; +import java.util.UUID; + +/** + * Currently unused, just a placeholder. Please do not code any of this as it will likely change. + */ +@Deprecated +public interface IServerAPI +{ + /** + * Gets all the waypoints stored for the target Server Player. + * + * @param player - the Player + * @return - the waypoints. + */ + List getWaypoints(ServerPlayer player); + + /** + * Gets all the waypoints stored for the target Server Player. + * + * @param id - the player uuid + * @return - the waypoints. + */ + List getWaypoints(UUID id); + + /** + * Gets All waypoints stored on the server for all players and all common/global waypoints. + * + * @return all waypoints + */ + List getWaypoints(); + + /** + * Gets all waypoints that are not tied to specific players. + * These waypoints are created for every player when they log in. + * + * @return + */ + List getGlobalWaypoints(); +} diff --git a/common/src/main/java/journeymap/api/v2/server/IServerPlugin.java b/common/src/main/java/journeymap/api/v2/server/IServerPlugin.java new file mode 100644 index 000000000..740d4a734 --- /dev/null +++ b/common/src/main/java/journeymap/api/v2/server/IServerPlugin.java @@ -0,0 +1,24 @@ +package journeymap.api.v2.server; + +import journeymap.api.v2.common.IJourneyMapPlugin; +import journeymap.api.v2.common.JourneyMapPlugin; + +/** + * Interface used by JourneyMap to initialize client plugins and provide the Client API. + *

+ * Implementation classes must have a no-arg constructor and also have the {@link JourneyMapPlugin} annotation. + */ +public interface IServerPlugin extends IJourneyMapPlugin +{ + /** + * Called by JourneyMap during the init phase of mod loading. Your implementation + * should retain a reference to the IServerAPI passed in, since that is what your plugin + * will use to add overlays, etc. to JourneyMap. + *

+ * This is also a good time to subscribe to any desired Events. + * + * @param jmServerApi Client API implementation + */ + void initialize(final IServerAPI jmServerApi); + +} diff --git a/common/src/main/java/journeymap/api/v2/server/event/ServerEventRegistry.java b/common/src/main/java/journeymap/api/v2/server/event/ServerEventRegistry.java new file mode 100644 index 000000000..782597587 --- /dev/null +++ b/common/src/main/java/journeymap/api/v2/server/event/ServerEventRegistry.java @@ -0,0 +1,8 @@ +package journeymap.api.v2.server.event; + +/** + * Server only events will be here. + */ +public class ServerEventRegistry +{ +} From fd150de333b04a176c70cc0099ffcd77c9582df5 Mon Sep 17 00:00:00 2001 From: Mysticdrew Date: Tue, 30 Sep 2025 14:12:30 -0500 Subject: [PATCH 2/7] cleanup --- .../journeymap/api/v2/client/option/BooleanOption.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/journeymap/api/v2/client/option/BooleanOption.java b/common/src/main/java/journeymap/api/v2/client/option/BooleanOption.java index 5e8434d1f..4c57557c0 100644 --- a/common/src/main/java/journeymap/api/v2/client/option/BooleanOption.java +++ b/common/src/main/java/journeymap/api/v2/client/option/BooleanOption.java @@ -6,11 +6,11 @@ public class BooleanOption extends Option /** * Boolean - creates a checkbox - * For tooltips, your i18n key plus .tooltip in your language json example mod.option.label and mod.option.label.tooltip + * For tooltips, your i18n key plus .tooltip in your language json example: "mod.option.label" and "mod.option.label.tooltip" * * @param category - The category; * @param fieldName - The fieldName; - * @param label - The label, can be the display string or i18n key. + * @param label - The label can be the display string or i18n key. * @param defaultValue - The default value */ public BooleanOption(OptionCategory category, String fieldName, String label, Boolean defaultValue) @@ -21,13 +21,13 @@ public BooleanOption(OptionCategory category, String fieldName, String label, Bo /** * Boolean - creates a checkbox - * For tooltips, your i18n key plus .tooltip in your language json example mod.option.label and mod.option.label.tooltip + * For tooltips, your i18n key plus .tooltip in your language json example: "mod.option.label" and "mod.option.label.tooltip" * * @param category - The category; * @param fieldName - The fieldName; - * @param label - The label, can be the display string or i18n key. + * @param label - The label can be the display string or i18n key. * @param defaultValue - The default value - * @param isMaster - Makes this value first in the last, and if disabled the whole category is disabled. + * @param isMaster - Makes this value first in the list, and if disabled, the whole category is disabled. */ public BooleanOption(OptionCategory category, String fieldName, String label, Boolean defaultValue, Boolean isMaster) { From 48e54a287c571533f2fedad4346ba4ad0459a01a Mon Sep 17 00:00:00 2001 From: Mysticdrew Date: Sat, 7 Feb 2026 10:58:52 -0600 Subject: [PATCH 3/7] add common api --- .../src/main/java/journeymap/api/v2/client/IClientAPI.java | 3 ++- .../main/java/journeymap/api/v2/client/IClientPlugin.java | 2 +- common/src/main/java/journeymap/api/v2/common/CommonAPI.java | 5 +++++ .../java/journeymap/api/v2/common/IJourneyMapPlugin.java | 3 ++- .../src/main/java/journeymap/api/v2/server/IServerAPI.java | 3 ++- .../main/java/journeymap/api/v2/server/IServerPlugin.java | 4 ++-- 6 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 common/src/main/java/journeymap/api/v2/common/CommonAPI.java diff --git a/common/src/main/java/journeymap/api/v2/client/IClientAPI.java b/common/src/main/java/journeymap/api/v2/client/IClientAPI.java index d13b594eb..503900503 100644 --- a/common/src/main/java/journeymap/api/v2/client/IClientAPI.java +++ b/common/src/main/java/journeymap/api/v2/client/IClientAPI.java @@ -26,6 +26,7 @@ import journeymap.api.v2.client.display.Displayable; import journeymap.api.v2.client.event.MappingEvent; import journeymap.api.v2.client.util.UIState; +import journeymap.api.v2.common.CommonAPI; import journeymap.api.v2.common.waypoint.Waypoint; import journeymap.api.v2.common.waypoint.WaypointGroup; import net.minecraft.resources.ResourceKey; @@ -42,7 +43,7 @@ * Definition for the JourneyMap Client API. */ @ParametersAreNonnullByDefault -public interface IClientAPI +public interface IClientAPI extends CommonAPI { String API_OWNER = "journeymap"; String API_VERSION = "2.0.0-SNAPSHOT"; diff --git a/common/src/main/java/journeymap/api/v2/client/IClientPlugin.java b/common/src/main/java/journeymap/api/v2/client/IClientPlugin.java index 7814d89f0..ec9c06836 100644 --- a/common/src/main/java/journeymap/api/v2/client/IClientPlugin.java +++ b/common/src/main/java/journeymap/api/v2/client/IClientPlugin.java @@ -32,7 +32,7 @@ * Implementation classes must have a no-arg constructor and also have the {@link JourneyMapPlugin} annotation. */ @ParametersAreNonnullByDefault -public interface IClientPlugin extends IJourneyMapPlugin +public interface IClientPlugin extends IJourneyMapPlugin { /** * Called by JourneyMap during the init phase of mod loading. Your implementation diff --git a/common/src/main/java/journeymap/api/v2/common/CommonAPI.java b/common/src/main/java/journeymap/api/v2/common/CommonAPI.java new file mode 100644 index 000000000..696c4fa61 --- /dev/null +++ b/common/src/main/java/journeymap/api/v2/common/CommonAPI.java @@ -0,0 +1,5 @@ +package journeymap.api.v2.common; + +public interface CommonAPI +{ +} diff --git a/common/src/main/java/journeymap/api/v2/common/IJourneyMapPlugin.java b/common/src/main/java/journeymap/api/v2/common/IJourneyMapPlugin.java index ff285115a..425a44431 100644 --- a/common/src/main/java/journeymap/api/v2/common/IJourneyMapPlugin.java +++ b/common/src/main/java/journeymap/api/v2/common/IJourneyMapPlugin.java @@ -3,11 +3,12 @@ import org.jetbrains.annotations.ApiStatus; @ApiStatus.Internal -public interface IJourneyMapPlugin +public interface IJourneyMapPlugin { /** * Used by JourneyMap to associate your mod id with your plugin instance. */ String getModId(); + void initialize(final T api); } diff --git a/common/src/main/java/journeymap/api/v2/server/IServerAPI.java b/common/src/main/java/journeymap/api/v2/server/IServerAPI.java index 04ac7e90e..5db88d745 100644 --- a/common/src/main/java/journeymap/api/v2/server/IServerAPI.java +++ b/common/src/main/java/journeymap/api/v2/server/IServerAPI.java @@ -1,5 +1,6 @@ package journeymap.api.v2.server; +import journeymap.api.v2.common.CommonAPI; import journeymap.api.v2.common.waypoint.Waypoint; import net.minecraft.server.level.ServerPlayer; @@ -10,7 +11,7 @@ * Currently unused, just a placeholder. Please do not code any of this as it will likely change. */ @Deprecated -public interface IServerAPI +public interface IServerAPI extends CommonAPI { /** * Gets all the waypoints stored for the target Server Player. diff --git a/common/src/main/java/journeymap/api/v2/server/IServerPlugin.java b/common/src/main/java/journeymap/api/v2/server/IServerPlugin.java index 740d4a734..027563e75 100644 --- a/common/src/main/java/journeymap/api/v2/server/IServerPlugin.java +++ b/common/src/main/java/journeymap/api/v2/server/IServerPlugin.java @@ -8,7 +8,7 @@ *

* Implementation classes must have a no-arg constructor and also have the {@link JourneyMapPlugin} annotation. */ -public interface IServerPlugin extends IJourneyMapPlugin +public interface IServerPlugin extends IJourneyMapPlugin { /** * Called by JourneyMap during the init phase of mod loading. Your implementation @@ -19,6 +19,6 @@ public interface IServerPlugin extends IJourneyMapPlugin * * @param jmServerApi Client API implementation */ + @Override void initialize(final IServerAPI jmServerApi); - } From 14627595207f56689e9c8b7558268e6dd19e8a51 Mon Sep 17 00:00:00 2001 From: Mysticdrew Date: Sat, 7 Feb 2026 12:12:06 -0600 Subject: [PATCH 4/7] add common api --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 418e9a7be..70bddd7aa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -48,7 +48,7 @@ fabric_jm_file_id=3587042 # Properties for artifact versions group=info.journeymap mod_name=journeymap-api -api_version=2.0.0 +api_version=2.8.0 snapshot=true # Properties for artifact titles From cd90e3c4530bfececb12ce510f40fa6122fbc534 Mon Sep 17 00:00:00 2001 From: Mysticdrew Date: Wed, 18 Feb 2026 13:08:26 -0600 Subject: [PATCH 5/7] version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 70bddd7aa..418e9a7be 100644 --- a/gradle.properties +++ b/gradle.properties @@ -48,7 +48,7 @@ fabric_jm_file_id=3587042 # Properties for artifact versions group=info.journeymap mod_name=journeymap-api -api_version=2.8.0 +api_version=2.0.0 snapshot=true # Properties for artifact titles From 899d1342bcd7425bfa4283550fd151d6604aa961 Mon Sep 17 00:00:00 2001 From: Mysticdrew Date: Wed, 18 Feb 2026 13:34:21 -0600 Subject: [PATCH 6/7] Update common/src/main/java/journeymap/api/v2/server/IServerPlugin.java Co-authored-by: Alejandro Coria --- .../src/main/java/journeymap/api/v2/server/IServerPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/journeymap/api/v2/server/IServerPlugin.java b/common/src/main/java/journeymap/api/v2/server/IServerPlugin.java index 027563e75..27d0a8d96 100644 --- a/common/src/main/java/journeymap/api/v2/server/IServerPlugin.java +++ b/common/src/main/java/journeymap/api/v2/server/IServerPlugin.java @@ -4,7 +4,7 @@ import journeymap.api.v2.common.JourneyMapPlugin; /** - * Interface used by JourneyMap to initialize client plugins and provide the Client API. + * Interface used by JourneyMap to initialize server plugins and provide the Server API. *

* Implementation classes must have a no-arg constructor and also have the {@link JourneyMapPlugin} annotation. */ From 5485741172d20c99038f17ba0449b7c21d2e96f3 Mon Sep 17 00:00:00 2001 From: Mysticdrew Date: Wed, 18 Feb 2026 13:36:57 -0600 Subject: [PATCH 7/7] Apply suggestion from @mysticdrew --- .../src/main/java/journeymap/api/v2/server/IServerPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/journeymap/api/v2/server/IServerPlugin.java b/common/src/main/java/journeymap/api/v2/server/IServerPlugin.java index 27d0a8d96..8582f0d17 100644 --- a/common/src/main/java/journeymap/api/v2/server/IServerPlugin.java +++ b/common/src/main/java/journeymap/api/v2/server/IServerPlugin.java @@ -17,7 +17,7 @@ public interface IServerPlugin extends IJourneyMapPlugin *

* This is also a good time to subscribe to any desired Events. * - * @param jmServerApi Client API implementation + * @param jmServerApi Server API implementation */ @Override void initialize(final IServerAPI jmServerApi);