3
0

添加重载spigot和bukkit配置的命令

This commit is contained in:
聪聪 2017-08-03 08:17:51 +08:00
parent e72d7cb2fb
commit b4faaaeaa4

View File

@ -15,11 +15,12 @@ import net.minecraftforge.cauldron.configuration.Setting;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang.math.NumberUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.util.StringUtil; import org.bukkit.util.StringUtil;
import org.spigotmc.SpigotConfig;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -62,6 +63,7 @@ public class CauldronCommand extends Command
} }
if ((args.length == 1) && "reload".equalsIgnoreCase(args[0])) if ((args.length == 1) && "reload".equalsIgnoreCase(args[0]))
{ {
if(args.length==1){
MinecraftServer.getServer().cauldronConfig.load(); MinecraftServer.getServer().cauldronConfig.load();
for (int i = 0; i < MinecraftServer.getServer().worlds.size(); i++) for (int i = 0; i < MinecraftServer.getServer().worlds.size(); i++)
{ {
@ -69,6 +71,15 @@ public class CauldronCommand extends Command
} }
sender.sendMessage(ChatColor.GREEN + "Config file reloaded"); sender.sendMessage(ChatColor.GREEN + "Config file reloaded");
return true; return true;
}else if(args[1].equalsIgnoreCase("bukkit")){
Bukkit.getServer().reload();
sender.sendMessage(ChatColor.GREEN + "Bukkit Config file reloaded");
return true;
}else if(args[1].equalsIgnoreCase("spigot")){
SpigotConfig.init();
sender.sendMessage(ChatColor.GREEN + "Spigot Config file reloaded");
return true;
}
} }
if (args.length < 2) if (args.length < 2)
{ {