1
0
mirror of https://github.com/Suiranoil/SkinRestorer.git synced 2026-01-16 04:42:12 +00:00

add skin config reload command

This commit is contained in:
2024-08-29 06:35:40 +03:00
parent 299a8b621f
commit 449e286fba

View File

@@ -49,9 +49,14 @@ public final class SkinCommand {
var providers = SkinRestorer.getProvidersRegistry().getPublicProviders();
for (var entry : providers)
set.then(buildSetSubcommand(entry.first(), entry.second()));
base.then(set);
base.then(
literal("config")
.requires(commandSourceStack -> commandSourceStack.hasPermission(3))
.then(literal("reload").executes(SkinCommand::configReloadSubcommand))
);
dispatcher.register(base);
}
@@ -160,6 +165,12 @@ public final class SkinCommand {
return setSubcommand(src, Collections.singleton(src.getPlayer().getGameProfile()), context, false);
}
private static int configReloadSubcommand(CommandContext<CommandSourceStack> context) {
SkinRestorer.reloadConfig();
return 0;
}
private static void sendResponse(CommandSourceStack src, Collection<ServerPlayer> updatedPlayers, boolean setByOperator) {
if (updatedPlayers.isEmpty()) {
src.sendSuccess(() -> Translation.translatableWithFallback(