Added a extra permission for world generation. Moved strings for the generation commands into the Message class.

This commit is contained in:
Tobias Ottenweller 2013-11-24 13:41:59 +01:00
parent 89fdd622ca
commit 75cfa0cef2
4 changed files with 26 additions and 9 deletions

View File

@ -137,6 +137,21 @@ public class Messages
ChatColor.RED +
"Error: Could not save border state on server. After the next reload this border state will be lost!";
public static String generationCanceled =
ChatColor.GREEN + "World generation canceled!";
public static String generationNotCanceled =
ChatColor.RED + "No world generation happening. Cannot cancel!";
public static String generationAlreadyInProgress =
ChatColor.YELLOW + "World generation is already in progress. It will continue after all players are logged out.";
public static String generationStarted =
ChatColor.GREEN + "World generation will start after all players left the server.";
public static String generationCouldNotBeStarted =
ChatColor.RED + "Could not start world generation! Is there a border?";
public static String updateMessage( String newVersion, String curVersion )
{
return ChatColor.RED + pluginName + ": New version available!" + NEWLINE +

View File

@ -31,7 +31,7 @@ public class CancelGenerateCommand implements SubCommand
@Override
public boolean execute(CommandSender sender, String[] parameters)
{
if ( !sender.hasPermission("craftinc.borderprotection.set") ) // TODO: a new/different permission?
if ( !sender.hasPermission("craftinc.borderprotection.generate") )
{
sender.sendMessage(Messages.noPermissionSet);
return false;
@ -41,12 +41,12 @@ public class CancelGenerateCommand implements SubCommand
if (!ChunkGenerator.isGenerating(world))
{
sender.sendMessage("nothing to cancel"); // TODO: put better message into Message class
sender.sendMessage(Messages.generationNotCanceled);
}
else
{
ChunkGenerator.cancelRender(world);
sender.sendMessage("generation canceled"); // TODO: put better message into Message class
sender.sendMessage(Messages.generationCanceled);
}
return true;

View File

@ -30,7 +30,7 @@ public class GenerateCommand implements SubCommand
@Override
public boolean execute(CommandSender sender, String[] parameters)
{
if ( !sender.hasPermission("craftinc.borderprotection.set") ) // TODO: a new/different permission?
if ( !sender.hasPermission("craftinc.borderprotection.generate") )
{
sender.sendMessage(Messages.noPermissionSet);
return false;
@ -40,19 +40,18 @@ public class GenerateCommand implements SubCommand
if (ChunkGenerator.isGenerating(world))
{
sender.sendMessage("already generating! will resume on logout"); // TODO: put better message into Message class
sender.sendMessage(Messages.generationAlreadyInProgress);
}
else
{
if (ChunkGenerator.generate(world))
{
sender.sendMessage("world marked for generation! will start on logout"); // TODO: put better message into Message class
sender.sendMessage(Messages.generationStarted);
}
else
{
sender.sendMessage("could not start generation. is there a border?"); // TODO: put better message into Message class
sender.sendMessage(Messages.generationCouldNotBeStarted);
}
}
return true;

View File

@ -35,4 +35,7 @@ permissions:
description: Allows to be everywhere on the map (ignoring the borders).
craftinc.borderprotection.update:
default: op
description: Allows to get notified on login, when a new update is available.
description: Allows to get notified on login, when a new update is available.
craftinc.borderprotection.generate:
default: op
description: Allows to generate the complete world inside the border.