summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java
blob: a384cb6bd79ef6272a845c6cfe7c83dc2f168cb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.earth2me.essentials.commands;

import com.earth2me.essentials.Backup;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n.tl;
import org.bukkit.Server;


public class Commandbackup extends EssentialsCommand
{
	public Commandbackup()
	{
		super("backup");
	}

	@Override
	protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
	{
		final Backup backup = ess.getBackup();
		if (backup == null)
		{
			throw new Exception(tl("backupDisabled"));
		}
		final String command = ess.getSettings().getBackupCommand();
		if (command == null || "".equals(command) || "save-all".equalsIgnoreCase(command))
		{
			throw new Exception(tl("backupDisabled"));
		}
		backup.run();
		sender.sendMessage(tl("backupStarted"));
	}
}