1.2.0: Remove unnecessary events, use yml as a config
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package moe.sob.commands;
|
||||
|
||||
import moe.sob.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class SetLoggingModeCommand implements CommandExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (args[0].isBlank()) {
|
||||
sender.sendMessage("Please only provide true or false in the command arguments.");
|
||||
return false;
|
||||
} else {
|
||||
if (args[0].equals("true") || args[0].equals("false")) {
|
||||
try {
|
||||
Main.configR.set("log", args[0].equals("true"));
|
||||
Main.configR.save(Main.config);
|
||||
String status = "";
|
||||
if (args[0].equals("true"))
|
||||
status = "enabled";
|
||||
else if (args[0].equals("false"))
|
||||
status = "disabled";
|
||||
sender.sendMessage(ChatColor.ITALIC + "%s %s server logging.".formatted(sender.getName(), status));
|
||||
sender.sendMessage(ChatColor.ITALIC + "Changes will only apply once the server has restarted.");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user