feat: 1.20

This commit is contained in:
iGalaxy 2023-06-19 02:51:44 -07:00
parent 21eb74fe48
commit d127090fe2
No known key found for this signature in database
GPG key ID: 97D00692150C2483
4 changed files with 10 additions and 16 deletions

View file

@ -34,10 +34,6 @@ dependencies {
modImplementation(libs.placeholder.api)
include(libs.placeholder.api)
// more-codecs
modImplementation(libs.more.codecs)
include(libs.more.codecs)
// fabric-api-permissions
modImplementation(libs.fabric.permissions)
include(libs.fabric.permissions)

View file

@ -1,12 +1,11 @@
[versions]
minecraft = "1.19.3"
yarn = "1.19.3+build.5"
minecraft = "1.20.1"
yarn = "1.20.1+build.2"
fabric-loader = "0.14.11"
fabric-api = "0.69.1+1.19.3"
fabric-loader = "0.14.21"
fabric-api = "0.83.1+1.20.1"
placeholder-api = "2.0.0-pre.2+1.19.3"
more-codecs = "0.3.0+1.19.3"
placeholder-api = "2.1.1+1.20"
fabric-permissions = "0.1-SNAPSHOT"
@ -18,6 +17,5 @@ fabric-loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric-l
fabric-api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric-api" }
placeholder-api = { module = "eu.pb4:placeholder-api", version.ref = "placeholder-api" }
more-codecs = { module = "xyz.nucleoid:more-codecs", version.ref = "more-codecs" }
fabric-permissions = { module = "me.lucko:fabric-permissions-api", version.ref = "fabric-permissions" }

View file

@ -41,7 +41,7 @@ public class PronounsCommand {
if (!PlayerPronouns.setPronouns(player, pronouns)) {
ctx.getSource().sendError(Text.literal("Failed to update pronouns, sorry"));
} else {
ctx.getSource().sendFeedback(Text.literal("Updated your pronouns to ")
ctx.getSource().sendFeedback(() -> Text.literal("Updated your pronouns to ")
.append(pronouns.formatted())
.formatted(Formatting.GREEN), false);
}
@ -52,7 +52,7 @@ public class PronounsCommand {
.requires(ctx -> Permissions.check(ctx, "playerpronouns.reload_config", 4))
.executes(ctx -> {
PlayerPronouns.reloadConfig();
ctx.getSource().sendFeedback(Text.literal("Reloaded the config!").formatted(Formatting.GREEN), true);
ctx.getSource().sendFeedback(() -> Text.literal("Reloaded the config!").formatted(Formatting.GREEN), true);
return Command.SINGLE_SUCCESS;
})
).then(literal("unset")
@ -61,7 +61,7 @@ public class PronounsCommand {
if (!PlayerPronouns.setPronouns(player, null)) {
ctx.getSource().sendError(Text.literal("Failed to update pronouns, sorry"));
} else {
ctx.getSource().sendFeedback(Text.literal("Cleared your pronouns!")
ctx.getSource().sendFeedback(() -> Text.literal("Cleared your pronouns!")
.formatted(Formatting.GREEN), false);
}
return Command.SINGLE_SUCCESS;

View file

@ -3,7 +3,7 @@ package io.github.ashisbored.playerpronouns.data;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.text.Text;
import xyz.nucleoid.codecs.MoreCodecs;
import net.minecraft.util.dynamic.Codecs;
public record Pronouns(
String raw,
@ -12,7 +12,7 @@ public record Pronouns(
) {
public static final Codec<Pronouns> CODEC = RecordCodecBuilder.create(instance -> instance.group(
Codec.STRING.fieldOf("raw").forGetter(Pronouns::raw),
MoreCodecs.TEXT.fieldOf("formatted").forGetter(Pronouns::formatted),
Codecs.TEXT.fieldOf("formatted").forGetter(Pronouns::formatted),
Codec.BOOL.optionalFieldOf("remote", false).forGetter(Pronouns::remote)
).apply(instance, Pronouns::new));
}