Updated to lated API

This commit is contained in:
tastybento 2019-01-16 12:46:39 -08:00
parent 695e8b4c6b
commit e80be18712
3 changed files with 23 additions and 31 deletions

10
pom.xml
View File

@ -5,7 +5,7 @@
<groupId>world.bentobox</groupId>
<artifactId>WelcomeWarpSigns</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>1.1-SNAPSHOT</version>
<name>WelcomeWarpSigns</name>
<description>WelcomeWarpSigns is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like ASkyBlock or AcidIsland.</description>
@ -86,12 +86,12 @@
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId>
<version>0.12.0-SNAPSHOT</version>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>Level</artifactId>
<version>0.1.0-SNAPSHOT</version>
<artifactId>level</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
@ -218,7 +218,7 @@
<id>sonar</id>
<properties>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>tastybento-github</sonar.organization>
<sonar.organization>bentobox-world</sonar.organization>
</properties>
<build>
<plugins>

View File

@ -6,14 +6,13 @@ import java.util.UUID;
import org.bukkit.World;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.util.Util;
import world.bentobox.level.Level;
import world.bentobox.warps.commands.WarpCommand;
import world.bentobox.warps.commands.WarpsCommand;
import world.bentobox.warps.config.PluginConfig;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.util.Util;
/**
* Addin to BSkyBlock that enables welcome warp signs
@ -57,26 +56,16 @@ public class Warp extends Addon {
// Load the listener
getServer().getPluginManager().registerEvents(new WarpSignsListener(this), plugin);
// Register commands
getPlugin().getAddonsManager().getGameModeAddons().stream()
.filter(a -> a.getDescription().getName().equals(BSKYBLOCK) || a.getDescription().getName().equals(ACIDISLAND))
.forEach(a -> {
a.getPlayerCommand().ifPresent(c -> {
new WarpCommand(this, c);
new WarpsCommand(this, c);
registeredWorlds.add(c.getWorld());
});
// BSkyBlock hook in
this.getPlugin().getAddonsManager().getAddonByName(BSKYBLOCK).ifPresent(acidIsland -> {
CompositeCommand bsbIslandCmd = BentoBox.getInstance().getCommandsManager().getCommand("island");
if (bsbIslandCmd != null) {
new WarpCommand(this, bsbIslandCmd);
new WarpsCommand(this, bsbIslandCmd);
registeredWorlds.add(bsbIslandCmd.getWorld());
}
});
// AcidIsland hook in
this.getPlugin().getAddonsManager().getAddonByName(ACIDISLAND).ifPresent(acidIsland -> {
CompositeCommand acidIslandCmd = getPlugin().getCommandsManager().getCommand("ai");
if (acidIslandCmd != null) {
new WarpCommand(this, acidIslandCmd);
new WarpsCommand(this, acidIslandCmd);
registeredWorlds.add(acidIslandCmd.getWorld());
}
});
// Done
}

View File

@ -9,6 +9,7 @@ import static org.mockito.Mockito.when;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import org.bukkit.Bukkit;
@ -33,14 +34,12 @@ import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import world.bentobox.warps.Warp;
import world.bentobox.warps.WarpSignsListener;
import world.bentobox.warps.WarpSignsManager;
import world.bentobox.warps.config.PluginConfig;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.managers.IslandWorldManager;
import world.bentobox.bentobox.managers.IslandsManager;
import world.bentobox.bentobox.managers.LocalesManager;
import world.bentobox.warps.config.PluginConfig;
@RunWith(PowerMockRunner.class)
@PrepareForTest({Bukkit.class})
@ -122,6 +121,10 @@ public class WarpSignsListenerTest {
// Sufficient level
when(addon.getLevel(Mockito.any(), Mockito.any())).thenReturn(100L);
IslandWorldManager iwm = mock(IslandWorldManager.class);
when(plugin.getIWM()).thenReturn(iwm);
when(iwm.getAddon(Mockito.any())).thenReturn(Optional.empty());
}
@Test