Skip to content

Commit fa2c35b

Browse files
committed
Merge branch 'api5.2' into api6
2 parents 4ced969 + 80356a4 commit fa2c35b

File tree

5 files changed

+74
-13
lines changed

5 files changed

+74
-13
lines changed

gradle/fox.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ ext.repoVersion = ''
44
if (System.env.TRAVIS) {
55
String tempVersion = ''
66
if (System.env.TRAVIS_TAG) {
7-
tempVersion = System.env.TRAVIS_TAG;
7+
tempVersion = System.env.TRAVIS_TAG
88
if (tempVersion.startsWith("v")) {
99
tempVersion = tempVersion.substring(1)
1010
}
11-
tempVersion += "-$System.env.TRAVIS_BUILD_NUMBER"
11+
tempVersion.replaceAll('/', '-')
1212
repoVersion = tempVersion
13+
tempVersion += "-$System.env.TRAVIS_BUILD_NUMBER"
1314
} else {
1415
tempVersion = "$System.env.TRAVIS_BRANCH-SNAPSHOT"
16+
tempVersion.replaceAll('/', '-')
1517
repoVersion = tempVersion
1618
tempVersion += "-$System.env.TRAVIS_BUILD_NUMBER"
1719
}

src/main/java/net/foxdenstudio/sponge/foxcore/plugin/selection/ISelection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
import com.flowpowered.math.vector.Vector3i;
44
import net.foxdenstudio.sponge.foxcore.plugin.util.BoundingBox3;
55
import net.foxdenstudio.sponge.foxcore.plugin.util.IModifiable;
6-
import net.foxdenstudio.sponge.foxcore.plugin.util.IWorldBounded;
6+
import net.foxdenstudio.sponge.foxcore.plugin.util.IWorldlessBounded;
77
import org.spongepowered.api.text.Text;
88

99
import java.util.Optional;
1010

11-
public interface ISelection extends Iterable<Vector3i>, IWorldBounded, IModifiable {
11+
public interface ISelection extends Iterable<Vector3i>, IWorldlessBounded, IModifiable {
1212

1313
Text overview();
1414

src/main/java/net/foxdenstudio/sponge/foxcore/plugin/util/IBounded.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.flowpowered.math.vector.Vector3d;
44
import com.flowpowered.math.vector.Vector3i;
5+
import org.spongepowered.api.world.Location;
56
import org.spongepowered.api.world.World;
67

78
/**
@@ -15,12 +16,20 @@ default boolean contains(Vector3i vec, World world) {
1516
return this.contains(vec.getX(), vec.getY(), vec.getZ(), world);
1617
}
1718

19+
default boolean containsBlock(Location<World> loc){
20+
return this.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), loc.getExtent());
21+
}
22+
1823
boolean contains(double x, double y, double z, World world);
1924

2025
default boolean contains(Vector3d vec, World world) {
2126
return this.contains(vec.getX(), vec.getY(), vec.getZ(), world);
2227
}
2328

29+
default boolean contains(Location<World> loc){
30+
return this.contains(loc.getX(), loc.getY(), loc.getZ(), loc.getExtent());
31+
}
32+
2433
default boolean isInChunk(Vector3i chunk, World world) {
2534
return true;
2635
}
Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,50 @@
11
package net.foxdenstudio.sponge.foxcore.plugin.util;
22

3+
34
import com.flowpowered.math.vector.Vector3d;
45
import com.flowpowered.math.vector.Vector3i;
6+
import org.spongepowered.api.world.Location;
7+
import org.spongepowered.api.world.World;
8+
9+
/**
10+
* Created by Fox on 6/5/2017.
11+
*/
12+
public interface IWorldBounded extends IWorldlessBounded, IBounded {
513

6-
public interface IWorldBounded {
14+
World getWorld();
715

8-
boolean contains(int x, int y, int z);
16+
@Override
17+
default boolean contains(int x, int y, int z, World world) {
18+
return world == this.getWorld() && this.contains(x, y, z);
19+
}
920

10-
default boolean contains(Vector3i vec) {
11-
return this.contains(vec.getX(), vec.getY(), vec.getZ());
21+
@Override
22+
default boolean contains(Vector3i vec, World world) {
23+
return world == this.getWorld() && this.contains(vec);
1224
}
1325

14-
boolean contains(double x, double y, double z);
26+
@Override
27+
default boolean containsBlock(Location<World> loc) {
28+
return loc.getExtent() == this.getWorld() && this.contains(loc.getBlockPosition());
29+
}
1530

16-
default boolean contains(Vector3d vec) {
17-
return this.contains(vec.getX(), vec.getY(), vec.getZ());
31+
@Override
32+
default boolean contains(double x, double y, double z, World world) {
33+
return world == this.getWorld() && this.contains(x, y, z);
1834
}
1935

20-
default boolean isInChunk(Vector3i chunk) {
21-
return true;
36+
@Override
37+
default boolean contains(Vector3d vec, World world) {
38+
return world == this.getWorld() && this.contains(vec);
2239
}
2340

41+
@Override
42+
default boolean contains(Location<World> loc) {
43+
return loc.getExtent() == this.getWorld() && this.contains(loc.getPosition());
44+
}
45+
46+
@Override
47+
default boolean isInChunk(Vector3i chunk, World world) {
48+
return world == this.getWorld() && this.isInChunk(chunk);
49+
}
2450
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package net.foxdenstudio.sponge.foxcore.plugin.util;
2+
3+
import com.flowpowered.math.vector.Vector3d;
4+
import com.flowpowered.math.vector.Vector3i;
5+
6+
public interface IWorldlessBounded {
7+
8+
boolean contains(int x, int y, int z);
9+
10+
default boolean contains(Vector3i vec) {
11+
return this.contains(vec.getX(), vec.getY(), vec.getZ());
12+
}
13+
14+
boolean contains(double x, double y, double z);
15+
16+
default boolean contains(Vector3d vec) {
17+
return this.contains(vec.getX(), vec.getY(), vec.getZ());
18+
}
19+
20+
default boolean isInChunk(Vector3i chunk) {
21+
return true;
22+
}
23+
24+
}

0 commit comments

Comments
 (0)