Skip to content

Commit

Permalink
Merge pull request #2949 from Multiverse/fix-regen-args
Browse files Browse the repository at this point in the history
Fix regen args parsing logic
  • Loading branch information
benwoo1110 authored Aug 20, 2023
2 parents 26e5878 + 582d256 commit 5fbe16e
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ public RegenCommand(MultiverseCore plugin) {
@Override
public void runCommand(CommandSender sender, List<String> args) {
String worldName = args.get(0);
boolean useseed = (!(args.size() == 1));
boolean randomseed = (args.size() == 2 && args.get(1).equalsIgnoreCase("-s"));
String seed = (args.size() == 3) ? args.get(2) : "";
boolean useseed = CommandHandler.hasFlag("-s", args);
String seedflag = CommandHandler.getFlag("-s", args);
boolean keepGamerules = CommandHandler.hasFlag("--keep-gamerules", args);

boolean randomseed = seedflag == null || seedflag.isEmpty() || seedflag.equalsIgnoreCase("--keep-gamerules");
String seed = randomseed ? "" : seedflag;

this.plugin.getCommandQueueManager().addToQueue(new QueuedCommand(
sender,
doWorldRegen(sender, worldName, useseed, randomseed, seed, keepGamerules),
Expand Down

0 comments on commit 5fbe16e

Please sign in to comment.