本文整理汇总了Java中com.massivecraft.massivecore.ps.PS.getChunkZ方法的典型用法代码示例。如果您正苦于以下问题:Java PS.getChunkZ方法的具体用法?Java PS.getChunkZ怎么用?Java PS.getChunkZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.massivecraft.massivecore.ps.PS
的用法示例。
在下文中一共展示了PS.getChunkZ方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertPSToRanges
import com.massivecraft.massivecore.ps.PS; //导入方法依赖的package包/类
/**
* Converts a Set of MassiveCraft {@link PS}s to {@link ProtectionRange}s.
*/
public List<ProtectionRange> convertPSToRanges(World world, Set<PS> positions, Faction owningFaction) {
List<ProtectionRange> ranges = new ArrayList<>();
for (PS position : positions) {
if (!position.getWorld().equals(world.getName())) {
continue;
}
int x = position.getChunkX();
int z = position.getChunkZ();
ranges.add(new ProtectionRange(owningFaction.getName(), x, z, x, z));
}
return ranges;
}
示例2: isWithinUpdateDistance
import com.massivecraft.massivecore.ps.PS; //导入方法依赖的package包/类
/**
* Are the given chunks close enough that changes in one should notify someone
* in the other?
*/
private boolean isWithinUpdateDistance(PS ps1, PS ps2) {
int x1 = ps1.getChunkX(true);
int x2 = ps2.getChunkX(true);
int z1 = ps1.getChunkZ(true);
int z2 = ps2.getChunkZ(true);
int distX = Math.abs(x1 - x2);
int distZ = Math.abs(z1 - z2);
return distX < trackDistance || distZ < trackDistance;
}