checkversion command
This commit is contained in:
parent
a83c0fbab0
commit
8fd26b513a
@ -53,6 +53,29 @@ public class Commands implements CommandExecutor
|
||||
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
|
||||
if ( ( args.length == 2 || args.length == 3 ) && args[0].equalsIgnoreCase("set") )
|
||||
{
|
||||
|
@ -74,7 +74,8 @@ public class Messages
|
||||
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 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
|
||||
= ChatColor.YELLOW + "New border was set " +
|
||||
@ -107,6 +108,9 @@ public class Messages
|
||||
public static String noPermissionSet =
|
||||
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 =
|
||||
ChatColor.YELLOW + "Border enabled.";
|
||||
|
||||
@ -128,4 +132,7 @@ public class Messages
|
||||
ChatColor.AQUA + "http://dev.bukkit.org/server-mods/craftinc-borderprotection" + NEWLINE +
|
||||
ChatColor.YELLOW + "to get the latest version!";
|
||||
}
|
||||
|
||||
public static String noUpdateAvailable =
|
||||
ChatColor.YELLOW + "No updates available.";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user