From 86b6bcf1d1406b5a3517d9b2351e3792054a6163 Mon Sep 17 00:00:00 2001 From: Maximusbarcz Date: Sat, 7 Jan 2023 19:36:26 +0100 Subject: Added some more translations and also a Config GUI you can access by doing /ygasi config in game --- .../dev/mayaqq/ygasi/registry/CommandRegistry.java | 9 +++++---- .../dev/mayaqq/ygasi/registry/ConfigRegistry.java | 23 +++++++++++----------- 2 files changed, 17 insertions(+), 15 deletions(-) (limited to 'src/main/java/dev/mayaqq/ygasi/registry') diff --git a/src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java b/src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java index aa03f96..e2aaa05 100644 --- a/src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java +++ b/src/main/java/dev/mayaqq/ygasi/registry/CommandRegistry.java @@ -2,10 +2,7 @@ package dev.mayaqq.ygasi.registry; import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.context.CommandContext; -import dev.mayaqq.ygasi.gui.BranchGui; -import dev.mayaqq.ygasi.gui.DruidryGui; -import dev.mayaqq.ygasi.gui.MercenaryGui; -import dev.mayaqq.ygasi.gui.WizardryGui; +import dev.mayaqq.ygasi.gui.*; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.command.argument.EntityArgumentType; @@ -80,6 +77,10 @@ public class CommandRegistry { return 1; }))) .then(literal("config") + .executes(context -> { + ConfigGui.gui(context.getSource().getPlayer()); + return 1; + }) .then(literal("reload") .executes(context -> { ConfigRegistry.load(); diff --git a/src/main/java/dev/mayaqq/ygasi/registry/ConfigRegistry.java b/src/main/java/dev/mayaqq/ygasi/registry/ConfigRegistry.java index 0b5cfa5..2c939b3 100644 --- a/src/main/java/dev/mayaqq/ygasi/registry/ConfigRegistry.java +++ b/src/main/java/dev/mayaqq/ygasi/registry/ConfigRegistry.java @@ -5,10 +5,6 @@ import com.google.gson.GsonBuilder; import net.fabricmc.loader.api.FabricLoader; import java.io.*; -import java.nio.file.Files; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; public class ConfigRegistry { @@ -26,7 +22,7 @@ public class ConfigRegistry { if (!configFile.exists()) { try { configFile.createNewFile(); - saveConfig(); + save(); } catch (IOException e) { throw new RuntimeException(e); } @@ -39,11 +35,14 @@ public class ConfigRegistry { } } - public static void saveConfig() throws IOException { - //Write some info into the file under here - var writer = new FileWriter(configFile); - writer.write(gson.toJson(CONFIG)); - writer.close(); + public static void save() { + try { + FileWriter writer = new FileWriter(configFile); + gson.toJson(CONFIG, writer); + writer.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } } public static class Config { @@ -51,7 +50,9 @@ public class ConfigRegistry { public int pointsRewarded = 1; public int branchCost = 16; public Boolean enableSkillBook = true; - public int offence1Cost = 3; + public int T1Cost = 5; + public int T2Cost = 10; + public int T3Cost = 15; public Config() {} } -- cgit