Merge branch 'develop' of https://github.com/BentoBoxWorld/BentoBox.git into develop

This commit is contained in:
tastybento 2019-06-09 15:04:20 -07:00
commit ca8b453e4b
2 changed files with 23 additions and 5 deletions

View File

@ -65,9 +65,13 @@ public class IslandCreateCommand extends CompositeCommand {
// Make island // Make island
return makeIsland(user, name); return makeIsland(user, name);
} else { } else {
// Show panel // Show panel only if there are multiple bundles available
IslandCreationPanel.openPanel(this, user, label); if (getPlugin().getBlueprintsManager().getBlueprintBundles((GameModeAddon)getAddon()).size() > 1) {
return true; // Show panel
IslandCreationPanel.openPanel(this, user, label);
return true;
}
return makeIsland(user, getPlugin().getBlueprintsManager().getBlueprintBundles((GameModeAddon)getAddon()).keySet().toArray(new String[]{})[0]);
} }
} }

View File

@ -5,6 +5,7 @@ import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.api.addons.GameModeAddon; import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.commands.ConfirmableCommand; import world.bentobox.bentobox.api.commands.ConfirmableCommand;
@ -85,14 +86,27 @@ public class IslandResetCommand extends ConfirmableCommand {
} else { } else {
// Show panel after confirmation // Show panel after confirmation
if (getPlugin().getSettings().isResetConfirmation()) { if (getPlugin().getSettings().isResetConfirmation()) {
this.askConfirmation(user, () -> IslandCreationPanel.openPanel(this, user, label)); this.askConfirmation(user, () -> selectBundle(user, label));
} else { } else {
IslandCreationPanel.openPanel(this, user, label); selectBundle(user, label);
} }
return true; return true;
} }
} }
/**
* Either selects the bundle to use or asks the user to choose.
* @since 1.5.1
*/
private void selectBundle(@NonNull User user, @NonNull String label) {
// Show panel only if there are multiple bundles available
if (getPlugin().getBlueprintsManager().getBlueprintBundles((GameModeAddon)getAddon()).size() > 1) {
// Show panel
IslandCreationPanel.openPanel(this, user, label);
} else {
resetIsland(user, getPlugin().getBlueprintsManager().getBlueprintBundles((GameModeAddon) getAddon()).keySet().toArray(new String[]{})[0]);
}
}
private boolean resetIsland(User user, String name) { private boolean resetIsland(User user, String name) {
// Reset the island // Reset the island