use of net.glowstone.util.bans.UuidListFile in project Glowstone by GlowstoneMC.
the class GlowPlayerTest method setUp.
@Before
@Override
public void setUp() throws Exception {
PowerMockito.mockStatic(Bukkit.class);
super.setUp();
when(Bukkit.getServer()).thenReturn(server);
when(Bukkit.getItemFactory()).thenReturn(itemFactory);
opsListFile = File.createTempFile("test-ops-list", "");
opsList = new UuidListFile(opsListFile);
when(server.getSessionRegistry()).thenReturn(sessionRegistry);
when(server.getPluginManager()).thenReturn(pluginManager);
when(server.getMaterialValueManager()).thenReturn(materialValueManager);
scheduler = new GlowScheduler(server, worldScheduler);
when(session.getServer()).thenReturn(server);
when(server.getScheduler()).thenReturn(scheduler);
when(server.getOpsList()).thenReturn(opsList);
when(server.getPlayerStatisticIoService()).thenReturn(statisticIoService);
when(world.getSpawnLocation()).thenReturn(location);
when(world.getBlockAt(anyInt(), anyInt(), anyInt())).thenReturn(block);
when(world.getBlockAt(any(Location.class))).thenReturn(block);
when(world.getChunkManager()).thenReturn(chunkManager);
when(world.newChunkLock(anyString())).thenReturn(chunkLock);
when(block.getLocation()).thenReturn(location);
when(block.getType()).thenReturn(Material.AIR);
when(block.getRelative(any(BlockFace.class))).thenReturn(block);
when(block.getMaterialValues()).thenCallRealMethod();
when(block.getWorld()).thenReturn(world);
fishingRodItem = new ItemStack(Material.FISHING_ROD);
entity = entityCreator.apply(location);
entity.setItemInHand(fishingRodItem);
entity.setDigging(null);
entity.setLevel(1);
when(session.getPlayer()).thenReturn(entity);
when(session.getChannel()).thenReturn(null);
when(world.getRawPlayers()).thenReturn(Collections.singletonList(entity));
EventFactory.setInstance(eventFactory);
when(eventFactory.callEvent(any(Event.class))).thenAnswer(returnsFirstArg());
}
Aggregations