aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaximusbarcz <maxim.baranek@gmail.com>2023-01-07 20:49:03 +0100
committerMaximusbarcz <maxim.baranek@gmail.com>2023-01-07 20:49:03 +0100
commitab1ddc8e008ed93392ea3918da1d669dd1b4822c (patch)
tree433a63693e274cbe941f2b20481bf102c10807d4 /src
parent399d370aacfe3ba1aa6b400dd70ededa1014eb86 (diff)
downloadygasi-ab1ddc8e008ed93392ea3918da1d669dd1b4822c.tar.gz
ygasi-ab1ddc8e008ed93392ea3918da1d669dd1b4822c.tar.bz2
ygasi-ab1ddc8e008ed93392ea3918da1d669dd1b4822c.zip
Added even more translations!
Diffstat (limited to 'src')
-rw-r--r--src/main/java/dev/mayaqq/ygasi/Ygasi.java17
-rw-r--r--src/main/java/dev/mayaqq/ygasi/events/PlayerConnectEvent.java21
-rw-r--r--src/main/java/dev/mayaqq/ygasi/events/RegisterEvents.java7
-rw-r--r--src/main/java/dev/mayaqq/ygasi/gui/BranchGui.java21
-rw-r--r--src/main/java/dev/mayaqq/ygasi/gui/DruidryGui.java5
-rw-r--r--src/main/java/dev/mayaqq/ygasi/gui/ExtraGui.java5
-rw-r--r--src/main/java/dev/mayaqq/ygasi/gui/MercenaryGui.java7
-rw-r--r--src/main/java/dev/mayaqq/ygasi/gui/ResetGui.java9
-rw-r--r--src/main/java/dev/mayaqq/ygasi/gui/SkillGui.java1
-rw-r--r--src/main/java/dev/mayaqq/ygasi/gui/WizardryGui.java5
-rw-r--r--src/main/java/dev/mayaqq/ygasi/items/SkillBookItem.java1
-rw-r--r--src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java59
-rw-r--r--src/main/java/dev/mayaqq/ygasi/registry/StatRegistry.java2
-rw-r--r--src/main/resources/data/ygasi/lang/en_us.json16
14 files changed, 112 insertions, 64 deletions
diff --git a/src/main/java/dev/mayaqq/ygasi/Ygasi.java b/src/main/java/dev/mayaqq/ygasi/Ygasi.java
index 5c598ee..5f1605d 100644
--- a/src/main/java/dev/mayaqq/ygasi/Ygasi.java
+++ b/src/main/java/dev/mayaqq/ygasi/Ygasi.java
@@ -1,5 +1,6 @@
package dev.mayaqq.ygasi;
+import dev.mayaqq.ygasi.events.RegisterEvents;
import dev.mayaqq.ygasi.items.SkillBookItem;
import dev.mayaqq.ygasi.registry.CommandRegistry;
import dev.mayaqq.ygasi.registry.ConfigRegistry;
@@ -10,7 +11,6 @@ import eu.pb4.polymer.api.item.PolymerItemUtils;
import eu.pb4.polymer.api.resourcepack.PolymerModelData;
import eu.pb4.polymer.api.resourcepack.PolymerRPUtils;
import net.fabricmc.api.ModInitializer;
-import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
@@ -29,9 +29,10 @@ public class Ygasi implements ModInitializer {
@Override
public void onInitialize() {
- StatRegistry.skillRegister();
- CommandRegistry.RegisterCommands();
ConfigRegistry.load();
+ StatRegistry.register();
+ CommandRegistry.register();
+ RegisterEvents.register();
PolymerRPUtils.addAssetSource("ygasi");
PolymerModelData modelData = PolymerRPUtils.requestModel(Items.BOOK, new Identifier("ygasi", "item/skill_book"));
@@ -39,15 +40,5 @@ public class Ygasi implements ModInitializer {
Registry.register(Registry.ITEM, "ygasi:skill_book", SKILL_BOOK);
LOGGER.info("You've got a skill issue!");
-
- if (ConfigRegistry.CONFIG.enableSkillBook) {
- ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> {
- if (!handler.player.getScoreboardTags().contains("skill_book_unlocked")) {
- handler.player.addScoreboardTag("skill_book_unlocked");
- handler.player.getInventory().offerOrDrop(new ItemStack(SKILL_BOOK));
- YgasiUtils.grantAdvancementCriterion(handler.player, new Identifier("ygasi", "recipes/minecraft_ygasi/skill_book"), "opened_skill_menu");
- }
- });
- }
}
} \ No newline at end of file
diff --git a/src/main/java/dev/mayaqq/ygasi/events/PlayerConnectEvent.java b/src/main/java/dev/mayaqq/ygasi/events/PlayerConnectEvent.java
new file mode 100644
index 0000000..26b5051
--- /dev/null
+++ b/src/main/java/dev/mayaqq/ygasi/events/PlayerConnectEvent.java
@@ -0,0 +1,21 @@
+package dev.mayaqq.ygasi.events;
+
+import dev.mayaqq.ygasi.registry.ConfigRegistry;
+import dev.mayaqq.ygasi.util.YgasiUtils;
+import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.Identifier;
+
+import static dev.mayaqq.ygasi.Ygasi.SKILL_BOOK;
+
+public class PlayerConnectEvent {
+ public static void onJoin() {
+ ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> {
+ if (!handler.player.getScoreboardTags().contains("skill_book_unlocked") && ConfigRegistry.CONFIG.enableSkillBook) {
+ handler.player.addScoreboardTag("skill_book_unlocked");
+ handler.player.getInventory().offerOrDrop(new ItemStack(SKILL_BOOK));
+ YgasiUtils.grantAdvancementCriterion(handler.player, new Identifier("ygasi", "recipes/minecraft_ygasi/skill_book"), "opened_skill_menu");
+ }
+ });
+ }
+} \ No newline at end of file
diff --git a/src/main/java/dev/mayaqq/ygasi/events/RegisterEvents.java b/src/main/java/dev/mayaqq/ygasi/events/RegisterEvents.java
new file mode 100644
index 0000000..08476f1
--- /dev/null
+++ b/src/main/java/dev/mayaqq/ygasi/events/RegisterEvents.java
@@ -0,0 +1,7 @@
+package dev.mayaqq.ygasi.events;
+
+public class RegisterEvents {
+ public static void register() {
+ PlayerConnectEvent.onJoin();
+ }
+}
diff --git a/src/main/java/dev/mayaqq/ygasi/gui/BranchGui.java b/src/main/java/dev/mayaqq/ygasi/gui/BranchGui.java
index 71be174..d4cb050 100644
--- a/src/main/java/dev/mayaqq/ygasi/gui/BranchGui.java
+++ b/src/main/java/dev/mayaqq/ygasi/gui/BranchGui.java
@@ -18,12 +18,11 @@ import net.minecraft.util.Identifier;
public class BranchGui {
public static void gui(ServerPlayerEntity player) {
- int skillPoints = player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS));
-
try {
SkillGui gui = new SkillGui(ScreenHandlerType.GENERIC_9X3, player, false) {};
- gui.setTitle(Text.translatable("gui.ygasi.branch.title", skillPoints));
+ //the title of the gui
+ gui.setTitle(Text.translatable("gui.ygasi.branch.title", player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS))).formatted(Formatting.DARK_AQUA));
//background items
for (int x = 0; x <= 26; x++) {
@@ -48,6 +47,7 @@ public class BranchGui {
}
//branch items
+ //mercenary gui button
if (!YgasiUtils.getAdvancementProgress(player, "minecraft", "ygasi/mercenary")) {
gui.setSlot(11, new GuiElementBuilder()
.setItem(Items.DIAMOND_SWORD)
@@ -67,6 +67,7 @@ public class BranchGui {
);
}
+ //wizardry gui button
if (!YgasiUtils.getAdvancementProgress(player, "minecraft", "ygasi/wizardry")) {
gui.setSlot(13, new GuiElementBuilder()
.setItem(Items.BLAZE_ROD)
@@ -83,6 +84,7 @@ public class BranchGui {
);
}
+ //druidry gui button
if (!YgasiUtils.getAdvancementProgress(player, "minecraft", "ygasi/druidry")) {
gui.setSlot(15, new GuiElementBuilder()
.setItem(Items.OAK_SAPLING)
@@ -99,6 +101,7 @@ public class BranchGui {
);
}
+ //extra gui button
if (!YgasiUtils.getAdvancementProgress(player, "minecraft", "ygasi/extra")) {
gui.setSlot(26, new GuiElementBuilder()
.setItem(Items.BOOK)
@@ -115,7 +118,7 @@ public class BranchGui {
);
}
- //info item
+ //info item button
gui.setSlot(18, new GuiElementBuilder()
.setItem(Items.PAPER)
.setName(Text.translatable("gui.ygasi.branch.info.title"))
@@ -124,7 +127,7 @@ public class BranchGui {
player.sendMessage(Text.translatable("gui.ygasi.branch.info.main"), false);
})
);
- //reset item
+ //reset item button
gui.setSlot(8, new GuiElementBuilder()
.setItem(Items.BARRIER)
.setName(Text.translatable("gui.ygasi.branch.reset.title"))
@@ -133,6 +136,7 @@ public class BranchGui {
.setCallback((index, clickType, actionType) -> ResetGui.gui(player))
);
+ //grant the player the root advancement of ygasi
YgasiUtils.grantAdvancementCriterion(player, new Identifier("minecraft", "ygasi/root"), "opened_skill_menu");
gui.open();
@@ -140,7 +144,9 @@ public class BranchGui {
e.printStackTrace();
}
}
+ //this happens when you try to unlock a branch
public static void save(ServerPlayerEntity player, String branch, String branchName) {
+ //special category for extra branch because it's half the price
if (branch.equals("extra")) {
if (player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)) >= ConfigRegistry.CONFIG.branchCost / 2) {
player.getStatHandler().setStat(player, Stats.CUSTOM.getOrCreateStat(SKILL_POINTS), player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)) - ConfigRegistry.CONFIG.branchCost / 2);
@@ -150,11 +156,14 @@ public class BranchGui {
} else {
player.sendMessage(Text.translatable("gui.ygasi.branch.no.skill"), false);
}
+ //the rest of the branches
} else {
+ //same code as in extra
if (player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)) >= ConfigRegistry.CONFIG.branchCost) {
player.getStatHandler().setStat(player, Stats.CUSTOM.getOrCreateStat(SKILL_POINTS), player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)) - ConfigRegistry.CONFIG.branchCost);
player.sendMessage(Text.translatable("gui.ygasi.branch.unlock", Text.translatable(branchName)), false);
player.closeHandledScreen();
+ //grant the player the advancement of the branch they unlocked
switch (branch) {
case "mercenary" -> {
YgasiUtils.grantAdvancementCriterion(player, new Identifier("minecraft", "ygasi/mercenary"), "unlocked_mercenary");
@@ -169,7 +178,7 @@ public class BranchGui {
DruidryGui.gui(player);
}
}
-
+ //if the player doesn't have enough skill points
} else {
player.sendMessage(Text.translatable("gui.ygasi.branch.no.skill"), false);
player.closeHandledScreen();
diff --git a/src/main/java/dev/mayaqq/ygasi/gui/DruidryGui.java b/src/main/java/dev/mayaqq/ygasi/gui/DruidryGui.java
index 748f9b3..64e3db3 100644
--- a/src/main/java/dev/mayaqq/ygasi/gui/DruidryGui.java
+++ b/src/main/java/dev/mayaqq/ygasi/gui/DruidryGui.java
@@ -12,14 +12,15 @@ import static dev.mayaqq.ygasi.registry.StatRegistry.SKILL_POINTS;
public class DruidryGui {
public static void gui(ServerPlayerEntity player) {
+ String title = Text.translatable("gui.ygasi.branch.druidry.title").getString() + " " + Text.translatable("gui.ygasi.branch.title", player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS))).getString();
try {
if (!YgasiUtils.getAdvancementProgress(player, "minecraft", "ygasi/druidry")) {
- player.sendMessage(Text.of("§cYou have not unlocked this branch yet!"), false);
+ player.sendMessage(Text.translatable("gui.ygasi.branches.fail"), false);
BranchGui.gui(player);
} else {
SkillGui gui = new SkillGui(ScreenHandlerType.GENERIC_9X6, player, false) {};
- gui.setTitle(Text.of( "§a§lDruidry " + "§3Skill Points: " + player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS))));
+ gui.setTitle(Text.of(title));
for (int x = 0; x <= 53; x++) {
gui.setSlot(x, new GuiElementBuilder()
diff --git a/src/main/java/dev/mayaqq/ygasi/gui/ExtraGui.java b/src/main/java/dev/mayaqq/ygasi/gui/ExtraGui.java
index 04cfc98..268535b 100644
--- a/src/main/java/dev/mayaqq/ygasi/gui/ExtraGui.java
+++ b/src/main/java/dev/mayaqq/ygasi/gui/ExtraGui.java
@@ -12,14 +12,15 @@ import static dev.mayaqq.ygasi.registry.StatRegistry.SKILL_POINTS;
public class ExtraGui {
public static void gui(ServerPlayerEntity player) {
+ String title = Text.translatable("gui.ygasi.branch.extra.title").getString() + " " + Text.translatable("gui.ygasi.branch.title", player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS))).getString();
try {
if (!YgasiUtils.getAdvancementProgress(player, "minecraft", "ygasi/extra")) {
- player.sendMessage(Text.of("§cYou have not unlocked this branch yet!"), false);
+ player.sendMessage(Text.translatable("gui.ygasi.branches.fail"), false);
BranchGui.gui(player);
} else {
SkillGui gui = new SkillGui(ScreenHandlerType.GENERIC_9X3, player, false) {};
- gui.setTitle(Text.of( "§9§lExtra " + "§3Skill Points: " + player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS))));
+ gui.setTitle(Text.of( title));
for (int x = 0; x <= 26; x++) {
gui.setSlot(x, new GuiElementBuilder()
diff --git a/src/main/java/dev/mayaqq/ygasi/gui/MercenaryGui.java b/src/main/java/dev/mayaqq/ygasi/gui/MercenaryGui.java
index 666c802..43d06ed 100644
--- a/src/main/java/dev/mayaqq/ygasi/gui/MercenaryGui.java
+++ b/src/main/java/dev/mayaqq/ygasi/gui/MercenaryGui.java
@@ -1,6 +1,5 @@
package dev.mayaqq.ygasi.gui;
-import dev.mayaqq.ygasi.registry.ConfigRegistry;
import dev.mayaqq.ygasi.util.YgasiUtils;
import eu.pb4.sgui.api.elements.GuiElementBuilder;
import net.minecraft.item.Items;
@@ -8,19 +7,21 @@ import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.stat.Stats;
import net.minecraft.text.Text;
+import net.minecraft.util.Formatting;
import static dev.mayaqq.ygasi.registry.StatRegistry.SKILL_POINTS;
public class MercenaryGui {
public static void gui(ServerPlayerEntity player) {
+ String title = Text.translatable("gui.ygasi.branch.mercenary.title").getString() + " " + Text.translatable("gui.ygasi.branch.title", player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS))).formatted(Formatting.DARK_AQUA).getString();
try {
if (!YgasiUtils.getAdvancementProgress(player, "minecraft", "ygasi/mercenary")) {
- player.sendMessage(Text.of("§cYou have not unlocked this branch yet!"), false);
+ player.sendMessage(Text.translatable("gui.ygasi.branches.fail"), false);
BranchGui.gui(player);
} else {
SkillGui gui = new SkillGui(ScreenHandlerType.GENERIC_9X6, player, false) {};
- gui.setTitle(Text.of( "§c§lMercenary " + "§3Skill Points: " + player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS))));
+ gui.setTitle(Text.of(title));
//background items
for (int x = 0; x <= 53; x++) {
gui.setSlot(x, new GuiElementBuilder()
diff --git a/src/main/java/dev/mayaqq/ygasi/gui/ResetGui.java b/src/main/java/dev/mayaqq/ygasi/gui/ResetGui.java
index 95c8206..a976929 100644
--- a/src/main/java/dev/mayaqq/ygasi/gui/ResetGui.java
+++ b/src/main/java/dev/mayaqq/ygasi/gui/ResetGui.java
@@ -2,7 +2,6 @@ package dev.mayaqq.ygasi.gui;
import dev.mayaqq.ygasi.util.YgasiUtils;
import eu.pb4.sgui.api.elements.GuiElementBuilder;
-import net.minecraft.advancement.Advancement;
import net.minecraft.item.Items;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.server.network.ServerPlayerEntity;
@@ -29,14 +28,14 @@ public class ResetGui {
gui.setSlot(12, new GuiElementBuilder()
.setItem(Items.GREEN_CONCRETE)
- .setName(Text.translatable("gui.ygasi.reset.confirm"))
+ .setName(Text.translatable("gui.ygasi.reset.confirm.title"))
.addLoreLine(Text.translatable("gui.ygasi.reset.confirm.lore"))
.setCallback((index, clickType, actionType) -> reset(player))
);
gui.setSlot(14, new GuiElementBuilder()
.setItem(Items.RED_CONCRETE)
- .setName(Text.translatable("gui.ygasi.reset.deny"))
+ .setName(Text.translatable("gui.ygasi.reset.deny.title"))
.addLoreLine(Text.translatable("gui.ygasi.reset.deny.lore"))
.setCallback((index, clickType, actionType) -> BranchGui.gui(player))
);
@@ -50,11 +49,11 @@ public class ResetGui {
player.experienceLevel -= 10;
player.closeHandledScreen();
YgasiUtils.revokeAllAdvancements(player, "minecraft", "ygasi/");
- player.sendMessage(Text.translatable("gui.ygasi.branch.reset.main"), false);
+ player.sendMessage(Text.translatable("gui.ygasi.reset.success"), false);
player.getStatHandler().setStat(player, Stats.CUSTOM.getOrCreateStat(SKILL_POINTS), player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS_TOTAL)));
BranchGui.gui(player);
} else {
- player.sendMessage(Text.translatable("gui.ygasi.branch.reset.no.xp"), false);
+ player.sendMessage(Text.translatable("gui.ygasi.reset.fail"), false);
player.closeHandledScreen();
}
}
diff --git a/src/main/java/dev/mayaqq/ygasi/gui/SkillGui.java b/src/main/java/dev/mayaqq/ygasi/gui/SkillGui.java
index d12375d..f453379 100644
--- a/src/main/java/dev/mayaqq/ygasi/gui/SkillGui.java
+++ b/src/main/java/dev/mayaqq/ygasi/gui/SkillGui.java
@@ -7,6 +7,7 @@ import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
public class SkillGui extends SimpleGui {
+ // I'm doing the onOpen and onClose methods here because I want to play a sound when the gui is opened and closed for all of the guis so I don't have to do it in every gui class
public SkillGui(ScreenHandlerType<?> type, ServerPlayerEntity player, boolean manipulatePlayerSlots) {
super(type, player, manipulatePlayerSlots);
}
diff --git a/src/main/java/dev/mayaqq/ygasi/gui/WizardryGui.java b/src/main/java/dev/mayaqq/ygasi/gui/WizardryGui.java
index 499f911..9dfc5dc 100644
--- a/src/main/java/dev/mayaqq/ygasi/gui/WizardryGui.java
+++ b/src/main/java/dev/mayaqq/ygasi/gui/WizardryGui.java
@@ -12,14 +12,15 @@ import static dev.mayaqq.ygasi.registry.StatRegistry.SKILL_POINTS;
public class WizardryGui {
public static void gui(ServerPlayerEntity player) {
+ String title = Text.translatable("gui.ygasi.branch.wizardry.title").getString() + " " + Text.translatable("gui.ygasi.branch.title", player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS))).getString();
try {
if (!YgasiUtils.getAdvancementProgress(player, "minecraft", "ygasi/wizardry")) {
- player.sendMessage(Text.of("§cYou have not unlocked this branch yet!"), false);
+ player.sendMessage(Text.translatable("gui.ygasi.branches.fail"), false);
BranchGui.gui(player);
} else {
SkillGui gui = new SkillGui(ScreenHandlerType.GENERIC_9X6, player, false) {};
- gui.setTitle(Text.of( "§5§lWizardry " + "§3Skill Points: " + player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS))));
+ gui.setTitle(Text.of(title));
for (int x = 0; x <= 53; x++) {
gui.setSlot(x, new GuiElementBuilder()
diff --git a/src/main/java/dev/mayaqq/ygasi/items/SkillBookItem.java b/src/main/java/dev/mayaqq/ygasi/items/SkillBookItem.java
index 52f2c8d..9376277 100644
--- a/src/main/java/dev/mayaqq/ygasi/items/SkillBookItem.java
+++ b/src/main/java/dev/mayaqq/ygasi/items/SkillBookItem.java
@@ -4,7 +4,6 @@ import dev.mayaqq.ygasi.gui.BranchGui;
import eu.pb4.polymer.api.item.PolymerItemUtils;
import eu.pb4.polymer.api.item.SimplePolymerItem;
import net.minecraft.client.item.TooltipContext;
-import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
diff --git a/src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java b/src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java
index e2aaa05..44ba603 100644
--- a/src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java
+++ b/src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java
@@ -11,6 +11,7 @@ import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.stat.Stats;
import net.minecraft.text.Text;
+import net.minecraft.util.Formatting;
import java.io.File;
@@ -19,7 +20,7 @@ import static dev.mayaqq.ygasi.registry.StatRegistry.SKILL_POINTS_TOTAL;
import static net.minecraft.server.command.CommandManager.literal;
public class CommandRegistry {
- public static void RegisterCommands() {
+ public static void register() {
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher.register(literal("skilltree")
.executes(context -> {
ServerPlayerEntity player = context.getSource().getPlayer();
@@ -50,32 +51,34 @@ public class CommandRegistry {
));
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher.register(literal("ygasi")
.requires(source -> source.hasPermissionLevel(4))
- .then(literal("reset")
- .then(CommandManager.argument("target", EntityArgumentType.player())
- .executes(context -> {
- ServerPlayerEntity player = EntityArgumentType.getPlayer(context, "target");
- player.resetStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS));
- player.resetStat(Stats.CUSTOM.getOrCreateStat(StatRegistry.SKILL_POINTS_TOTAL));
- context.getSource().sendMessage(Text.literal("§aSkill Points reset to 0 for " + player.getEntityName() + "."));
- return 1;
- })))
- .then(literal("add")
- .then(CommandManager.argument("target", EntityArgumentType.player())
- .then(CommandManager.argument("amount", IntegerArgumentType.integer())
- .executes(context -> {
- ServerPlayerEntity player = EntityArgumentType.getPlayer(context, "target");
- player.increaseStat(SKILL_POINTS, IntegerArgumentType.getInteger(context, "amount"));
- player.increaseStat(SKILL_POINTS_TOTAL, IntegerArgumentType.getInteger(context, "amount"));
- context.getSource().sendMessage(Text.literal("§aSkill Points increased by " + IntegerArgumentType.getInteger(context, "amount") + " for " + player.getEntityName() + "."));
- return 1;
- }))))
- .then(literal("get")
- .then(CommandManager.argument("target", EntityArgumentType.player())
- .executes(context -> {
- ServerPlayerEntity player = EntityArgumentType.getPlayer(context, "target");
- context.getSource().sendMessage(Text.literal("§a" + player.getEntityName() + " has " + player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)) + " Unspent Skill Points and " + player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS_TOTAL)) + " Total Skill Points."));
- return 1;
- })))
+ .then(literal("skillpoints")
+ .then(literal("reset")
+ .then(CommandManager.argument("target", EntityArgumentType.player())
+ .executes(context -> {
+ ServerPlayerEntity player = EntityArgumentType.getPlayer(context, "target");
+ player.resetStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS));
+ player.resetStat(Stats.CUSTOM.getOrCreateStat(StatRegistry.SKILL_POINTS_TOTAL));
+ context.getSource().sendMessage(Text.translatable("commands.ygasi.skillpoints.reset", player.getEntityName()).formatted(Formatting.GREEN));
+ return 1;
+ })))
+ .then(literal("add")
+ .then(CommandManager.argument("target", EntityArgumentType.player())
+ .then(CommandManager.argument("amount", IntegerArgumentType.integer())
+ .executes(context -> {
+ int amount = IntegerArgumentType.getInteger(context, "amount");
+ ServerPlayerEntity player = EntityArgumentType.getPlayer(context, "target");
+ player.increaseStat(SKILL_POINTS, amount);
+ player.increaseStat(SKILL_POINTS_TOTAL, amount);
+ player.sendMessage(Text.translatable("commands.ygasi.skillpoints.add", amount, player.getName()).formatted(Formatting.GREEN));
+ return 1;
+ }))))
+ .then(literal("get")
+ .then(CommandManager.argument("target", EntityArgumentType.player())
+ .executes(context -> {
+ ServerPlayerEntity player = EntityArgumentType.getPlayer(context, "target");
+ context.getSource().sendMessage(Text.translatable("commands.ygasi.skillpoints.get", player.getEntityName(), player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)), player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS_TOTAL))).formatted(Formatting.GREEN));
+ return 1;
+ }))))
.then(literal("config")
.executes(context -> {
ConfigGui.gui(context.getSource().getPlayer());
@@ -84,7 +87,7 @@ public class CommandRegistry {
.then(literal("reload")
.executes(context -> {
ConfigRegistry.load();
- context.getSource().sendMessage(Text.literal("§aConfig reloaded!"));
+ context.getSource().sendMessage(Text.translatable("commands.ygasi.config.reload").formatted(Formatting.GREEN));
return 1;
})))
diff --git a/src/main/java/dev/mayaqq/ygasi/registry/StatRegistry.java b/src/main/java/dev/mayaqq/ygasi/registry/StatRegistry.java
index 4dbdbd3..039b0b6 100644
--- a/src/main/java/dev/mayaqq/ygasi/registry/StatRegistry.java
+++ b/src/main/java/dev/mayaqq/ygasi/registry/StatRegistry.java
@@ -9,5 +9,5 @@ public class StatRegistry {
public static Identifier SKILL_POINTS = PolymerStat.registerStat("skill_points", StatFormatter.DEFAULT);
public static Identifier SKILL_POINTS_TOTAL = PolymerStat.registerStat("skill_points_total", StatFormatter.DEFAULT);
- public static void skillRegister() {}
+ public static void register() {}
}
diff --git a/src/main/resources/data/ygasi/lang/en_us.json b/src/main/resources/data/ygasi/lang/en_us.json
index 658fb17..5c76f23 100644
--- a/src/main/resources/data/ygasi/lang/en_us.json
+++ b/src/main/resources/data/ygasi/lang/en_us.json
@@ -4,7 +4,12 @@
"creative.ygasi.group": "Ygasi",
- "gui.ygasi.branch.title": "§3Skill Points: %d",
+ "commands.ygasi.skillpoints.reset": "Skill Points reset to 0 for %s.",
+ "commands.ygasi.skillpoints.add": "Skill Points increased by %d for %s.",
+ "commands.ygasi.skillpoints.get": "%s has %d unspent Skill Points and %d total Skill Points.",
+ "commands.ygasi.config.reload": "Config reloaded.",
+
+ "gui.ygasi.branch.title": "Skill Points: %d",
"gui.ygasi.branch.mercenary.title": "§c§lMercenary",
"gui.ygasi.branch.wizardry.title": "§5§lWizardry",
"gui.ygasi.branch.druidry.title": "§a§lDruidry",
@@ -19,6 +24,15 @@
"gui.ygasi.branch.unlock": "§aYou have unlocked the %s branch!",
"gui.ygasi.branch.no.skill": "§cYou don't have enough skill points to unlock this branch!",
+ "gui.ygasi.reset.confirm.title": "§a§lConfirm",
+ "gui.ygasi.reset.confirm.lore": "§8Are you sure?",
+ "gui.ygasi.reset.deny.title": "§c§lDeny",
+ "gui.ygasi.reset.deny.lore": "§8Go back",
+ "gui.ygasi.reset.success": "§aYou have reset your skills!",
+ "gui.ygasi.reset.fail": "§cYou don't have enough skill points to reset your skills!",
+
+ "gui.ygasi.branches.fail": "§cYou have not unlocked this branch yet!",
+
"config.ygasi.title": "§5§lYgasi Config",
"config.ygasi.pointsRewarded.title": "Points rewarded per advancement",
"config.ygasi.branchCost.title": "Branch Cost",