28 lines
916 B
Java
28 lines
916 B
Java
|
|
package moe.sob.commands;
|
||
|
|
|
||
|
|
import moe.sob.Main;
|
||
|
|
import org.bukkit.ChatColor;
|
||
|
|
import org.bukkit.command.Command;
|
||
|
|
import org.bukkit.command.CommandExecutor;
|
||
|
|
import org.bukkit.command.CommandSender;
|
||
|
|
|
||
|
|
public class SetGreetMessageCommand implements CommandExecutor {
|
||
|
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||
|
|
if (args[0].isBlank()) {
|
||
|
|
sender.sendMessage("Insufficient arguments.");
|
||
|
|
return false;
|
||
|
|
} else {
|
||
|
|
try {
|
||
|
|
String greetMessage = String.join(" ", args);
|
||
|
|
Main.configR.set("server.greet_message", greetMessage);
|
||
|
|
Main.configR.save(Main.config);
|
||
|
|
|
||
|
|
sender.sendMessage("Changed greet message successfully.");
|
||
|
|
return true;
|
||
|
|
} catch (Exception e) {
|
||
|
|
throw new RuntimeException(e);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|