mirror of
https://github.com/ashhhleyyy/player-pronouns.git
synced 2024-11-01 07:07:38 +00:00
feat: 1.20
This commit is contained in:
parent
21eb74fe48
commit
d127090fe2
4 changed files with 10 additions and 16 deletions
|
@ -34,10 +34,6 @@ dependencies {
|
||||||
modImplementation(libs.placeholder.api)
|
modImplementation(libs.placeholder.api)
|
||||||
include(libs.placeholder.api)
|
include(libs.placeholder.api)
|
||||||
|
|
||||||
// more-codecs
|
|
||||||
modImplementation(libs.more.codecs)
|
|
||||||
include(libs.more.codecs)
|
|
||||||
|
|
||||||
// fabric-api-permissions
|
// fabric-api-permissions
|
||||||
modImplementation(libs.fabric.permissions)
|
modImplementation(libs.fabric.permissions)
|
||||||
include(libs.fabric.permissions)
|
include(libs.fabric.permissions)
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
[versions]
|
[versions]
|
||||||
minecraft = "1.19.3"
|
minecraft = "1.20.1"
|
||||||
yarn = "1.19.3+build.5"
|
yarn = "1.20.1+build.2"
|
||||||
|
|
||||||
fabric-loader = "0.14.11"
|
fabric-loader = "0.14.21"
|
||||||
fabric-api = "0.69.1+1.19.3"
|
fabric-api = "0.83.1+1.20.1"
|
||||||
|
|
||||||
placeholder-api = "2.0.0-pre.2+1.19.3"
|
placeholder-api = "2.1.1+1.20"
|
||||||
more-codecs = "0.3.0+1.19.3"
|
|
||||||
|
|
||||||
fabric-permissions = "0.1-SNAPSHOT"
|
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" }
|
fabric-api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric-api" }
|
||||||
|
|
||||||
placeholder-api = { module = "eu.pb4:placeholder-api", version.ref = "placeholder-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" }
|
fabric-permissions = { module = "me.lucko:fabric-permissions-api", version.ref = "fabric-permissions" }
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class PronounsCommand {
|
||||||
if (!PlayerPronouns.setPronouns(player, pronouns)) {
|
if (!PlayerPronouns.setPronouns(player, pronouns)) {
|
||||||
ctx.getSource().sendError(Text.literal("Failed to update pronouns, sorry"));
|
ctx.getSource().sendError(Text.literal("Failed to update pronouns, sorry"));
|
||||||
} else {
|
} else {
|
||||||
ctx.getSource().sendFeedback(Text.literal("Updated your pronouns to ")
|
ctx.getSource().sendFeedback(() -> Text.literal("Updated your pronouns to ")
|
||||||
.append(pronouns.formatted())
|
.append(pronouns.formatted())
|
||||||
.formatted(Formatting.GREEN), false);
|
.formatted(Formatting.GREEN), false);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class PronounsCommand {
|
||||||
.requires(ctx -> Permissions.check(ctx, "playerpronouns.reload_config", 4))
|
.requires(ctx -> Permissions.check(ctx, "playerpronouns.reload_config", 4))
|
||||||
.executes(ctx -> {
|
.executes(ctx -> {
|
||||||
PlayerPronouns.reloadConfig();
|
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;
|
return Command.SINGLE_SUCCESS;
|
||||||
})
|
})
|
||||||
).then(literal("unset")
|
).then(literal("unset")
|
||||||
|
@ -61,7 +61,7 @@ public class PronounsCommand {
|
||||||
if (!PlayerPronouns.setPronouns(player, null)) {
|
if (!PlayerPronouns.setPronouns(player, null)) {
|
||||||
ctx.getSource().sendError(Text.literal("Failed to update pronouns, sorry"));
|
ctx.getSource().sendError(Text.literal("Failed to update pronouns, sorry"));
|
||||||
} else {
|
} else {
|
||||||
ctx.getSource().sendFeedback(Text.literal("Cleared your pronouns!")
|
ctx.getSource().sendFeedback(() -> Text.literal("Cleared your pronouns!")
|
||||||
.formatted(Formatting.GREEN), false);
|
.formatted(Formatting.GREEN), false);
|
||||||
}
|
}
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package io.github.ashisbored.playerpronouns.data;
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import xyz.nucleoid.codecs.MoreCodecs;
|
import net.minecraft.util.dynamic.Codecs;
|
||||||
|
|
||||||
public record Pronouns(
|
public record Pronouns(
|
||||||
String raw,
|
String raw,
|
||||||
|
@ -12,7 +12,7 @@ public record Pronouns(
|
||||||
) {
|
) {
|
||||||
public static final Codec<Pronouns> CODEC = RecordCodecBuilder.create(instance -> instance.group(
|
public static final Codec<Pronouns> CODEC = RecordCodecBuilder.create(instance -> instance.group(
|
||||||
Codec.STRING.fieldOf("raw").forGetter(Pronouns::raw),
|
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)
|
Codec.BOOL.optionalFieldOf("remote", false).forGetter(Pronouns::remote)
|
||||||
).apply(instance, Pronouns::new));
|
).apply(instance, Pronouns::new));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue