Skip to content

Commit d307ced

Browse files
author
Jan Kluka
committed
1.9
1 parent e0bbafd commit d307ced

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/test/java/dev/drawethree/xprison/api/enchants/area/PacketMinePolicyTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,22 @@ void nonPerBlockStrategiesUntouched() {
7474
assertEquals(BreakEventStrategy.NONE,
7575
PacketMinePolicy.resolveStrategy("Layer", BreakEventStrategy.NONE));
7676
}
77+
78+
/**
79+
* The core guarantee for servers with no packet-mines plugin: whatever the enchant is configured
80+
* with, and whether or not optimisation is enabled, the strategy is returned untouched. No provider
81+
* is registered in this test (nor in the rest of the suite), so this is the "packet mining disabled"
82+
* configuration.
83+
*/
84+
@Test
85+
@DisplayName("without any provider, every strategy is returned unchanged regardless of the flag")
86+
void noProvidersNeverRewritesAnyStrategy() {
87+
for (boolean optimise : new boolean[]{true, false}) {
88+
PacketMinePolicy.setOptimizeForPacketMines(optimise);
89+
for (BreakEventStrategy s : BreakEventStrategy.values()) {
90+
assertEquals(s, PacketMinePolicy.resolveStrategy("AnyEnchant", s),
91+
"strategy " + s + " must pass through untouched with no provider (optimise=" + optimise + ")");
92+
}
93+
}
94+
}
7795
}

0 commit comments

Comments
 (0)