mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-28 23:10:32 +00:00
Fixed mining and timeout settings
- Pending biome reads no longer cancel block breaking - Custom loot resolves saved biome history after accepted breaks - Native drops survive failed reads and runtime teardown without duplication - Tree felling captures the original tool for fallback drops - Modded block loot resolves one historical biome context - Timeout settings persist atomically through the actual server configuration paths - Tests cover deferred loot, teardown and timeout persistence
This commit is contained in:
1 parent
2145e90b1c
commit
e3673afb1e
17 files changed
+1220
-329
No files matched your search
+41
@@ -0,0 +1,41 @@
|
||||
package art.arcane.iris.world.tree;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class RoutedBlockBreakEventTest {
|
||||
@Test
|
||||
public void nativeLootUsesTheReservedToolCloneWithoutReadingPlayerInventory() {
|
||||
Block block = mock(Block.class);
|
||||
Player player = mock(Player.class);
|
||||
ItemStack reservedTool = mock(ItemStack.class);
|
||||
ItemStack capturedTool = mock(ItemStack.class);
|
||||
ItemStack drop = mock(ItemStack.class);
|
||||
Collection<ItemStack> expected = List.of(drop);
|
||||
when(reservedTool.clone()).thenReturn(capturedTool);
|
||||
when(block.getDrops(capturedTool)).thenReturn(expected);
|
||||
RoutedBlockBreakEvent event = new RoutedBlockBreakEvent(new RoutedBlockBreakEvent.Options(
|
||||
block, player, mock(FellingRun.class), mock(TreeFellerSVC.class), reservedTool));
|
||||
|
||||
reservedTool.setType(Material.AIR);
|
||||
|
||||
assertSame(expected, event.captureNativeDrops());
|
||||
verify(reservedTool).clone();
|
||||
verify(block).getDrops(capturedTool);
|
||||
verify(block, never()).getDrops(reservedTool);
|
||||
verifyNoInteractions(player);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user