mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-28 05:35:44 +01:00
World Flags are saved in the config.yml file.
Previously, world settings (world setting flags) were not actually being saved anywhere. They are now saved in the config.yml. WIP: RemoveMobsListener.java Improved the FlagTest.
This commit is contained in:
parent
1fc1780fd1
commit
90563dac35
@ -231,6 +231,15 @@ public class Settings implements DataObject, WorldSettings {
|
||||
@ConfigComment("Default is false, because it is an experimental feature that can break a lot of redstone systems.")
|
||||
private boolean disableOfflineRedstone = false;
|
||||
|
||||
@ConfigComment("World flags. These are boolean settings for various flags for this world")
|
||||
@ConfigEntry(path = "world.flags")
|
||||
private Map<String, Boolean> worldFlags = new HashMap<>();
|
||||
{
|
||||
worldFlags.put("ENTER_EXIT_MESSAGES", true);
|
||||
worldFlags.put("PISTON_PUSH", true);
|
||||
worldFlags.put("REMOVE_MOBS", true);
|
||||
}
|
||||
|
||||
// ---------------------------------------------
|
||||
|
||||
/* ISLAND */
|
||||
@ -1509,4 +1518,18 @@ public class Settings implements DataObject, WorldSettings {
|
||||
this.ivSettings = ivSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the worldFlags
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Boolean> getWorldFlags() {
|
||||
return worldFlags;
|
||||
}
|
||||
/**
|
||||
* @param worldFlags the worldFlags to set
|
||||
*/
|
||||
public void setWorldFlags(Map<String, Boolean> worldFlags) {
|
||||
this.worldFlags = worldFlags;
|
||||
}
|
||||
|
||||
}
|
@ -132,4 +132,10 @@ public interface WorldSettings {
|
||||
*/
|
||||
List<String> getIvSettings();
|
||||
|
||||
/**
|
||||
* Get world flags
|
||||
* @return Map of world flags
|
||||
*/
|
||||
Map<String, Boolean> getWorldFlags();
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package us.tastybento.bskyblock.api.flags;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.bukkit.Material;
|
||||
@ -16,7 +14,6 @@ import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.managers.RanksManager;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
public class Flag implements Comparable<Flag> {
|
||||
|
||||
@ -31,7 +28,6 @@ public class Flag implements Comparable<Flag> {
|
||||
private final Material icon;
|
||||
private final Listener listener;
|
||||
private final Type type;
|
||||
private Map<World, Boolean> worldSettings = new HashMap<>();
|
||||
private boolean setting;
|
||||
private final int defaultRank;
|
||||
private final PanelItem.ClickHandler clickHandler;
|
||||
@ -61,19 +57,21 @@ public class Flag implements Comparable<Flag> {
|
||||
/**
|
||||
* Check if a setting is set in this world
|
||||
* @param world - world
|
||||
* @return world setting, or default system setting if a specific world setting is not set
|
||||
* @return world setting, or default flag setting if a specific world setting is not set
|
||||
*/
|
||||
public boolean isSetForWorld(World world) {
|
||||
return worldSettings.getOrDefault(Util.getWorld(world), setting);
|
||||
return BSkyBlock.getInstance().getIWM().getWorldSettings(world).getWorldFlags().getOrDefault(getID(), setting);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default or global setting for this world
|
||||
* Set a world setting
|
||||
* @param world - world
|
||||
* @param setting - true or false
|
||||
*/
|
||||
public void setSetting(World world, boolean setting) {
|
||||
worldSettings.put(Util.getWorld(world), setting);
|
||||
if (getType().equals(Type.WORLD_SETTING)) {
|
||||
BSkyBlock.getInstance().getIWM().getWorldSettings(world).getWorldFlags().put(getID(), setting);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,7 +173,9 @@ public class Flag implements Comparable<Flag> {
|
||||
// Dynamic rank list
|
||||
if (getType().equals(Type.PROTECTION)) {
|
||||
// Protection flag
|
||||
pib.description(user.getTranslation("protection.panel.flag-item.description-layout", "[description]", user.getTranslation("protection.flags." + id + ".description")));
|
||||
String d = user.getTranslation("protection.flags." + id + ".description");
|
||||
d = user.getTranslation("protection.panel.flag-item.description-layout", "[description]", d);
|
||||
pib.description(d);
|
||||
plugin.getRanksManager().getRanks().forEach((reference, score) -> {
|
||||
if (score > RanksManager.BANNED_RANK && score < island.getFlag(this)) {
|
||||
pib.description(user.getTranslation("protection.panel.flag-item.blocked_rank") + user.getTranslation(reference));
|
||||
|
@ -16,6 +16,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import us.tastybento.bskyblock.api.panels.Panel;
|
||||
import us.tastybento.bskyblock.api.panels.PanelItem;
|
||||
import us.tastybento.bskyblock.api.panels.PanelItem.ClickHandler;
|
||||
import us.tastybento.bskyblock.api.panels.builders.PanelBuilder;
|
||||
import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder;
|
||||
@ -41,9 +42,12 @@ public class InvincibleVisitorsListener extends AbstractFlagListener implements
|
||||
} else {
|
||||
getPlugin().getSettings().getIvSettings().add(c.name());
|
||||
}
|
||||
}
|
||||
// Apply change to panel
|
||||
panel.getInventory().setItem(slot, getPanelItem(c, user).getItem());
|
||||
} else {
|
||||
// Open the IV Settings panel
|
||||
openPanel(user, ivPanelName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -54,21 +58,23 @@ public class InvincibleVisitorsListener extends AbstractFlagListener implements
|
||||
PanelBuilder pb = new PanelBuilder();
|
||||
pb.user(user).name(ivPanelName);
|
||||
// Make panel items
|
||||
Arrays.stream(EntityDamageEvent.DamageCause.values()).forEach(c -> {
|
||||
Arrays.stream(EntityDamageEvent.DamageCause.values()).forEach(c -> pb.item(getPanelItem(c, user)));
|
||||
pb.build();
|
||||
|
||||
}
|
||||
|
||||
private PanelItem getPanelItem(DamageCause c, User user) {
|
||||
PanelItemBuilder pib = new PanelItemBuilder();
|
||||
pib.name(Util.prettifyText(c.toString()));
|
||||
pib.clickHandler(this);
|
||||
if (getPlugin().getSettings().getIvSettings().contains(c.name())) {
|
||||
pib.icon(Material.GREEN_GLAZED_TERRACOTTA);
|
||||
pib.icon(Material.GREEN_SHULKER_BOX);
|
||||
pib.description(user.getTranslation("protection.panel.flag-item.setting-active"));
|
||||
} else {
|
||||
pib.icon(Material.RED_GLAZED_TERRACOTTA);
|
||||
pib.icon(Material.RED_SHULKER_BOX);
|
||||
pib.description(user.getTranslation("protection.panel.flag-item.setting-disabled"));
|
||||
}
|
||||
pb.item(pib.build());
|
||||
});
|
||||
pb.build();
|
||||
|
||||
return pib.build();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,12 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package us.tastybento.bskyblock.listeners.flags;
|
||||
|
||||
/**
|
||||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
public class RemoveMobsListener extends AbstractFlagListener {
|
||||
|
||||
}
|
@ -29,6 +29,7 @@ import us.tastybento.bskyblock.listeners.flags.PhysicalInteractionListener;
|
||||
import us.tastybento.bskyblock.listeners.flags.PistonPushListener;
|
||||
import us.tastybento.bskyblock.listeners.flags.PlaceBlocksListener;
|
||||
import us.tastybento.bskyblock.listeners.flags.PortalListener;
|
||||
import us.tastybento.bskyblock.listeners.flags.RemoveMobsListener;
|
||||
import us.tastybento.bskyblock.listeners.flags.ShearingListener;
|
||||
import us.tastybento.bskyblock.listeners.flags.TeleportationListener;
|
||||
import us.tastybento.bskyblock.listeners.flags.clicklisteners.IslandToggleClickListener;
|
||||
@ -157,7 +158,8 @@ public class Flags {
|
||||
static InvincibleVisitorsListener ilv = new InvincibleVisitorsListener();
|
||||
public static final Flag INVINCIBLE_VISITORS = new FlagBuilder().id("INVINCIBLE_VISITORS").icon(Material.DIAMOND_CHESTPLATE).type(Type.MENU)
|
||||
.listener(ilv).onClick(ilv).build();
|
||||
|
||||
public static final Flag REMOVE_MOBS = new FlagBuilder().id("REMOVE_MOBS").icon(Material.GLOWSTONE_DUST).type(Type.WORLD_SETTING)
|
||||
.listener(new RemoveMobsListener()).allowedByDefault(true).onClick(new WorldToggleClickListener("REMOVE_MOBS")).build();
|
||||
/**
|
||||
* @return List of all the flags in this class
|
||||
*/
|
||||
|
@ -8,34 +8,43 @@ import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.ItemFactory;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.configuration.WorldSettings;
|
||||
import us.tastybento.bskyblock.api.panels.PanelItem;
|
||||
import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.managers.IslandWorldManager;
|
||||
import us.tastybento.bskyblock.managers.IslandsManager;
|
||||
import us.tastybento.bskyblock.managers.RanksManager;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({ Flag.class, Util.class })
|
||||
@PrepareForTest({ BSkyBlock.class, Util.class, Bukkit.class })
|
||||
public class FlagTest {
|
||||
|
||||
@BeforeClass
|
||||
@ -44,8 +53,27 @@ public class FlagTest {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
// Set up plugin
|
||||
BSkyBlock plugin = mock(BSkyBlock.class);
|
||||
Whitebox.setInternalState(BSkyBlock.class, "instance", plugin);
|
||||
|
||||
PowerMockito.mockStatic(Util.class);
|
||||
when(Util.getWorld(Mockito.any())).thenReturn(mock(World.class));
|
||||
|
||||
// World Settings
|
||||
IslandWorldManager iwm = mock(IslandWorldManager.class);
|
||||
when(plugin.getIWM()).thenReturn(iwm);
|
||||
WorldSettings ws = mock(WorldSettings.class);
|
||||
when(iwm.getWorldSettings(Mockito.any())).thenReturn(ws);
|
||||
Map<String, Boolean> worldFlags = new HashMap<>();
|
||||
when(ws.getWorldFlags()).thenReturn(worldFlags);
|
||||
|
||||
PowerMockito.mockStatic(Bukkit.class);
|
||||
ItemFactory itemF = mock(ItemFactory.class);
|
||||
ItemMeta im = mock(ItemMeta.class);
|
||||
when(itemF.getItemMeta(Mockito.any())).thenReturn(im);
|
||||
when(Bukkit.getItemFactory()).thenReturn(itemF);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -115,6 +143,7 @@ public class FlagTest {
|
||||
assertEquals(100, id.getDefaultRank());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unlikely-arg-type")
|
||||
@Test
|
||||
public void testEqualsObject() {
|
||||
Flag flag1 = null;
|
||||
@ -144,10 +173,22 @@ public class FlagTest {
|
||||
Island island = mock(Island.class);
|
||||
when(island.getFlag(Mockito.any())).thenReturn(RanksManager.VISITOR_RANK);
|
||||
|
||||
User user = mock(User.class);
|
||||
User user = mock(User.class, Mockito.withSettings().verboseLogging());
|
||||
when(user.getUniqueId()).thenReturn(UUID.randomUUID());
|
||||
when(user.getTranslation(Mockito.anyString())).thenReturn("translation");
|
||||
when(user.getTranslation(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString())).thenReturn("long translation");
|
||||
Answer<String> answer = new Answer<String>() {
|
||||
|
||||
@Override
|
||||
public String answer(InvocationOnMock invocation) throws Throwable {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Arrays.stream(invocation.getArguments()).forEach(sb::append);
|
||||
sb.append("mock");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
when(user.getTranslation(Mockito.anyVararg())).thenAnswer(answer);
|
||||
when(user.getTranslation(Mockito.any(),Mockito.any(),Mockito.any())).thenAnswer(answer);
|
||||
|
||||
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(island);
|
||||
when(im.getIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(island);
|
||||
@ -160,24 +201,15 @@ public class FlagTest {
|
||||
when(rm.getRank(Mockito.eq(RanksManager.VISITOR_RANK))).thenReturn("Visitor");
|
||||
when(rm.getRank(Mockito.eq(RanksManager.OWNER_RANK))).thenReturn("Owner");
|
||||
|
||||
PowerMockito.whenNew(ItemStack.class).withAnyArguments().thenReturn(mock(ItemStack.class));
|
||||
|
||||
PanelItemBuilder pib = mock(PanelItemBuilder.class);
|
||||
when(pib.description(Mockito.anyString())).thenReturn(pib);
|
||||
when(pib.name(Mockito.anyString())).thenReturn(pib);
|
||||
when(pib.icon(Mockito.any(ItemStack.class))).thenReturn(pib);
|
||||
when(pib.clickHandler(Mockito.any())).thenReturn(pib);
|
||||
when(pib.build()).thenReturn(mock(PanelItem.class));
|
||||
|
||||
// Remember to prepare the calling class, not the subject class!
|
||||
PowerMockito.whenNew(PanelItemBuilder.class).withAnyArguments().thenReturn(pib);
|
||||
|
||||
Flag id = new Flag("id", Material.ACACIA_DOOR, null, false, Flag.Type.PROTECTION, 0, null);
|
||||
|
||||
id.toPanelItem(plugin, user);
|
||||
PanelItem pi = id.toPanelItem(plugin, user);
|
||||
|
||||
verify(user).getTranslation(Mockito.eq("protection.flags.id.name"));
|
||||
verify(user).getTranslation(Mockito.eq("protection.panel.flag-item.name-layout"), Mockito.anyVararg());
|
||||
|
||||
assertEquals(Material.ACACIA_DOOR, pi.getItem().getType());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -7,6 +7,8 @@ import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -27,6 +29,7 @@ import org.powermock.reflect.Whitebox;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.api.configuration.WorldSettings;
|
||||
import us.tastybento.bskyblock.api.user.Notifier;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
@ -155,6 +158,12 @@ public class EnterExitListenerTest {
|
||||
|
||||
PowerMockito.mockStatic(Util.class);
|
||||
when(Util.getWorld(Mockito.any())).thenReturn(world);
|
||||
|
||||
// World Settings
|
||||
WorldSettings ws = mock(WorldSettings.class);
|
||||
when(iwm.getWorldSettings(Mockito.any())).thenReturn(ws);
|
||||
Map<String, Boolean> worldFlags = new HashMap<>();
|
||||
when(ws.getWorldFlags()).thenReturn(worldFlags);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,9 @@ import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -42,6 +44,7 @@ import org.powermock.reflect.Whitebox;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.api.configuration.WorldSettings;
|
||||
import us.tastybento.bskyblock.api.user.Notifier;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
@ -98,7 +101,6 @@ public class FireListenerTest {
|
||||
|
||||
// Worlds
|
||||
iwm = mock(IslandWorldManager.class);
|
||||
when(plugin.getIWM()).thenReturn(iwm);
|
||||
when(iwm.getIslandWorld()).thenReturn(world);
|
||||
when(iwm.getNetherWorld()).thenReturn(world);
|
||||
when(iwm.getEndWorld()).thenReturn(world);
|
||||
@ -134,6 +136,12 @@ public class FireListenerTest {
|
||||
PlayersManager pm = mock(PlayersManager.class);
|
||||
when(pm.getName(Mockito.any())).thenReturn("tastybento");
|
||||
when(plugin.getPlayers()).thenReturn(pm);
|
||||
|
||||
// World Settings
|
||||
WorldSettings ws = mock(WorldSettings.class);
|
||||
when(iwm.getWorldSettings(Mockito.any())).thenReturn(ws);
|
||||
Map<String, Boolean> worldFlags = new HashMap<>();
|
||||
when(ws.getWorldFlags()).thenReturn(worldFlags);
|
||||
}
|
||||
|
||||
@Before
|
||||
|
@ -6,6 +6,8 @@ import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -34,6 +36,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.configuration.WorldSettings;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.lists.Flags;
|
||||
import us.tastybento.bskyblock.managers.FlagsManager;
|
||||
@ -114,6 +117,12 @@ public class MobSpawnListenerTest {
|
||||
PowerMockito.mockStatic(Util.class);
|
||||
when(Util.getWorld(Mockito.any())).thenReturn(mock(World.class));
|
||||
|
||||
// World Settings
|
||||
WorldSettings ws = mock(WorldSettings.class);
|
||||
when(iwm.getWorldSettings(Mockito.any())).thenReturn(ws);
|
||||
Map<String, Boolean> worldFlags = new HashMap<>();
|
||||
when(ws.getWorldFlags()).thenReturn(worldFlags);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.api.configuration.WorldSettings;
|
||||
import us.tastybento.bskyblock.api.flags.Flag;
|
||||
import us.tastybento.bskyblock.api.panels.Panel;
|
||||
import us.tastybento.bskyblock.api.panels.PanelItem;
|
||||
@ -184,6 +185,12 @@ public class PVPListenerTest {
|
||||
BukkitScheduler sch = mock(BukkitScheduler.class);
|
||||
PowerMockito.mockStatic(Bukkit.class);
|
||||
when(Bukkit.getScheduler()).thenReturn(sch);
|
||||
|
||||
// World Settings
|
||||
WorldSettings ws = mock(WorldSettings.class);
|
||||
when(iwm.getWorldSettings(Mockito.any())).thenReturn(ws);
|
||||
Map<String, Boolean> worldFlags = new HashMap<>();
|
||||
when(ws.getWorldFlags()).thenReturn(worldFlags);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,9 @@ import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -25,8 +27,10 @@ import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.configuration.WorldSettings;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.lists.Flags;
|
||||
import us.tastybento.bskyblock.managers.IslandWorldManager;
|
||||
import us.tastybento.bskyblock.managers.IslandsManager;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
@ -89,7 +93,14 @@ public class PistonPushListenerTest {
|
||||
PowerMockito.mockStatic(Util.class);
|
||||
when(Util.getWorld(Mockito.any())).thenReturn(world);
|
||||
|
||||
Flags.PISTON_PUSH.setSetting(world, true);
|
||||
// World Settings
|
||||
IslandWorldManager iwm = mock(IslandWorldManager.class);
|
||||
when(plugin.getIWM()).thenReturn(iwm);
|
||||
WorldSettings ws = mock(WorldSettings.class);
|
||||
when(iwm.getWorldSettings(Mockito.any())).thenReturn(ws);
|
||||
Map<String, Boolean> worldFlags = new HashMap<>();
|
||||
when(ws.getWorldFlags()).thenReturn(worldFlags);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user