mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-24 19:45:14 +01:00
Update To BentoBox 1.1
Use new approach to hooking addons into game-mode.
This commit is contained in:
parent
53da2d67c7
commit
ca32c53510
14
pom.xml
14
pom.xml
@ -100,19 +100,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>world.bentobox</groupId>
|
<groupId>world.bentobox</groupId>
|
||||||
<artifactId>bentobox</artifactId>
|
<artifactId>bentobox</artifactId>
|
||||||
<version>1.1-SNAPSHOT</version>
|
<version>1.1</version>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>world.bentobox</groupId>
|
|
||||||
<artifactId>bskyblock</artifactId>
|
|
||||||
<version>1.0</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>world.bentobox</groupId>
|
|
||||||
<artifactId>acidisland</artifactId>
|
|
||||||
<version>1.0</version>
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -2,7 +2,6 @@ package world.bentobox.challenges;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import world.bentobox.acidisland.AcidIsland;
|
|
||||||
import world.bentobox.bentobox.api.configuration.Config;
|
import world.bentobox.bentobox.api.configuration.Config;
|
||||||
import world.bentobox.challenges.commands.ChallengesCommand;
|
import world.bentobox.challenges.commands.ChallengesCommand;
|
||||||
import world.bentobox.challenges.commands.admin.Challenges;
|
import world.bentobox.challenges.commands.admin.Challenges;
|
||||||
@ -75,45 +74,22 @@ public class ChallengesAddon extends Addon {
|
|||||||
// Challenge import setup
|
// Challenge import setup
|
||||||
this.importManager = new ChallengesImportManager(this);
|
this.importManager = new ChallengesImportManager(this);
|
||||||
|
|
||||||
|
this.getPlugin().getAddonsManager().getGameModeAddons().forEach(gameModeAddon -> {
|
||||||
// Integrate into AcidIsland.
|
if (!this.settings.getDisabledGameModes().contains(gameModeAddon.getDescription().getName()))
|
||||||
if (this.settings.getDisabledGameModes().isEmpty() ||
|
|
||||||
!this.settings.getDisabledGameModes().contains("AcidIsland"))
|
|
||||||
{
|
{
|
||||||
this.getPlugin().getAddonsManager().getAddonByName("AcidIsland").ifPresent(
|
if (gameModeAddon.getPlayerCommand().isPresent())
|
||||||
addon -> {
|
{
|
||||||
AcidIsland acidIsland = (AcidIsland) addon;
|
new ChallengesCommand(this, gameModeAddon.getPlayerCommand().get());
|
||||||
|
|
||||||
new Challenges(this,
|
|
||||||
this.getPlugin().getCommandsManager().getCommand(
|
|
||||||
acidIsland.getSettings().getAdminCommand()));
|
|
||||||
|
|
||||||
new ChallengesCommand(this,
|
|
||||||
this.getPlugin().getCommandsManager().getCommand(
|
|
||||||
acidIsland.getSettings().getIslandCommand()));
|
|
||||||
|
|
||||||
this.hooked = true;
|
this.hooked = true;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Integrate into BSkyBlock.
|
if (gameModeAddon.getAdminCommand().isPresent())
|
||||||
if (this.settings.getDisabledGameModes().isEmpty() ||
|
|
||||||
!this.settings.getDisabledGameModes().contains("BSkyBlock"))
|
|
||||||
{
|
{
|
||||||
this.getPlugin().getAddonsManager().getAddonByName("BSkyBlock").ifPresent(
|
new Challenges(this, gameModeAddon.getAdminCommand().get());
|
||||||
addon -> {
|
|
||||||
// BSkyBlock skyBlock = (BSkyBlock) addon;
|
|
||||||
// SkyBlock addon cannot change commands ;(
|
|
||||||
|
|
||||||
new Challenges(this,
|
|
||||||
this.getPlugin().getCommandsManager().getCommand("bsbadmin"));
|
|
||||||
|
|
||||||
new ChallengesCommand(this,
|
|
||||||
this.getPlugin().getCommandsManager().getCommand("island"));
|
|
||||||
|
|
||||||
this.hooked = true;
|
this.hooked = true;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (this.hooked) {
|
if (this.hooked) {
|
||||||
// Try to find Level addon and if it does not exist, display a warning
|
// Try to find Level addon and if it does not exist, display a warning
|
||||||
|
Loading…
Reference in New Issue
Block a user