Skip to content

Commit

Permalink
new: Placeholder API support!
Browse files Browse the repository at this point in the history
  • Loading branch information
CamperSamu committed Feb 24, 2022
1 parent 4d84651 commit 87b473e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ repositories {
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
maven { url 'https://oss.sonatype.org/content/repositories/snapshots'}
maven { url "https://maven.nucleoid.xyz/" }
}

dependencies {
Expand All @@ -30,7 +29,9 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modImplementation(include('me.lucko:fabric-permissions-api:0.1-SNAPSHOT'))

modImplementation include('me.lucko:fabric-permissions-api:0.1-SNAPSHOT')
modImplementation include("eu.pb4:placeholder-api:${project.placeholder_version}")
}

processResources {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ org.gradle.jvmargs=-Xmx1G

# Dependencies
fabric_version=0.46.2+1.18
placeholder_version=1.1.3+1.17.1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.campersamu.itemcommander.exception.CommanderException;
import com.campersamu.itemcommander.exception.CommanderNoCommandException;
import com.campersamu.itemcommander.exception.CommanderNoTagException;
import eu.pb4.placeholders.TextParser;
import eu.pb4.placeholders.util.TextParserUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
Expand Down Expand Up @@ -56,7 +58,7 @@ public static ActionResult executeCommand(Commander commander, ServerPlayerEntit
MinecraftServer server = player.server;

if (commander.source() == SERVER) {
final String parsedCommand = commander.command().replace("@p", player.getEntityName()).replace("@s", player.getEntityName());
final String parsedCommand = TextParser.parse(commander.command().replace("@p", player.getEntityName()).replace("@s", player.getEntityName())).getString();
server.getCommandManager().execute(server.getCommandSource(), parsedCommand);
} else if (commander.source() == PLAYER) {
server.getCommandManager().execute(player.getCommandSource(), commander.command());
Expand Down

0 comments on commit 87b473e

Please sign in to comment.