Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
plugins {
id 'fabric-loom' version '1.7.+'
id 'fabric-loom' version '1.10.+'
id 'maven-publish'
id "com.modrinth.minotaur" version "2.+"
id 'com.matthewprenger.cursegradle' version '1.4.0'
}

sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
base {
archivesName = project.archives_base_name
version = project.mod_version
group = project.maven_group
}


repositories {
Expand All @@ -20,8 +19,8 @@ repositories {
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.

maven { url "https://maven.nucleoid.xyz" }
maven { url "https://jitpack.io" }
maven { url = "https://maven.nucleoid.xyz" }
maven { url = "https://jitpack.io" }
}

sourceSets {
Expand All @@ -37,13 +36,13 @@ loom {
client()
ideConfigGenerated project.rootProject == project
name = "Test Mod Client"
source sourceSets.testmod
source = sourceSets.testmod
}
testmodServer {
server()
ideConfigGenerated project.rootProject == project
name = "Test Mod Server"
source sourceSets.testmod
source = sourceSets.testmod
}
}
}
Expand Down Expand Up @@ -86,6 +85,8 @@ tasks.withType(JavaCompile).configureEach {
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
Expand All @@ -104,6 +105,7 @@ def env = System.getenv()
publishing {
publications {
mavenJava(MavenPublication) {
//artifactId = base.archivesName.get()
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
Expand Down
11 changes: 5 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.21.4
yarn_mappings=1.21.4+build.2
loader_version=0.16.9
minecraft_version=1.21.5-pre3
yarn_mappings=1.21.5-pre3+build.2
loader_version=0.16.10

#Fabric api
fabric_version=0.112.2+1.21.4
fabric_version=0.119.1+1.21.5

# Mod Properties
mod_version = 2.6.0+1.21.4
mod_version = 2.6.0+1.21.5
maven_group = eu.pb4
archives_base_name = placeholder-api

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
43 changes: 30 additions & 13 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 21 additions & 16 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/main/java/eu/pb4/placeholders/api/node/TextNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import eu.pb4.placeholders.api.PlaceholderContext;
import eu.pb4.placeholders.api.node.parent.ParentNode;
import eu.pb4.placeholders.impl.GeneralUtils;
import eu.pb4.placeholders.impl.textparser.TextParserImpl;
import net.minecraft.text.Text;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@
import net.minecraft.text.ClickEvent;
import net.minecraft.text.Style;

import java.net.URI;

public final class ClickActionNode extends SimpleStylingNode {
private final ClickEvent.Action action;
private final Action action;
private final TextNode value;

public ClickActionNode(TextNode[] children, ClickEvent.Action action, TextNode value) {
public ClickActionNode(TextNode[] children, Action action, TextNode value) {
super(children);
this.action = action;
this.value = value;
}

public ClickEvent.Action action() {
public Action action() {
return action;
}

Expand All @@ -26,7 +28,29 @@ public TextNode value() {

@Override
protected Style style(ParserContext context) {
return Style.EMPTY.withClickEvent(new ClickEvent(this.action, this.value.toText(context, true).getString()));
if (this.action == Action.OPEN_URL) {
try {
return Style.EMPTY.withClickEvent(new ClickEvent.OpenUrl(URI.create(this.value.toText(context).getString())));
} catch (Exception ignored) {
return Style.EMPTY;
}
} else if (this.action == Action.CHANGE_PAGE) {
try {
return Style.EMPTY.withClickEvent(new ClickEvent.ChangePage(Integer.parseInt(this.value.toText(context).getString())));
} catch (Exception ignored) {
return Style.EMPTY;
}
} else if (this.action == Action.OPEN_FILE) {
return Style.EMPTY.withClickEvent(new ClickEvent.OpenFile(this.value.toText(context).getString()));
} else if (this.action == Action.RUN_COMMAND) {
return Style.EMPTY.withClickEvent(new ClickEvent.RunCommand(this.value.toText(context).getString()));
} else if (this.action == Action.SUGGEST_COMMAND) {
return Style.EMPTY.withClickEvent(new ClickEvent.SuggestCommand(this.value.toText(context).getString()));
} else if (this.action == Action.COPY_TO_CLIPBOARD) {
return Style.EMPTY.withClickEvent(new ClickEvent.CopyToClipboard(this.value.toText(context).getString()));
} else {
return Style.EMPTY;
}
}

@Override
Expand All @@ -51,4 +75,13 @@ public String toString() {
", value=" + value +
'}';
}

public record Action(ClickEvent.Action vanillaType) {
public static final Action OPEN_URL = new Action(ClickEvent.Action.OPEN_URL);
public static final Action CHANGE_PAGE = new Action(ClickEvent.Action.CHANGE_PAGE);
public static final Action OPEN_FILE = new Action(ClickEvent.Action.OPEN_FILE);
public static final Action RUN_COMMAND = new Action(ClickEvent.Action.RUN_COMMAND);
public static final Action SUGGEST_COMMAND = new Action(ClickEvent.Action.SUGGEST_COMMAND);
public static final Action COPY_TO_CLIPBOARD = new Action(ClickEvent.Action.COPY_TO_CLIPBOARD);
}
}
Loading
Loading