Skip to content

Commit

Permalink
Drop pre, fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Jun 23, 2024
1 parent 206c25d commit accf2f2
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MODRINTH: ${{ secrets.MODRINTH }}
CURSEFORGE: ${{ secrets.CURSEFORGE }}
CHANGELOG: ${{ github.event.release.body }}
- name: Upload GitHub release
uses: AButler/upload-release-assets@v2.0
Expand Down
30 changes: 30 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'fabric-loom' version '1.6.+'
id 'maven-publish'
id "com.modrinth.minotaur" version "2.+"
id 'com.matthewprenger.cursegradle' version '1.4.0'
}

sourceCompatibility = JavaVersion.VERSION_21
Expand Down Expand Up @@ -150,4 +151,33 @@ if (System.getenv("MODRINTH")) {
remapJar {
finalizedBy project.tasks.modrinth
}
}


curseforge {
if (System.getenv("CURSEFORGE")) {
apiKey = System.getenv("CURSEFORGE")

project {
id = "1037459"
releaseType = "release"
changelog = System.getenv("CHANGELOG")
changelogType = "markdown"
addGameVersion((project.minecraft_version.contains("-") ? ((String) project.minecraft_version.split("-")[0] + "-Snapshot") : project.minecraft_version))
addGameVersion "Fabric"
addGameVersion "Quilt"
mainArtifact(remapJar)

afterEvaluate {
uploadTask.dependsOn("remapJar")
}
}
}

options {
forgeGradleIntegration = false
}
remapJar {
finalizedBy project.tasks.curseforge
}
}
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ generators.
- [Using placeholders](user/general)
- [Default placeholder list](user/default-placeholders)
- [Mod placeholder list](user/mod-placeholders)
- [QuickText Format](user/quicktext)
- [Simplified Text Format](user/text-format)

## For developers
Expand Down
12 changes: 12 additions & 0 deletions docs/user/mod-placeholders.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ These placeholders are provided by other mods. Some are build in directly, while

- `%styled-nicknames:display_name%` - Either nickname or default player name. (skips other formatting mods)

### [Text Placeholder API Expressions](https://modrinth.com/mod/text-placeholder-api-expr)
- `%expr:math [Math expressions and ${placeholder}s]%` - See mod page for list of available expressions and functions.
- `%expr:ifeq [aIsMath] [a] [bIsMath] [b] [cIsMath] [c] [dIsMath] [d]%` - Compare if `a` and `b` are equal, and return `c` or `d` accordingly.
- `%expr:iflt [a] [b] [cIsMath] [c] [dIsMath] [d]%` - Compare if `a` is less than `b`, and return `c` or `d` accordingly.
- `%expr:math [a] [b] [cIsMath] [c] [dIsMath] [d]%` - Compare if `a` is greater than `b`, and return `c` or `d` accordingly.
- `%expr:pad [length] [str] [c]%` - Pad both sides of `str` with `c` until it is `length` long.
- `%expr:padleft [length] [str] [c]%` - Pad left side of `str` with `c` until it is `length` long.
- `%expr:padright [length] [str] [c]%` - Pad right side of `str` with `c` until it is `length` long.
- `%expr:padmatch [match] [str] [c]%` - Pad both sides of `str` with `c` until it is the same length as `match`.
- `%expr:padmatchleft [match] [str] [c]%` - Pad left side of `str` with `c` until it is the same length as `match`.
- `%expr:padmatchright [match] [str] [c]%` - Pad right side of `str` with `c` until it is the same length as `match`.

### [Vanish](https://modrinth.com/mod/vanish)

- `%vanish:vanished%` - Displays a text (configurable via config) if a player is vanished.
Expand Down
4 changes: 2 additions & 2 deletions docs/user/quicktext.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# QuickText Format (Beta)
# QuickText Format

!!! warn inline end

Expand Down Expand Up @@ -169,7 +169,7 @@ There 2 types of gradients:
- `#!xml <rainbow [frequency] [saturation] [offset]>`/`<rainbow f:[frequency] s:[saturation] o:[offset]>`/`#!xml <rb [...]>` - It's simple rainbow gradient. All arguments are
optional (`#!xml <ranbow>` is still valid) and they take numbers between 0 and 1 (`0.3` for example)

### Clear (2.1.3+)
### Clear

!!! note inline end

Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.21-pre2
yarn_mappings=1.21-pre2+build.2
minecraft_version=1.21
yarn_mappings=1.21+build.2
loader_version=0.15.11

