Search in sources :

Example 1 with FishingRewardManager

use of net.glowstone.entity.FishingRewardManager in project Glowstone by GlowstoneMC.

the class GlowFishingHookTest method setUp.

@Before
@Override
public void setUp() throws Exception {
    super.setUp();
    PowerMockito.mockStatic(Bukkit.class);
    when(Bukkit.getServer()).thenReturn(server);
    eventsFired.removeAll(PlayerFishEvent.class);
    when(world.getBlockAt(any(Location.class))).thenReturn(block);
    when(world.getBlockAt(anyInt(), anyInt(), anyInt())).thenReturn(block);
    when(block.getType()).thenReturn(Material.WATER);
    fishingRewardManager = new FishingRewardManager();
    when(server.getFishingRewardManager()).thenReturn(fishingRewardManager);
    when(player.getLocation()).thenReturn(location);
    when(eventFactory.callEvent(any(Event.class))).thenAnswer(invocation -> {
        Event e = invocation.getArgument(0);
        eventsFired.put(e.getClass(), e);
        return e;
    });
    when(eventFactory.onEntityDamage(any(EntityDamageEvent.class))).thenAnswer(returnsFirstArg());
}
Also used : FishingRewardManager(net.glowstone.entity.FishingRewardManager) Event(org.bukkit.event.Event) PlayerFishEvent(org.bukkit.event.player.PlayerFishEvent) EntityDamageEvent(org.bukkit.event.entity.EntityDamageEvent) Location(org.bukkit.Location) EntityDamageEvent(org.bukkit.event.entity.EntityDamageEvent) Before(org.junit.Before)

Aggregations

FishingRewardManager (net.glowstone.entity.FishingRewardManager)1 Location (org.bukkit.Location)1 Event (org.bukkit.event.Event)1 EntityDamageEvent (org.bukkit.event.entity.EntityDamageEvent)1 PlayerFishEvent (org.bukkit.event.player.PlayerFishEvent)1 Before (org.junit.Before)1