Skip to content

Commit

Permalink
Added missing admin upgrade commands (#827)
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerBenGera committed Jan 13, 2022
1 parent ab6a145 commit 2ea8689
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import com.bgsoftware.superiorskyblock.api.upgrades.cost.UpgradeCostLoader;
import com.bgsoftware.superiorskyblock.key.dataset.KeyMap;
import com.bgsoftware.superiorskyblock.module.BuiltinModule;
import com.bgsoftware.superiorskyblock.module.upgrades.commands.CmdAdminRankup;
import com.bgsoftware.superiorskyblock.module.upgrades.commands.CmdAdminSetUpgrade;
import com.bgsoftware.superiorskyblock.module.upgrades.commands.CmdAdminSyncUpgrades;
import com.bgsoftware.superiorskyblock.module.upgrades.commands.CmdRankup;
import com.bgsoftware.superiorskyblock.module.upgrades.commands.CmdUpgrade;
import com.bgsoftware.superiorskyblock.module.upgrades.type.IUpgradeType;
Expand Down Expand Up @@ -38,6 +41,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

public final class UpgradesModule extends BuiltinModule {

Expand Down Expand Up @@ -77,10 +81,19 @@ public SuperiorCommand[] getSuperiorCommands(SuperiorSkyblockPlugin plugin) {

@Override
public SuperiorCommand[] getSuperiorAdminCommands(SuperiorSkyblockPlugin plugin) {
return !isEnabled() ? null : enabledUpgrades.stream()
if(!isEnabled())
return null;

List<SuperiorCommand> adminCommands = enabledUpgrades.stream()
.map(IUpgradeType::getCommands)
.flatMap(List::stream)
.toArray(SuperiorCommand[]::new);
.collect(Collectors.toList());

adminCommands.add(new CmdAdminRankup());
adminCommands.add(new CmdAdminSetUpgrade());
adminCommands.add(new CmdAdminSyncUpgrades());

return adminCommands.toArray(new SuperiorCommand[0]);
}

@Override
Expand Down

0 comments on commit 2ea8689

Please sign in to comment.