Skip to content

Commit

Permalink
Added Regen Command For Console (0.5.6.3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kihsomray committed Jan 29, 2022
1 parent c480d88 commit 705c4e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -6,7 +6,7 @@

<groupId>net.zerotoil</groupId>
<artifactId>CyberWorldReset</artifactId>
<version>0.5.6.1</version>
<version>0.5.6.3</version>
<packaging>jar</packaging>

<name>CyberWorldReset</name>
Expand Down
Expand Up @@ -22,7 +22,7 @@ public class CWRCommand implements CommandExecutor {
public CWRCommand(CyberWorldReset main) {
this.main = main;
main.getCommand("cwr").setExecutor(this);
consoleCmds = Arrays.asList("about", "reload");
consoleCmds = Arrays.asList("about", "reload", "regen", "reset");
}

public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Expand All @@ -31,7 +31,9 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
String uuid;

// console check
if (!(sender instanceof Player) && !consoleCmds.contains(args[0])) {
if (!(sender instanceof Player) && (!consoleCmds.contains(args[0].toLowerCase()) ||
((args[0].equalsIgnoreCase("regen") || args[0].equalsIgnoreCase("reset"))
&& args.length != 2))) {
Bukkit.getLogger().warning("Console cannot use this command!");
return true;
} else if (!(sender instanceof Player)) {
Expand Down Expand Up @@ -251,7 +253,7 @@ private boolean regenWorld(Player player, String worldName) {
if (noSetupsExist(player)) return true;
if (setupDoesNotExist(player, worldName)) return true;

if (main.config().isConfirmationEnabled()) {
if (main.config().isConfirmationEnabled() && player != null) {

if (confirmation.containsKey(player)) {
main.lang().getMsg("confirmation-needed").send(player, true, new String[]{"world"}, new String[]{worldName});
Expand Down

0 comments on commit 705c4e4

Please sign in to comment.