checkversion command

This commit is contained in:
Paul Schulze 2013-02-24 10:29:26 +01:00
parent a83c0fbab0
commit 8fd26b513a
2 changed files with 31 additions and 1 deletions

View File

@ -53,6 +53,29 @@ public class Commands implements CommandExecutor
return true; return true;
} }
// checkversion
if ( args.length > 0 && args[0].equalsIgnoreCase("checkversion") )
{
if ( !sender.hasPermission("craftinc.borderprotection.update") )
{
sender.sendMessage(Messages.noPermissionCheckversion);
return false;
}
if ( UpdateHelper.newVersionAvailable() )
{
sender.sendMessage(
Messages.updateMessage(UpdateHelper.cachedLatestVersion, UpdateHelper.getCurrentVersion()));
return true;
}
else
{
sender.sendMessage(Messages.noUpdateAvailable);
return true;
}
}
// set // set
if ( ( args.length == 2 || args.length == 3 ) && args[0].equalsIgnoreCase("set") ) if ( ( args.length == 2 || args.length == 3 ) && args[0].equalsIgnoreCase("set") )
{ {

View File

@ -74,7 +74,8 @@ public class Messages
makeCmd("on | off", "enables/disables the border of the current world") + makeCmd("on | off", "enables/disables the border of the current world") +
makeCmd("set", "Border rectangle edges will be this far away from point of origin.", "<integer>") + makeCmd("set", "Border rectangle edges will be this far away from point of origin.", "<integer>") +
makeCmd("set", "Border rectangle is defined by the two points. A point is specified as: x,z", makeCmd("set", "Border rectangle is defined by the two points. A point is specified as: x,z",
"<point1>", "<point2>"); "<point1>", "<point2>") +
makeCmd("checkversion", "Checks for a newer version.");
public static String borderCreationSuccessful public static String borderCreationSuccessful
= ChatColor.YELLOW + "New border was set " + = ChatColor.YELLOW + "New border was set " +
@ -107,6 +108,9 @@ public class Messages
public static String noPermissionSet = public static String noPermissionSet =
ChatColor.RED + "Sorry, you don't have permission to change the border."; ChatColor.RED + "Sorry, you don't have permission to change the border.";
public static String noPermissionCheckversion =
ChatColor.RED + "Sorry, you don't have permission to check for new versions.";
public static String borderEnabled = public static String borderEnabled =
ChatColor.YELLOW + "Border enabled."; ChatColor.YELLOW + "Border enabled.";
@ -128,4 +132,7 @@ public class Messages
ChatColor.AQUA + "http://dev.bukkit.org/server-mods/craftinc-borderprotection" + NEWLINE + ChatColor.AQUA + "http://dev.bukkit.org/server-mods/craftinc-borderprotection" + NEWLINE +
ChatColor.YELLOW + "to get the latest version!"; ChatColor.YELLOW + "to get the latest version!";
} }
public static String noUpdateAvailable =
ChatColor.YELLOW + "No updates available.";
} }