Spigot Configuration

Provides the basic infrastructure to load and save the Spigot configuration file, spigot.yml

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2013-07-07 09:32:53 +10:00
parent 6b0bae2fb6
commit cba0d1f1ec
7 changed files with 318 additions and 27 deletions

View File

@@ -0,0 +1,44 @@
package org.spigotmc;
import java.io.File;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
public class SpigotCommand extends Command {
public SpigotCommand(String name) {
super(name);
this.description = "Spigot related commands";
this.usageMessage = "/spigot reload";
this.setPermission("bukkit.command.spigot");
}
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
if (!this.testPermission(sender)) return true;
if (args.length != 1) {
sender.sendMessage(ChatColor.RED + "Usage: " + this.usageMessage);
return false;
}
if (args[0].equals("reload")) {
Command.broadcastCommandMessage(sender, ChatColor.RED + "Please note that this command is not supported and may cause issues.");
Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");
MinecraftServer console = MinecraftServer.getServer();
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings"));
for (ServerLevel world : console.getAllLevels()) {
world.spigotConfig.init();
}
console.server.reloadCount++;
Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Reload complete.");
}
return true;
}
}