mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-06 15:51:31 +00:00
Add gale config re-init in Leaf reload command
Noted that gale config reload is still sync currently.
This commit is contained in:
@@ -2,6 +2,7 @@ package org.dreeam.leaf.command.subcommands;
|
|||||||
|
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||||
import org.dreeam.leaf.command.LeafCommand;
|
import org.dreeam.leaf.command.LeafCommand;
|
||||||
@@ -9,6 +10,7 @@ import org.dreeam.leaf.command.PermissionedLeafSubcommand;
|
|||||||
import org.dreeam.leaf.config.LeafConfig;
|
import org.dreeam.leaf.config.LeafConfig;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.permissions.PermissionDefault;
|
import org.bukkit.permissions.PermissionDefault;
|
||||||
|
|
||||||
@DefaultQualifier(NonNull.class)
|
@DefaultQualifier(NonNull.class)
|
||||||
@@ -23,11 +25,24 @@ public final class ReloadCommand extends PermissionedLeafSubcommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final CommandSender sender, final String subCommand, final String[] args) {
|
public boolean execute(final CommandSender sender, final String subCommand, final String[] args) {
|
||||||
this.doReload(sender);
|
this.doGaleReload(sender);
|
||||||
|
this.doLeafReload(sender);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doReload(final CommandSender sender) {
|
// Gale start - Gale commands - /gale reload command
|
||||||
|
private void doGaleReload(final CommandSender sender) {
|
||||||
|
Command.broadcastCommandMessage(sender, Component.text("Reloading Gale config...", NamedTextColor.GREEN));
|
||||||
|
|
||||||
|
MinecraftServer server = ((CraftServer) sender.getServer()).getServer();
|
||||||
|
server.galeConfigurations.reloadConfigs(server);
|
||||||
|
server.server.reloadCount++;
|
||||||
|
|
||||||
|
Command.broadcastCommandMessage(sender, Component.text("Gale config reload complete.", NamedTextColor.GREEN));
|
||||||
|
}
|
||||||
|
// Gale end - Gale commands - /gale reload command
|
||||||
|
|
||||||
|
private void doLeafReload(final CommandSender sender) {
|
||||||
Command.broadcastCommandMessage(sender, Component.text("Reloading Leaf config...", NamedTextColor.GREEN));
|
Command.broadcastCommandMessage(sender, Component.text("Reloading Leaf config...", NamedTextColor.GREEN));
|
||||||
|
|
||||||
LeafConfig.reloadAsync(sender);
|
LeafConfig.reloadAsync(sender);
|
||||||
|
|||||||
Reference in New Issue
Block a user