Uses new GameMode API

See https://github.com/BentoBoxWorld/BentoBox/pull/472
This commit is contained in:
tastybento 2019-01-15 19:35:08 -08:00
parent 6364ee4360
commit 05ebb4c283

View File

@ -7,7 +7,6 @@ import java.util.UUID;
import org.bukkit.World; import org.bukkit.World;
import world.bentobox.bentobox.api.addons.Addon; import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.Database; import world.bentobox.bentobox.database.Database;
import world.bentobox.bentobox.database.objects.Island; import world.bentobox.bentobox.database.objects.Island;
@ -114,28 +113,18 @@ public class Level extends Addon {
// Start the top ten and register it for clicks // Start the top ten and register it for clicks
topTen = new TopTen(this); topTen = new TopTen(this);
registerListener(topTen); registerListener(topTen);
// Register commands // Register commands for AcidIsland and BSkyBlock
// AcidIsland hook in getPlugin().getAddonsManager().getGameModeAddons().stream()
this.getPlugin().getAddonsManager().getAddonByName("AcidIsland").ifPresent(a -> { .filter(gm -> gm.getDescription().getName().equals("AcidIsland") || gm.getDescription().getName().equals("BSkyBlock"))
CompositeCommand acidIslandCmd = getPlugin().getCommandsManager().getCommand(getConfig().getString("acidisland.user-command","ai")); .forEach(gm -> {
if (acidIslandCmd != null) { gm.getAdminCommand().ifPresent(adminCommand -> {
new IslandLevelCommand(this, acidIslandCmd); new AdminLevelCommand(this, adminCommand);
new IslandTopCommand(this, acidIslandCmd); new AdminTopCommand(this, adminCommand);
CompositeCommand acidCmd = getPlugin().getCommandsManager().getCommand(getConfig().getString("acidisland.admin-command","acid")); });
new AdminLevelCommand(this, acidCmd); gm.getPlayerCommand().ifPresent(playerCmd -> {
new AdminTopCommand(this, acidCmd); new IslandLevelCommand(this, playerCmd);
} new IslandTopCommand(this, playerCmd);
}); });
// BSkyBlock hook in
this.getPlugin().getAddonsManager().getAddonByName("BSkyBlock").ifPresent(a -> {
CompositeCommand bsbIslandCmd = getPlugin().getCommandsManager().getCommand(getConfig().getString("bskyblock.user-command","island"));
if (bsbIslandCmd != null) {
new IslandLevelCommand(this, bsbIslandCmd);
new IslandTopCommand(this, bsbIslandCmd);
CompositeCommand bsbAdminCmd = getPlugin().getCommandsManager().getCommand(getConfig().getString("bskyblock.admin-command","bsbadmin"));
new AdminLevelCommand(this, bsbAdminCmd);
new AdminTopCommand(this, bsbAdminCmd);
}
}); });
// Register new island listener // Register new island listener