Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>1.25.2</build.version>
<build.version>1.26.0</build.version>
<!-- SonarCloud -->
<sonar.projectKey>BentoBoxWorld_AOneBlock</sonar.projectKey>
<sonar.organization>bentobox-world</sonar.organization>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public void setup() {
new AdminSetChestCommand(this);
// Sanity
new AdminSanityCheck(this);
// Phase order editor
new AdminPhasesCommand(this);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package world.bentobox.aoneblock.commands.admin;

import java.util.List;

import world.bentobox.aoneblock.AOneBlock;
import world.bentobox.aoneblock.panels.AdminPhasesPanel;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;

/**
* Command to open the phase order editor
*
* @author tastybento
*/
public class AdminPhasesCommand extends CompositeCommand {

private AOneBlock addon;

public AdminPhasesCommand(CompositeCommand parent) {
super(parent, "phases");
}

@Override
public void setup() {
setDescription("aoneblock.commands.admin.phases.description");
// Permission
setPermission("admin.phases");
setOnlyPlayer(true);
addon = getAddon();
}

@Override
public boolean canExecute(User user, String label, List<String> args) {
if (!args.isEmpty()) {
showHelp(this, user);
return false;
}
if (addon.getOneBlockManager().getPhaseIndex().isEmpty()) {
// Phases were loaded without an index, so there is nothing to reorder
user.sendMessage("aoneblock.commands.admin.phases.no-index");
return false;
}
return true;
}

@Override
public boolean execute(User user, String label, List<String> args) {
AdminPhasesPanel.openPanel(addon, user);
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public class OneBlockPhase {
private final Random chestRandom;
private final String blockNumber;
private Integer gotoBlock;
private String requiredMinecraftVersion;
private PhaseIndexEntry indexEntry;
private int blockTotal = 0;
private int entityTotal = 0;
private List<String> startCommands;
Expand Down Expand Up @@ -340,6 +342,37 @@ public void setGotoBlock(Integer gotoBlock) {
this.gotoBlock = gotoBlock;
}

/**
* @return the phase index entry this phase was loaded from, or null when the
* phase was loaded without an index
*/
public PhaseIndexEntry getIndexEntry() {
return indexEntry;
}

/**
* @param indexEntry the phase index entry this phase was loaded from
*/
public void setIndexEntry(PhaseIndexEntry indexEntry) {
this.indexEntry = indexEntry;
}

/**
* @return the minimum Minecraft version this phase needs, or null if it can run
* on any version
*/
public String getRequiredMinecraftVersion() {
return requiredMinecraftVersion;
}

/**
* @param requiredMinecraftVersion the minimum Minecraft version this phase
* needs, e.g. "26.2"
*/
public void setRequiredMinecraftVersion(String requiredMinecraftVersion) {
this.requiredMinecraftVersion = requiredMinecraftVersion;
}

/**
* @return the total
*/
Expand Down
Loading
Loading