mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-15 15:16:06 +01:00
Add tests to validate behavior of non-player causes in multiple regions.
This commit is contained in:
parent
0a735e0146
commit
47cd96a3af
@ -27,6 +27,7 @@
|
||||
import com.sk89q.worldguard.TestPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.domains.DefaultDomain;
|
||||
import com.sk89q.worldguard.protection.association.RegionOverlapAssociation;
|
||||
import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||
import com.sk89q.worldguard.protection.flags.registry.FlagRegistry;
|
||||
@ -168,10 +169,6 @@ public void testPlayer1BuildAccess() {
|
||||
public void testPlayer2BuildAccess() {
|
||||
ApplicableRegionSet appl;
|
||||
|
||||
HashSet<ProtectedRegion> test = new HashSet<>();
|
||||
test.add(courtyard);
|
||||
test.add(fountain);
|
||||
|
||||
// Outside
|
||||
appl = manager.getApplicableRegions(outside);
|
||||
assertTrue(appl.testState(player2, Flags.BUILD));
|
||||
@ -182,4 +179,61 @@ public void testPlayer2BuildAccess() {
|
||||
appl = manager.getApplicableRegions(inFountain);
|
||||
assertTrue(appl.testState(player2, Flags.BUILD));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonPlayerBuildAccessInOneRegion() {
|
||||
ApplicableRegionSet appl;
|
||||
|
||||
HashSet<ProtectedRegion> source = new HashSet<>();
|
||||
source.add(courtyard);
|
||||
RegionOverlapAssociation assoc = new RegionOverlapAssociation(source);
|
||||
|
||||
// Outside
|
||||
appl = manager.getApplicableRegions(outside);
|
||||
assertTrue(appl.testState(assoc, Flags.BUILD));
|
||||
// Inside courtyard
|
||||
appl = manager.getApplicableRegions(inCourtyard);
|
||||
assertTrue(appl.testState(assoc, Flags.BUILD));
|
||||
// Inside fountain
|
||||
appl = manager.getApplicableRegions(inFountain);
|
||||
assertFalse(appl.testState(assoc, Flags.BUILD));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonPlayerBuildAccessInBothRegions() {
|
||||
ApplicableRegionSet appl;
|
||||
|
||||
HashSet<ProtectedRegion> source = new HashSet<>();
|
||||
source.add(fountain);
|
||||
source.add(courtyard);
|
||||
RegionOverlapAssociation assoc = new RegionOverlapAssociation(source);
|
||||
|
||||
// Outside
|
||||
appl = manager.getApplicableRegions(outside);
|
||||
assertTrue(appl.testState(assoc, Flags.BUILD));
|
||||
// Inside courtyard
|
||||
appl = manager.getApplicableRegions(inCourtyard);
|
||||
assertTrue(appl.testState(assoc, Flags.BUILD));
|
||||
// Inside fountain
|
||||
appl = manager.getApplicableRegions(inFountain);
|
||||
assertTrue(appl.testState(assoc, Flags.BUILD));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonPlayerBuildAccessInNoRegions() {
|
||||
ApplicableRegionSet appl;
|
||||
|
||||
HashSet<ProtectedRegion> source = new HashSet<>();
|
||||
RegionOverlapAssociation assoc = new RegionOverlapAssociation(source);
|
||||
|
||||
// Outside
|
||||
appl = manager.getApplicableRegions(outside);
|
||||
assertTrue(appl.testState(assoc, Flags.BUILD));
|
||||
// Inside courtyard
|
||||
appl = manager.getApplicableRegions(inCourtyard);
|
||||
assertFalse(appl.testState(assoc, Flags.BUILD));
|
||||
// Inside fountain
|
||||
appl = manager.getApplicableRegions(inFountain);
|
||||
assertFalse(appl.testState(assoc, Flags.BUILD));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user