feat(bukkit): 添加新API
This commit is contained in:
@@ -20,9 +20,16 @@ public class BukkitBlockPos extends BallBlockPos {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BukkitBlockPos(@NotNull Block block) {
|
public BukkitBlockPos(@NotNull Block block) {
|
||||||
this(block.getLocation());
|
super(
|
||||||
|
BallAPI.getInstance().getLocalServerId(),
|
||||||
|
block.getWorld().getName(),
|
||||||
|
block.getX(),
|
||||||
|
block.getY(),
|
||||||
|
block.getZ()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("DataFlowIssue")
|
||||||
public BukkitBlockPos(@NotNull Location location) {
|
public BukkitBlockPos(@NotNull Location location) {
|
||||||
super(
|
super(
|
||||||
BallAPI.getInstance().getLocalServerId(),
|
BallAPI.getInstance().getLocalServerId(),
|
||||||
@@ -56,4 +63,20 @@ public class BukkitBlockPos extends BallBlockPos {
|
|||||||
public BukkitLocation toServiceLocation() {
|
public BukkitLocation toServiceLocation() {
|
||||||
return new BukkitLocation(getServerID(), getWorldName(), getX(), getY(), getZ());
|
return new BukkitLocation(getServerID(), getWorldName(), getX(), getY(), getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean equals(@NotNull Block block) {
|
||||||
|
if (!BallAPI.getInstance().isLocalServer(getServerID())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!getWorldName().equals(block.getWorld().getName())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getX() != block.getX()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getY() != block.getY()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return getZ() == block.getZ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,6 +27,7 @@ public class BukkitLocation extends BallLocation {
|
|||||||
this(block.getLocation());
|
this(block.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("DataFlowIssue")
|
||||||
public BukkitLocation(@NotNull Location location) {
|
public BukkitLocation(@NotNull Location location) {
|
||||||
super(
|
super(
|
||||||
BallAPI.getInstance().getLocalServerId(),
|
BallAPI.getInstance().getLocalServerId(),
|
||||||
@@ -64,4 +65,20 @@ public class BukkitLocation extends BallLocation {
|
|||||||
public BukkitBlockPos toBukkitBlockPos() {
|
public BukkitBlockPos toBukkitBlockPos() {
|
||||||
return new BukkitBlockPos(getServerID(), getWorldName(), getBlockX(), getBlockY(), getBlockZ());
|
return new BukkitBlockPos(getServerID(), getWorldName(), getBlockX(), getBlockY(), getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean equals(@NotNull Block block) {
|
||||||
|
if (!BallAPI.getInstance().isLocalServer(getServerID())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!getWorldName().equals(block.getWorld().getName())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getX() != block.getX()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getY() != block.getY()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return getZ() == block.getZ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user