2016-03-02 19:28:01 +00:00
|
|
|
package me.totalfreedom.totalfreedommod.command;
|
2013-07-13 20:11:13 +00:00
|
|
|
|
2016-03-06 15:56:15 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
2015-10-19 17:43:46 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
|
|
|
import me.totalfreedom.totalfreedommod.config.MainConfig;
|
2016-03-06 15:56:15 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
2015-10-19 17:43:46 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
2018-03-25 23:29:30 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
2013-07-13 20:11:13 +00:00
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2014-08-02 15:10:54 +00:00
|
|
|
/*
|
|
|
|
* See https://github.com/TotalFreedom/License - This file may not be edited or removed.
|
|
|
|
*/
|
2016-03-06 15:56:15 +00:00
|
|
|
@CommandPermissions(level = Rank.NON_OP, source = SourceType.BOTH)
|
2018-03-25 23:29:30 +00:00
|
|
|
@CommandParameters(description = "Shows information about TotalFreedomMod or reloads it", usage = "/<command> [reload | update]", aliases = "tfm")
|
2016-05-12 19:40:39 +00:00
|
|
|
public class Command_totalfreedommod extends FreedomCommand
|
2013-07-14 12:10:29 +00:00
|
|
|
{
|
2015-11-22 18:26:47 +00:00
|
|
|
|
2013-07-13 20:11:13 +00:00
|
|
|
@Override
|
2015-11-22 18:26:47 +00:00
|
|
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
2013-08-10 00:11:17 +00:00
|
|
|
{
|
2014-04-23 14:23:50 +00:00
|
|
|
if (args.length == 1)
|
|
|
|
{
|
2018-03-25 23:29:30 +00:00
|
|
|
if (args[0].equals("reload"))
|
2014-04-23 14:23:50 +00:00
|
|
|
{
|
2018-03-25 23:29:30 +00:00
|
|
|
if (!plugin.al.isAdmin(sender))
|
|
|
|
{
|
|
|
|
noPerms();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
plugin.config.load();
|
|
|
|
plugin.services.stop();
|
|
|
|
plugin.services.start();
|
2014-04-23 14:23:50 +00:00
|
|
|
|
2018-03-25 23:29:30 +00:00
|
|
|
final String message = String.format("%s v%s reloaded.",
|
|
|
|
TotalFreedomMod.pluginName,
|
|
|
|
TotalFreedomMod.pluginVersion);
|
|
|
|
|
|
|
|
msg(message);
|
|
|
|
FLog.info(message);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (args[0].equals("update"))
|
2014-04-23 14:23:50 +00:00
|
|
|
{
|
2018-03-25 23:29:30 +00:00
|
|
|
if (plugin.al.isAdmin(sender) && FUtil.DEVELOPERS.contains(sender.getName()))
|
|
|
|
{
|
|
|
|
if (plugin.ud.updateAvailable)
|
|
|
|
{
|
|
|
|
FUtil.adminAction(sender.getName(), "Updating TotalFreedomMod", false);
|
|
|
|
plugin.ud.update();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
msg("TFM is already up to date!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
noPerms();
|
|
|
|
}
|
2014-06-30 15:30:16 +00:00
|
|
|
return true;
|
2014-04-23 14:23:50 +00:00
|
|
|
}
|
2018-03-25 23:29:30 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2014-04-23 14:23:50 +00:00
|
|
|
}
|
|
|
|
|
2015-09-06 21:02:10 +00:00
|
|
|
TotalFreedomMod.BuildProperties build = TotalFreedomMod.build;
|
2016-03-02 19:28:01 +00:00
|
|
|
msg("TotalFreedomMod for 'Total Freedom', the original all-op server.", ChatColor.GOLD);
|
|
|
|
msg("Running on " + ConfigEntry.SERVER_NAME.getString() + ".", ChatColor.GOLD);
|
|
|
|
msg("Created by Madgeek1450 and Prozza.", ChatColor.GOLD);
|
|
|
|
msg(String.format("Version "
|
2016-05-12 19:40:39 +00:00
|
|
|
+ ChatColor.BLUE + "%s %s.%s " + ChatColor.GOLD + "("
|
2015-09-06 21:02:10 +00:00
|
|
|
+ ChatColor.BLUE + "%s" + ChatColor.GOLD + ")",
|
2016-05-12 19:40:39 +00:00
|
|
|
build.codename,
|
2015-11-22 18:26:47 +00:00
|
|
|
build.version,
|
2015-09-06 21:02:10 +00:00
|
|
|
build.number,
|
|
|
|
build.head), ChatColor.GOLD);
|
2016-03-02 19:28:01 +00:00
|
|
|
msg(String.format("Compiled "
|
2015-09-06 21:02:10 +00:00
|
|
|
+ ChatColor.BLUE + "%s" + ChatColor.GOLD + " by "
|
|
|
|
+ ChatColor.BLUE + "%s",
|
|
|
|
build.date,
|
2015-11-22 18:26:47 +00:00
|
|
|
build.author), ChatColor.GOLD);
|
2016-03-02 19:28:01 +00:00
|
|
|
msg("Visit " + ChatColor.AQUA + "http://github.com/TotalFreedom/TotalFreedomMod"
|
2015-09-06 21:02:10 +00:00
|
|
|
+ ChatColor.GREEN + " for more information.", ChatColor.GREEN);
|
2013-07-13 20:11:13 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|