Skip to content

Commit

Permalink
Fixes:
Browse files Browse the repository at this point in the history
- Fixed typo
- Fixed argument position for global command vs subcommand
- 1.19.2 support (1.19.1 too I think)
  • Loading branch information
TobiasDeBruijn committed Sep 28, 2022
1 parent a1ba5f9 commit 473701c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/main/java/dev/array21/skinfixer/SkinChangeHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/dev/array21/skinfixer/SkinFixer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<String> 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
Expand All @@ -110,6 +110,6 @@ public List<String> 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ public class LanguageModel {
public String missingUrlArgument;

@Required
public String invalidUrlArguemnt;
public String invalidUrlArgument;
}

0 comments on commit 473701c

Please sign in to comment.