#Fabric api
fabric_version=0.99.4+1.21
fabric_version=0.100.1+1.21

# Mod Properties
mod_version = 2.4.0-pre.2+1.21
mod_version = 2.4.0+1.21
maven_group = eu.pb4
archives_base_name = placeholder-api

Binary file added icon (kopia).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ nav:
- user/general.md
- user/default-placeholders.md
- user/mod-placeholders.md
- user/quicktext.md
- user/text-format.md
- For Developers:
- dev/getting-started.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private static int keyDecomposition(String input, int offset, char separator, ch
var chrN = i != input.length() - 1 ? input.charAt(i + 1) : 0;
if (chr == stopAt && wrap == 0) {
break;
} else if (key != null && b.isEmpty() && hasMaps && (chr == '{' || chr == '[')) {
} else if (key != null && b.isEmpty() && hasMaps && (chr == '{' || chr == '[') && wrap == 0) {
var arg = new StringArgs("");
var ti = keyDecomposition(input, i + 1, separator, map, isWrap, true,
chr == '{' ? '}' : ']', (keyx, valuex) -> {
Expand All @@ -87,7 +87,7 @@ private static int keyDecomposition(String input, int offset, char separator, ch
key = null;
i = ti;
}
} else if (chr == map && key == null) {
} else if (chr == map && wrap == 0 && key == null) {
key = b.toString();
b = new StringBuilder();
} else if ((chr == '\\' && chrN != 0) || (chrN != 0 && chr == chrN && isWrap.test(chr))) {
Expand Down
16 changes: 11 additions & 5 deletions src/main/java/eu/pb4/placeholders/impl/textparser/BuiltinTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,11 @@ public static void register() {
TagRegistry.registerDefault(TextTag.enclosing("click", "click_action", false,
(nodes, data, parser) -> {
if (!data.isEmpty()) {
var type = data.getNext("type");
var value = data.getNext("value", "");
for (ClickEvent.Action action : ClickEvent.Action.values()) {
if (action.asString().equals(data.getNext("type"))) {
return new ClickActionNode(nodes, action, new LiteralNode(data.getNext("value", "")));
if (action.asString().equals(type)) {
return new ClickActionNode(nodes, action, new LiteralNode(value));
}
}
}
Expand Down Expand Up @@ -297,9 +299,13 @@ public static void register() {
true,
(nodes, data, parser) -> {
try {
var type = data.getNext("type", "").toLowerCase(Locale.ROOT);
var type = data.get("type");

if (data.size() > 1) {
if (type != null || data.size() > 1) {
if (type == null) {
type = data.getNext("type", "");
}
type = type.toLowerCase(Locale.ROOT);
if (type.equals("show_text") || type.equals("text")) {
return new HoverNode<>(nodes, HoverNode.Action.TEXT, parser.parseNode(
data.getNext("value", "")
Expand Down Expand Up @@ -336,7 +342,7 @@ public static void register() {
return new HoverNode<>(nodes, HoverNode.Action.TEXT, parser.parseNode(data.get("value", type)));
}
} else {
return new HoverNode<>(nodes, HoverNode.Action.TEXT, parser.parseNode(data.get("value", type)));
return new HoverNode<>(nodes, HoverNode.Action.TEXT, parser.parseNode(data.getNext("value")));
}
} catch (Exception e) {
// Shut
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/assets/placeholderapi/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"modmenu.descriptionTranslation.placeholder-api": "<white>Simple api for mods</> allowing for <rb sat:0.8>user friendly</> formatting and <i>universal placeholders</>!"
}
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"icon": "assets/icon.png",
"environment": "*",
"depends": {
"fabricloader": ">=0.13.4",
"minecraft": ">=1.19-beta.1"
"fabricloader": ">=0.15.0",
"minecraft": ">=1.21-"
},
"custom": {
"modmenu": {
Expand Down
2 changes: 1 addition & 1 deletion src/testmod/java/eu/pb4/placeholderstest/TestMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private static int test3(CommandContext<ServerCommandSource> context) {
TextNode.asSingle(
MarkdownLiteParserV1.ALL.parseNodes(
TextNode.asSingle(
TextParserV1.DEFAULT.parseNodes(new LiteralNode(context.getArgument("text", String.class)))
TagParser.DEFAULT.parseNodes(new LiteralNode(context.getArgument("text", String.class)))
)
)
)
Expand Down

0 comments on commit accf2f2

Please sign in to comment.