mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-07 07:51:41 +01:00
Fixed the Island Creation Panel showing although there is 1 bundle available
Implements #744
This commit is contained in:
parent
5fc39b3691
commit
824a744cd1
@ -65,9 +65,13 @@ public class IslandCreateCommand extends CompositeCommand {
|
||||
// Make island
|
||||
return makeIsland(user, name);
|
||||
} else {
|
||||
// Show panel
|
||||
IslandCreationPanel.openPanel(this, user, label);
|
||||
return true;
|
||||
// Show panel only if there are multiple bundles available
|
||||
if (getPlugin().getBlueprintsManager().getBlueprintBundles((GameModeAddon)getAddon()).size() > 1) {
|
||||
// Show panel
|
||||
IslandCreationPanel.openPanel(this, user, label);
|
||||
return true;
|
||||
}
|
||||
return makeIsland(user, getPlugin().getBlueprintsManager().getBlueprintBundles((GameModeAddon)getAddon()).keySet().toArray(new String[]{})[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
|
||||
@ -85,14 +86,27 @@ public class IslandResetCommand extends ConfirmableCommand {
|
||||
} else {
|
||||
// Show panel after confirmation
|
||||
if (getPlugin().getSettings().isResetConfirmation()) {
|
||||
this.askConfirmation(user, () -> IslandCreationPanel.openPanel(this, user, label));
|
||||
this.askConfirmation(user, () -> selectBundle(user, label));
|
||||
} else {
|
||||
IslandCreationPanel.openPanel(this, user, label);
|
||||
selectBundle(user, label);
|
||||
}
|
||||
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) {
|
||||
// Reset the island
|
||||
|
Loading…
Reference in New Issue
Block a user