From 473701cab995f3e9bfdf8b4232ad5fa9cd6c3eec Mon Sep 17 00:00:00 2001 From: Tobias de Bruijn Date: Wed, 28 Sep 2022 21:38:16 +0200 Subject: [PATCH] Fixes: - Fixed typo - Fixed argument position for global command vs subcommand - 1.19.2 support (1.19.1 too I think) --- .../java/dev/array21/skinfixer/SkinChangeHandler.java | 5 ++++- src/main/java/dev/array21/skinfixer/SkinFixer.java | 2 +- .../dev/array21/skinfixer/commands/CommandHandler.java | 8 ++++---- .../skinfixer/commands/subcommands/DirectCommand.java | 2 +- .../dev/array21/skinfixer/language/LanguageModel.java | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/dev/array21/skinfixer/SkinChangeHandler.java b/src/main/java/dev/array21/skinfixer/SkinChangeHandler.java index 14b9bbf..2120193 100644 --- a/src/main/java/dev/array21/skinfixer/SkinChangeHandler.java +++ b/src/main/java/dev/array21/skinfixer/SkinChangeHandler.java @@ -271,7 +271,10 @@ private Object getGameProfile(Object entityPlayer) throws Exception { Class entityHumanClass = ReflectionUtil.getMinecraftClass("world.entity.player.EntityHuman"); return switch(ReflectionUtil.getMajorVersion()) { - case 19 -> ReflectionUtil.invokeMethod(entityHumanClass, entityPlayer, "fz"); + case 19 -> switch(ReflectionUtil.getMinorVersion()) { + case 1, 2 -> ReflectionUtil.invokeMethod(entityHumanClass, entityPlayer, "fy"); + default -> ReflectionUtil.invokeMethod(entityHumanClass, entityPlayer, "fz"); + }; case 18 -> switch(ReflectionUtil.getMinorVersion()) { case 2 -> ReflectionUtil.invokeMethod(entityHumanClass, entityPlayer, "fq"); default -> ReflectionUtil.invokeMethod(entityHumanClass, entityPlayer, "fp"); diff --git a/src/main/java/dev/array21/skinfixer/SkinFixer.java b/src/main/java/dev/array21/skinfixer/SkinFixer.java index a32b081..0808d32 100644 --- a/src/main/java/dev/array21/skinfixer/SkinFixer.java +++ b/src/main/java/dev/array21/skinfixer/SkinFixer.java @@ -34,7 +34,7 @@ public void onEnable() { PLUGIN_VERSION = this.getDescription().getVersion(); LOGGER = this.getLogger(); - SkinFixer.logInfo("Welcome to SkinFixer version " + PLUGIN_VERSION + " by TheDutchMC! (Extra /direct Command added by Sw3d15h_F1s4)"); + SkinFixer.logInfo("Welcome to SkinFixer version " + PLUGIN_VERSION + " by TheDutchMC!"); //Read the configuration this.configHandler = new ConfigHandler(this); diff --git a/src/main/java/dev/array21/skinfixer/commands/CommandHandler.java b/src/main/java/dev/array21/skinfixer/commands/CommandHandler.java index 7f59f62..debd488 100644 --- a/src/main/java/dev/array21/skinfixer/commands/CommandHandler.java +++ b/src/main/java/dev/array21/skinfixer/commands/CommandHandler.java @@ -76,7 +76,7 @@ private boolean onCommandHandler(CommandSender sender, String[] args, Subcommand return true; } - subcommand.onSubcommand(this.plugin, sender, Arrays.copyOfRange(args, 1, args.length)); + subcommand.onSubcommand(this.plugin, sender, args); return true; } @Override @@ -92,11 +92,11 @@ public boolean onCommand(CommandSender sender, Command command, String label, St return true; } - return this.onCommandHandler(sender, args, exec); + return this.onCommandHandler(sender, Arrays.copyOfRange(args, 1, args.length), exec); } private List onTabCompleteHandler(CommandSender sender, String[] args, Subcommand subcommand) { - return Arrays.asList(subcommand.onSubcommandComplete(this.plugin, sender, Arrays.copyOfRange(args, 1, args.length))); + return Arrays.asList(subcommand.onSubcommandComplete(this.plugin, sender, args)); } @Override @@ -110,6 +110,6 @@ public List onTabComplete(CommandSender sender, Command command, String return null; } - return this.onTabCompleteHandler(sender, args, exec); + return this.onTabCompleteHandler(sender, Arrays.copyOfRange(args, 1, args.length), exec); } } diff --git a/src/main/java/dev/array21/skinfixer/commands/subcommands/DirectCommand.java b/src/main/java/dev/array21/skinfixer/commands/subcommands/DirectCommand.java index fc63979..32f9da6 100644 --- a/src/main/java/dev/array21/skinfixer/commands/subcommands/DirectCommand.java +++ b/src/main/java/dev/array21/skinfixer/commands/subcommands/DirectCommand.java @@ -34,7 +34,7 @@ public void onSubcommand(SkinFixer plugin, CommandSender sender, String[] args) // Check that the user actually supplied a URL if (!(args[0].contains("https://") || args[0].contains("http://"))) { - sender.sendMessage(ChatColor.RED + LangHandler.model.invalidUrlArguemnt); + sender.sendMessage(ChatColor.RED + LangHandler.model.invalidUrlArgument); } // Filter off the query parameters diff --git a/src/main/java/dev/array21/skinfixer/language/LanguageModel.java b/src/main/java/dev/array21/skinfixer/language/LanguageModel.java index f2df46c..ffb11b8 100644 --- a/src/main/java/dev/array21/skinfixer/language/LanguageModel.java +++ b/src/main/java/dev/array21/skinfixer/language/LanguageModel.java @@ -66,5 +66,5 @@ public class LanguageModel { public String missingUrlArgument; @Required - public String invalidUrlArguemnt; + public String invalidUrlArgument; }