Updated to lated API
This commit is contained in:
parent
695e8b4c6b
commit
e80be18712
10
pom.xml
10
pom.xml
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
<groupId>world.bentobox</groupId>
|
<groupId>world.bentobox</groupId>
|
||||||
<artifactId>WelcomeWarpSigns</artifactId>
|
<artifactId>WelcomeWarpSigns</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>1.1-SNAPSHOT</version>
|
||||||
|
|
||||||
<name>WelcomeWarpSigns</name>
|
<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>
|
<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>
|
<dependency>
|
||||||
<groupId>world.bentobox</groupId>
|
<groupId>world.bentobox</groupId>
|
||||||
<artifactId>bentobox</artifactId>
|
<artifactId>bentobox</artifactId>
|
||||||
<version>0.12.0-SNAPSHOT</version>
|
<version>1.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>world.bentobox</groupId>
|
<groupId>world.bentobox</groupId>
|
||||||
<artifactId>Level</artifactId>
|
<artifactId>level</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>1.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -218,7 +218,7 @@
|
||||||
<id>sonar</id>
|
<id>sonar</id>
|
||||||
<properties>
|
<properties>
|
||||||
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
||||||
<sonar.organization>tastybento-github</sonar.organization>
|
<sonar.organization>bentobox-world</sonar.organization>
|
||||||
</properties>
|
</properties>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
|
@ -6,14 +6,13 @@ import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.World;
|
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.level.Level;
|
||||||
import world.bentobox.warps.commands.WarpCommand;
|
import world.bentobox.warps.commands.WarpCommand;
|
||||||
import world.bentobox.warps.commands.WarpsCommand;
|
import world.bentobox.warps.commands.WarpsCommand;
|
||||||
import world.bentobox.warps.config.PluginConfig;
|
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
|
* Addin to BSkyBlock that enables welcome warp signs
|
||||||
|
@ -57,26 +56,16 @@ public class Warp extends Addon {
|
||||||
// Load the listener
|
// Load the listener
|
||||||
getServer().getPluginManager().registerEvents(new WarpSignsListener(this), plugin);
|
getServer().getPluginManager().registerEvents(new WarpSignsListener(this), plugin);
|
||||||
// Register commands
|
// 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
|
// Done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -33,14 +34,12 @@ import org.powermock.api.mockito.PowerMockito;
|
||||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
import org.powermock.modules.junit4.PowerMockRunner;
|
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.BentoBox;
|
||||||
import world.bentobox.bentobox.api.user.User;
|
import world.bentobox.bentobox.api.user.User;
|
||||||
|
import world.bentobox.bentobox.managers.IslandWorldManager;
|
||||||
import world.bentobox.bentobox.managers.IslandsManager;
|
import world.bentobox.bentobox.managers.IslandsManager;
|
||||||
import world.bentobox.bentobox.managers.LocalesManager;
|
import world.bentobox.bentobox.managers.LocalesManager;
|
||||||
|
import world.bentobox.warps.config.PluginConfig;
|
||||||
|
|
||||||
@RunWith(PowerMockRunner.class)
|
@RunWith(PowerMockRunner.class)
|
||||||
@PrepareForTest({Bukkit.class})
|
@PrepareForTest({Bukkit.class})
|
||||||
|
@ -122,6 +121,10 @@ public class WarpSignsListenerTest {
|
||||||
|
|
||||||
// Sufficient level
|
// Sufficient level
|
||||||
when(addon.getLevel(Mockito.any(), Mockito.any())).thenReturn(100L);
|
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
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue