本文整理汇总了Java中com.wasteofplastic.askyblock.ASkyBlockAPI类的典型用法代码示例。如果您正苦于以下问题:Java ASkyBlockAPI类的具体用法?Java ASkyBlockAPI怎么用?Java ASkyBlockAPI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ASkyBlockAPI类属于com.wasteofplastic.askyblock包,在下文中一共展示了ASkyBlockAPI类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: teleportIsland
import com.wasteofplastic.askyblock.ASkyBlockAPI; //导入依赖的package包/类
/**
* Teleports the player to their sky block island. (Only Available if IslandWorld or ASkyBlock or uSkyBlock is installed).
*
* @param p The player that will be teleported.
* @return Whether the teleport was successful.
*/
public boolean teleportIsland(Player p){
if(VoidSpawn.IslandWorld){
if(IslandWorldApi.haveIsland(p.getName()) || IslandWorldApi.isHelpingIsland(p.getName())){
SimpleIsland island = IslandWorld.getInstance().getPlayerIsland(p);
if(island != null){
return islandWorldTeleport(island, p);
}
island = IslandWorld.getInstance().getHelpingIsland(p);
if(island != null){
return islandWorldTeleport(island, p);
}
}
}else if(VoidSpawn.ASkyBlock){
if(ASkyBlockAPI.getInstance().hasIsland(p.getUniqueId()) || ASkyBlockAPI.getInstance().inTeam(p.getUniqueId())){
Location location = ASkyBlockAPI.getInstance().getHomeLocation(p.getUniqueId());
if(location != null){
p.setFallDistance(0);
p.teleport(location);
return true;
}
Location loc = ASkyBlockAPI.getInstance().getIslandLocation(p.getUniqueId());
p.setFallDistance(0);
if(loc != null){
loc.setY(loc.getWorld().getHighestBlockYAt(loc.getBlockX(), loc.getBlockZ()));
p.teleport(loc);
}else{
p.teleport(ASkyBlockAPI.getInstance().getSpawnLocation());
}
return true;
}
}else if(VoidSpawn.USkyBlock){
uSkyBlockAPI usb = (uSkyBlockAPI) Bukkit.getPluginManager().getPlugin("uSkyBlock");
IslandInfo info = usb.getIslandInfo(p);
if(info.getWarpLocation() != null){
p.setFallDistance(0);
p.teleport(info.getWarpLocation());
return true;
}
if(info.getIslandLocation() != null){
p.setFallDistance(0);
p.teleport(info.getIslandLocation());
return true;
}
}
return false;
}
示例2: isProtected
import com.wasteofplastic.askyblock.ASkyBlockAPI; //导入依赖的package包/类
private boolean isProtected(Player player, Block b) {
Island island = ASkyBlockAPI.getInstance().getIslandAt(b.getLocation());
if (island == null) return false;
if (player.getUniqueId().equals(island.getOwner())) return false;
for (UUID member: island.getMembers()) {
if (player.getUniqueId().equals(member)) return false;
}
return true;
}