Skip to content

Commit

Permalink
Merge pull request #5197 from bubblobill/i18nFunction
Browse files Browse the repository at this point in the history
getNamespace for macro context
  • Loading branch information
cwisniew authored Feb 8, 2025
2 parents b548136 + 2f6d28b commit 95485fd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/java/net/rptools/maptool/client/MapToolMacroContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
*/
package net.rptools.maptool.client;

import net.rptools.maptool.model.library.LibraryManager;

public class MapToolMacroContext {
/** The name of the macro being executed. */
private final String name;
Expand Down Expand Up @@ -100,4 +102,19 @@ public int getMacroButtonIndex() {
public boolean isUseToolTipsForUnformatedRolls() {
return useToolTipsForUnformatedRolls;
}

/**
* Get the namespace for the macro in context
*
* @return name space
*/
public String getNamespace() {
if (source.length() > 4) {
var ns = source.substring(4);
if (new LibraryManager().addOnLibraryExists(ns)) {
return ns;
}
}
return null;
}
}

0 comments on commit 95485fd

Please sign in to comment.