mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-09-10 14:27:59 +02:00
Merge branch 'develop' of https://github.com/BentoBoxWorld/BentoBox.git into develop
This commit is contained in:
commit
ca8b453e4b
@ -65,10 +65,14 @@ public class IslandCreateCommand extends CompositeCommand {
|
|||||||
// Make island
|
// Make island
|
||||||
return makeIsland(user, name);
|
return makeIsland(user, name);
|
||||||
} else {
|
} else {
|
||||||
|
// Show panel only if there are multiple bundles available
|
||||||
|
if (getPlugin().getBlueprintsManager().getBlueprintBundles((GameModeAddon)getAddon()).size() > 1) {
|
||||||
// Show panel
|
// Show panel
|
||||||
IslandCreationPanel.openPanel(this, user, label);
|
IslandCreationPanel.openPanel(this, user, label);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return makeIsland(user, getPlugin().getBlueprintsManager().getBlueprintBundles((GameModeAddon)getAddon()).keySet().toArray(new String[]{})[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean makeIsland(User user, String name) {
|
private boolean makeIsland(User user, String name) {
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user