Added a extra permission for world generation. Moved strings for the generation commands into the Message class.
This commit is contained in:
parent
89fdd622ca
commit
75cfa0cef2
@ -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 +
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -36,3 +36,6 @@ permissions:
|
||||
craftinc.borderprotection.update:
|
||||
default: op
|
||||
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.
|
Loading…
x
Reference in New Issue
Block a user