mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 19:55:17 +01:00
Added default Game Mode to world settings.
https://github.com/tastybento/bskyblock/issues/179 Removed references to acid from settings for BSB.
This commit is contained in:
parent
617fc712aa
commit
8125ec52af
@ -131,6 +131,11 @@ world:
|
||||
# If the number of islands is greater than this number, no new island will be created.
|
||||
max-islands: 0
|
||||
|
||||
# The default game mode for this world. Players will be set to this mode when they create
|
||||
# a new island for example. Options are SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR
|
||||
default-game-mode: SURVIVAL
|
||||
|
||||
|
||||
### Nether-related Settings ###
|
||||
nether:
|
||||
# Generate Nether - if this is false, the nether world will not be made and access to
|
||||
|
@ -1,7 +1,6 @@
|
||||
package us.tastybento.bskyblock;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -9,11 +8,10 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import us.tastybento.bskyblock.Constants.GameType;
|
||||
import us.tastybento.bskyblock.api.configuration.ConfigComment;
|
||||
import us.tastybento.bskyblock.api.configuration.ConfigEntry;
|
||||
import us.tastybento.bskyblock.api.configuration.StoreAt;
|
||||
@ -21,8 +19,6 @@ import us.tastybento.bskyblock.api.configuration.WorldSettings;
|
||||
import us.tastybento.bskyblock.api.flags.Flag;
|
||||
import us.tastybento.bskyblock.database.BSBDbSetup.DatabaseType;
|
||||
import us.tastybento.bskyblock.database.objects.DataObject;
|
||||
import us.tastybento.bskyblock.database.objects.adapters.Adapter;
|
||||
import us.tastybento.bskyblock.database.objects.adapters.PotionEffectListAdapter;
|
||||
|
||||
/**
|
||||
* All the plugin settings are here
|
||||
@ -185,6 +181,11 @@ public class Settings implements DataObject, WorldSettings {
|
||||
@ConfigEntry(path = "world.max-islands")
|
||||
private int maxIslands = -1;
|
||||
|
||||
@ConfigComment("The default game mode for this world. Players will be set to this mode when they create")
|
||||
@ConfigComment("a new island for example. Options are SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR")
|
||||
@ConfigEntry(path = "world.default-game-mode")
|
||||
private GameMode defaultGameMode = GameMode.SURVIVAL;
|
||||
|
||||
// Nether
|
||||
@ConfigComment("Generate Nether - if this is false, the nether world will not be made and access to")
|
||||
@ConfigComment("the nether will not occur. Other plugins may still enable portal usage.")
|
||||
@ -354,31 +355,6 @@ public class Settings implements DataObject, WorldSettings {
|
||||
|
||||
// ---------------------------------------------
|
||||
|
||||
/* ACID */
|
||||
|
||||
/*
|
||||
* This settings category only exists if the GameType is ACIDISLAND.
|
||||
*/
|
||||
|
||||
@ConfigEntry(path = "acid.damage-op", specificTo = GameType.ACIDISLAND)
|
||||
private boolean acidDamageOp = false;
|
||||
|
||||
@ConfigEntry(path = "acid.damage-chickens", specificTo = GameType.ACIDISLAND)
|
||||
private boolean acidDamageChickens = false;
|
||||
|
||||
@ConfigEntry(path = "acid.options.item-destroy-time", specificTo = GameType.ACIDISLAND)
|
||||
private int acidDestroyItemTime = 0;
|
||||
|
||||
// Damage
|
||||
@ConfigEntry(path = "acid.damage.acid.player", specificTo = GameType.ACIDISLAND)
|
||||
private int acidDamage = 10;
|
||||
|
||||
@ConfigEntry(path = "acid.damage.rain", specificTo = GameType.ACIDISLAND)
|
||||
private int acidRainDamage = 1;
|
||||
|
||||
@ConfigEntry(path = "acid.damage.effects", specificTo = GameType.ACIDISLAND)
|
||||
@Adapter(PotionEffectListAdapter.class)
|
||||
private List<PotionEffectType> acidEffects = new ArrayList<>(Arrays.asList(PotionEffectType.CONFUSION, PotionEffectType.SLOW));
|
||||
|
||||
/* SCHEMATICS */
|
||||
private List<String> companionNames = new ArrayList<>();
|
||||
@ -475,30 +451,6 @@ public class Settings implements DataObject, WorldSettings {
|
||||
public void setDisableOfflineRedstone(boolean disableOfflineRedstone) {
|
||||
this.disableOfflineRedstone = disableOfflineRedstone;
|
||||
}
|
||||
/**
|
||||
* @return the acidDamage
|
||||
*/
|
||||
public int getAcidDamage() {
|
||||
return acidDamage;
|
||||
}
|
||||
/**
|
||||
* @return the acidDestroyItemTime
|
||||
*/
|
||||
public int getAcidDestroyItemTime() {
|
||||
return acidDestroyItemTime;
|
||||
}
|
||||
/**
|
||||
* @return the acidEffects
|
||||
*/
|
||||
public List<PotionEffectType> getAcidEffects() {
|
||||
return acidEffects;
|
||||
}
|
||||
/**
|
||||
* @return the acidRainDamage
|
||||
*/
|
||||
public int getAcidRainDamage() {
|
||||
return acidRainDamage;
|
||||
}
|
||||
/**
|
||||
* @return the chestItems
|
||||
*/
|
||||
@ -586,6 +538,7 @@ public class Settings implements DataObject, WorldSettings {
|
||||
/**
|
||||
* @return the entityLimits
|
||||
*/
|
||||
@Override
|
||||
public Map<EntityType, Integer> getEntityLimits() {
|
||||
return entityLimits;
|
||||
}
|
||||
@ -599,42 +552,49 @@ public class Settings implements DataObject, WorldSettings {
|
||||
/**
|
||||
* @return the islandDistance
|
||||
*/
|
||||
@Override
|
||||
public int getIslandDistance() {
|
||||
return islandDistance;
|
||||
}
|
||||
/**
|
||||
* @return the islandHeight
|
||||
*/
|
||||
@Override
|
||||
public int getIslandHeight() {
|
||||
return islandHeight;
|
||||
}
|
||||
/**
|
||||
* @return the islandProtectionRange
|
||||
*/
|
||||
@Override
|
||||
public int getIslandProtectionRange() {
|
||||
return islandProtectionRange;
|
||||
}
|
||||
/**
|
||||
* @return the islandStartX
|
||||
*/
|
||||
@Override
|
||||
public int getIslandStartX() {
|
||||
return islandStartX;
|
||||
}
|
||||
/**
|
||||
* @return the islandStartZ
|
||||
*/
|
||||
@Override
|
||||
public int getIslandStartZ() {
|
||||
return islandStartZ;
|
||||
}
|
||||
/**
|
||||
* @return the islandXOffset
|
||||
*/
|
||||
@Override
|
||||
public int getIslandXOffset() {
|
||||
return islandXOffset;
|
||||
}
|
||||
/**
|
||||
* @return the islandZOffset
|
||||
*/
|
||||
@Override
|
||||
public int getIslandZOffset() {
|
||||
return islandZOffset;
|
||||
}
|
||||
@ -666,12 +626,14 @@ public class Settings implements DataObject, WorldSettings {
|
||||
/**
|
||||
* @return the maxIslands
|
||||
*/
|
||||
@Override
|
||||
public int getMaxIslands() {
|
||||
return maxIslands;
|
||||
}
|
||||
/**
|
||||
* @return the maxTeamSize
|
||||
*/
|
||||
@Override
|
||||
public int getMaxTeamSize() {
|
||||
return maxTeamSize;
|
||||
}
|
||||
@ -690,6 +652,7 @@ public class Settings implements DataObject, WorldSettings {
|
||||
/**
|
||||
* @return the netherSpawnRadius
|
||||
*/
|
||||
@Override
|
||||
public int getNetherSpawnRadius() {
|
||||
return netherSpawnRadius;
|
||||
}
|
||||
@ -714,12 +677,14 @@ public class Settings implements DataObject, WorldSettings {
|
||||
/**
|
||||
* @return the seaHeight
|
||||
*/
|
||||
@Override
|
||||
public int getSeaHeight() {
|
||||
return seaHeight;
|
||||
}
|
||||
/**
|
||||
* @return the tileEntityLimits
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Integer> getTileEntityLimits() {
|
||||
return tileEntityLimits;
|
||||
}
|
||||
@ -739,21 +704,10 @@ public class Settings implements DataObject, WorldSettings {
|
||||
/**
|
||||
* @return the worldName
|
||||
*/
|
||||
@Override
|
||||
public String getWorldName() {
|
||||
return worldName;
|
||||
}
|
||||
/**
|
||||
* @return the acidDamageChickens
|
||||
*/
|
||||
public boolean isAcidDamageChickens() {
|
||||
return acidDamageChickens;
|
||||
}
|
||||
/**
|
||||
* @return the acidDamageOp
|
||||
*/
|
||||
public boolean isAcidDamageOp() {
|
||||
return acidDamageOp;
|
||||
}
|
||||
/**
|
||||
* @return the allowChestDamage
|
||||
*/
|
||||
@ -823,12 +777,14 @@ public class Settings implements DataObject, WorldSettings {
|
||||
/**
|
||||
* @return the endGenerate
|
||||
*/
|
||||
@Override
|
||||
public boolean isEndGenerate() {
|
||||
return endGenerate;
|
||||
}
|
||||
/**
|
||||
* @return the endIslands
|
||||
*/
|
||||
@Override
|
||||
public boolean isEndIslands() {
|
||||
return endIslands;
|
||||
}
|
||||
@ -937,42 +893,6 @@ public class Settings implements DataObject, WorldSettings {
|
||||
public boolean isUseOwnGenerator() {
|
||||
return useOwnGenerator;
|
||||
}
|
||||
/**
|
||||
* @param acidDamage the acidDamage to set
|
||||
*/
|
||||
public void setAcidDamage(int acidDamage) {
|
||||
this.acidDamage = acidDamage;
|
||||
}
|
||||
/**
|
||||
* @param acidDamageChickens the acidDamageChickens to set
|
||||
*/
|
||||
public void setAcidDamageChickens(boolean acidDamageChickens) {
|
||||
this.acidDamageChickens = acidDamageChickens;
|
||||
}
|
||||
/**
|
||||
* @param acidDamageOp the acidDamageOp to set
|
||||
*/
|
||||
public void setAcidDamageOp(boolean acidDamageOp) {
|
||||
this.acidDamageOp = acidDamageOp;
|
||||
}
|
||||
/**
|
||||
* @param acidDestroyItemTime the acidDestroyItemTime to set
|
||||
*/
|
||||
public void setAcidDestroyItemTime(int acidDestroyItemTime) {
|
||||
this.acidDestroyItemTime = acidDestroyItemTime;
|
||||
}
|
||||
/**
|
||||
* @param acidEffects the acidEffects to set
|
||||
*/
|
||||
public void setAcidEffects(List<PotionEffectType> acidEffects) {
|
||||
this.acidEffects = acidEffects;
|
||||
}
|
||||
/**
|
||||
* @param acidRainDamage the acidRainDamage to set
|
||||
*/
|
||||
public void setAcidRainDamage(int acidRainDamage) {
|
||||
this.acidRainDamage = acidRainDamage;
|
||||
}
|
||||
/**
|
||||
* @param allowChestDamage the allowChestDamage to set
|
||||
*/
|
||||
@ -1436,6 +1356,7 @@ public class Settings implements DataObject, WorldSettings {
|
||||
/**
|
||||
* @return the dragonSpawn
|
||||
*/
|
||||
@Override
|
||||
public boolean isDragonSpawn() {
|
||||
return dragonSpawn;
|
||||
}
|
||||
@ -1495,5 +1416,19 @@ public class Settings implements DataObject, WorldSettings {
|
||||
public void setClosePanelOnClickOutside(boolean closePanelOnClickOutside) {
|
||||
this.closePanelOnClickOutside = closePanelOnClickOutside;
|
||||
}
|
||||
/**
|
||||
* @return the defaultGameMode
|
||||
*/
|
||||
@Override
|
||||
public GameMode getDefaultGameMode() {
|
||||
return defaultGameMode;
|
||||
}
|
||||
/**
|
||||
* @param defaultGameMode the defaultGameMode to set
|
||||
*/
|
||||
public void setDefaultGameMode(GameMode defaultGameMode) {
|
||||
this.defaultGameMode = defaultGameMode;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -97,24 +97,6 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
|
||||
private static Map<User, Confirmer> toBeConfirmed = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Used only for testing....
|
||||
*/
|
||||
public CompositeCommand(BSkyBlock plugin, String label, String... string) {
|
||||
super(label);
|
||||
this.plugin = plugin;
|
||||
setAliases(new ArrayList<>(Arrays.asList(string)));
|
||||
parent = null;
|
||||
setUsage("");
|
||||
subCommandLevel = 0; // Top level
|
||||
subCommands = new LinkedHashMap<>();
|
||||
subCommandAliases = new LinkedHashMap<>();
|
||||
setup();
|
||||
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
|
||||
new DefaultHelpCommand(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Top level command
|
||||
* @param addon - addon creating the command
|
||||
@ -122,17 +104,8 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
* @param aliases - aliases
|
||||
*/
|
||||
public CompositeCommand(Addon addon, String label, String... aliases) {
|
||||
this(label, aliases);
|
||||
this.addon = addon;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the top-level command constructor for commands that have no parent.
|
||||
* @param label - string for this command
|
||||
* @param aliases - aliases for this command
|
||||
*/
|
||||
public CompositeCommand(String label, String... aliases) {
|
||||
super(label);
|
||||
this.addon = addon;
|
||||
this.topLabel = label;
|
||||
this.plugin = BSkyBlock.getInstance();
|
||||
setAliases(new ArrayList<>(Arrays.asList(aliases)));
|
||||
@ -143,7 +116,8 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
subCommandAliases = new LinkedHashMap<>();
|
||||
// Register command if it is not already registered
|
||||
if (plugin.getCommand(label) == null) {
|
||||
plugin.getCommandsManager().registerCommand(this);
|
||||
plugin.getCommandsManager()
|
||||
.registerCommand(this);
|
||||
}
|
||||
setup();
|
||||
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
|
||||
@ -151,6 +125,15 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the top-level command constructor for commands that have no parent.
|
||||
* @param label - string for this command
|
||||
* @param aliases - aliases for this command
|
||||
*/
|
||||
public CompositeCommand(String label, String... aliases) {
|
||||
this((Addon)null, label, aliases);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sub-command constructor
|
||||
* @param parent - the parent composite command
|
||||
|
@ -3,6 +3,7 @@ package us.tastybento.bskyblock.api.configuration;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
/**
|
||||
@ -138,4 +139,10 @@ public interface WorldSettings {
|
||||
*/
|
||||
Map<String, Boolean> getWorldFlags();
|
||||
|
||||
/**
|
||||
* Get the default game mode for this game world, e.g. SURVIVAL
|
||||
* @return game mode
|
||||
*/
|
||||
GameMode getDefaultGameMode();
|
||||
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ public class AdminInfoCommand extends CompositeCommand {
|
||||
}
|
||||
// If there are no args, then the player wants info on the island at this location
|
||||
if (args.isEmpty()) {
|
||||
getPlugin().log("DEBUG: getting info - no args");
|
||||
if (!getIslands().getIslandAt(user.getLocation()).map(i -> i.showInfo(getPlugin(), user, getWorld())).orElse(false)) {
|
||||
user.sendMessage("commands.admin.info.no-island");
|
||||
return false;
|
||||
|
@ -89,7 +89,7 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand {
|
||||
getPlayers().setDeaths(playerUUID, 0);
|
||||
}
|
||||
// Put player back into normal mode
|
||||
user.setGameMode(GameMode.SURVIVAL);
|
||||
user.setGameMode(getIWM().getDefaultGameMode(getWorld()));
|
||||
|
||||
user.sendMessage("commands.island.team.invite.accept.you-joined-island", TextVariables.LABEL, getTopLabel());
|
||||
User inviter = User.getInstance(itc.getInviteCommand().getInviteList().get(playerUUID));
|
||||
|
@ -7,6 +7,7 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
@ -477,4 +478,12 @@ public class IslandWorldManager {
|
||||
return flag.isSetForWorld(world);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default game mode for this world.
|
||||
* @param world - world
|
||||
* @return GameMode: SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR
|
||||
*/
|
||||
public GameMode getDefaultGameMode(World world) {
|
||||
return worldSettings.get(Util.getWorld(world)).getDefaultGameMode();
|
||||
}
|
||||
}
|
||||
|
@ -74,11 +74,6 @@ public class IslandsManager {
|
||||
|| space1.getType() == Material.ENDER_PORTAL || ground.getType() == Material.ENDER_PORTAL || space2.getType() == Material.ENDER_PORTAL) {
|
||||
return false;
|
||||
}
|
||||
// In BSkyBlock, liquid may be unsafe
|
||||
// Check if acid has no damage
|
||||
if (plugin.getSettings().getAcidDamage() > 0D && (ground.isLiquid() || space1.isLiquid() || space2.isLiquid())) {
|
||||
return false;
|
||||
}
|
||||
if (ground.getType().equals(Material.STATIONARY_LAVA) || ground.getType().equals(Material.LAVA)
|
||||
|| space1.getType().equals(Material.STATIONARY_LAVA) || space1.getType().equals(Material.LAVA)
|
||||
|| space2.getType().equals(Material.STATIONARY_LAVA) || space2.getType().equals(Material.LAVA)) {
|
||||
@ -517,7 +512,7 @@ public class IslandsManager {
|
||||
}
|
||||
// Exit spectator mode if in it
|
||||
if (player.getGameMode().equals(GameMode.SPECTATOR)) {
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
player.setGameMode(plugin.getIWM().getDefaultGameMode(world));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ public class SafeSpotTeleport {
|
||||
entity.sendMessage(failureMessage);
|
||||
}
|
||||
if (entity instanceof Player && ((Player)entity).getGameMode().equals(GameMode.SPECTATOR)) {
|
||||
((Player)entity).setGameMode(GameMode.SURVIVAL);
|
||||
((Player)entity).setGameMode(plugin.getIWM().getDefaultGameMode(bestSpot.getWorld()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ public class SafeSpotTeleport {
|
||||
if (entity instanceof Player) {
|
||||
Player player = (Player)entity;
|
||||
if (player.getGameMode().equals(GameMode.SPECTATOR)) {
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
player.setGameMode(plugin.getIWM().getDefaultGameMode(loc.getWorld()));
|
||||
}
|
||||
} else {
|
||||
entity.setVelocity(velocity);
|
||||
|
@ -59,6 +59,7 @@ import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.listeners.flags.AbstractFlagListener;
|
||||
import us.tastybento.bskyblock.lists.Flags;
|
||||
import us.tastybento.bskyblock.managers.CommandsManager;
|
||||
import us.tastybento.bskyblock.managers.FlagsManager;
|
||||
import us.tastybento.bskyblock.managers.IslandWorldManager;
|
||||
import us.tastybento.bskyblock.managers.IslandsManager;
|
||||
@ -82,9 +83,10 @@ public class TestBSkyBlock {
|
||||
private static Player visitorToIsland;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUp() {
|
||||
public static void setUpBeforeClass() {
|
||||
// Set up plugin
|
||||
plugin = mock(BSkyBlock.class);
|
||||
when(plugin.getCommandsManager()).thenReturn(mock(CommandsManager.class));
|
||||
Whitebox.setInternalState(BSkyBlock.class, "instance", plugin);
|
||||
|
||||
Server server = mock(Server.class);
|
||||
@ -162,16 +164,12 @@ public class TestBSkyBlock {
|
||||
members.put(OWNER_UUID, RanksManager.OWNER_RANK);
|
||||
members.put(MEMBER_UUID, RanksManager.MEMBER_RANK);
|
||||
island.setMembers(members);
|
||||
Bukkit.getLogger().info("SETUP: owner UUID = " + OWNER_UUID);
|
||||
Bukkit.getLogger().info("SETUP: member UUID = " + MEMBER_UUID);
|
||||
Bukkit.getLogger().info("SETUP: visitor UUID = " + VISITOR_UUID);
|
||||
Mockito.when(im.getIslandAt(Matchers.any())).thenReturn(Optional.of(island));
|
||||
when(im.getProtectedIslandAt(Mockito.any())).thenReturn(Optional.of(island));
|
||||
|
||||
Settings settings = mock(Settings.class);
|
||||
Mockito.when(plugin.getSettings()).thenReturn(settings);
|
||||
Mockito.when(settings.getFakePlayers()).thenReturn(new HashSet<>());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -252,7 +250,7 @@ public class TestBSkyBlock {
|
||||
private class TestCommand extends CompositeCommand {
|
||||
|
||||
public TestCommand() {
|
||||
super(plugin, "test", "t", "tt");
|
||||
super("test", "t", "tt");
|
||||
setParameters("test.params");
|
||||
}
|
||||
|
||||
@ -354,7 +352,7 @@ public class TestBSkyBlock {
|
||||
private class Test3ArgsCommand extends CompositeCommand {
|
||||
|
||||
public Test3ArgsCommand() {
|
||||
super(plugin, "args", "");
|
||||
super("args", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -234,31 +234,6 @@ public class IslandsManagerTest {
|
||||
assertFalse(manager.isSafeLocation(location));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}.
|
||||
*/
|
||||
@Test
|
||||
public void testIsSafeLocationAcid() {
|
||||
when(ground.getType()).thenReturn(Material.GRASS);
|
||||
when(space1.getType()).thenReturn(Material.STATIONARY_WATER);
|
||||
when(space2.getType()).thenReturn(Material.AIR);
|
||||
|
||||
when(s.getAcidDamage()).thenReturn(10);
|
||||
|
||||
when(ground.isLiquid()).thenReturn(true);
|
||||
when(space1.isLiquid()).thenReturn(false);
|
||||
when(space2.isLiquid()).thenReturn(false);
|
||||
assertFalse("In acid", manager.isSafeLocation(location));
|
||||
when(ground.isLiquid()).thenReturn(false);
|
||||
when(space1.isLiquid()).thenReturn(true);
|
||||
when(space2.isLiquid()).thenReturn(false);
|
||||
assertFalse("In acid", manager.isSafeLocation(location));
|
||||
when(ground.isLiquid()).thenReturn(false);
|
||||
when(space1.isLiquid()).thenReturn(false);
|
||||
when(space2.isLiquid()).thenReturn(true);
|
||||
assertFalse("In acid", manager.isSafeLocation(location));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}.
|
||||
*/
|
||||
@ -623,6 +598,7 @@ public class IslandsManagerTest {
|
||||
*/
|
||||
@Test
|
||||
public void testHomeTeleportPlayerInt() {
|
||||
when(iwm.getDefaultGameMode(world)).thenReturn(GameMode.SURVIVAL);
|
||||
IslandsManager im = new IslandsManager(plugin);
|
||||
when(pm.getHomeLocation(Mockito.any(), Mockito.any(User.class), Mockito.eq(0))).thenReturn(null);
|
||||
when(pm.getHomeLocation(Mockito.any(), Mockito.any(User.class), Mockito.eq(1))).thenReturn(location);
|
||||
@ -633,6 +609,22 @@ public class IslandsManagerTest {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#homeTeleport(org.bukkit.entity.Player, int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testHomeTeleportPlayerIntDifferentGameMode() {
|
||||
when(iwm.getDefaultGameMode(world)).thenReturn(GameMode.CREATIVE);
|
||||
IslandsManager im = new IslandsManager(plugin);
|
||||
when(pm.getHomeLocation(Mockito.any(), Mockito.any(User.class), Mockito.eq(0))).thenReturn(null);
|
||||
when(pm.getHomeLocation(Mockito.any(), Mockito.any(User.class), Mockito.eq(1))).thenReturn(location);
|
||||
when(player.getGameMode()).thenReturn(GameMode.SPECTATOR);
|
||||
im.homeTeleport(world, player, 0);
|
||||
Mockito.verify(player).teleport(location);
|
||||
Mockito.verify(player).setGameMode(GameMode.CREATIVE);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#isAtSpawn(org.bukkit.Location)}.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user