Add /motd command to allow user to set motd without restarting/stopping server

This commit is contained in:
lol768 2012-10-22 12:28:30 +01:00 committed by md_5
parent f936e1b869
commit d4122eb5e5

View File

@ -0,0 +1,29 @@
package net.md_5.bungee.command;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.Permission;
/**
* Command to set a temp copy of the motd in real-time without stopping the proxy
*/
public class CommandMotd extends Command
{
@Override
public void execute(CommandSender sender, String[] args)
{
if (getPermission(sender) != Permission.ADMIN)
{
sender.sendMessage(ChatColor.RED + "You do not have permission to use this command");
} else
{
String newMOTD = "";
for (String s: args)
{
newMOTD = newMOTD + s + " ";
}
newMOTD = newMOTD.substring(0, newMOTD.length()-1);
BungeeCord.instance.config.motd = newMOTD;
}
}
}