本文整理汇总了Java中org.bukkit.TravelAgent.setSearchRadius方法的典型用法代码示例。如果您正苦于以下问题:Java TravelAgent.setSearchRadius方法的具体用法?Java TravelAgent.setSearchRadius怎么用?Java TravelAgent.setSearchRadius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.TravelAgent
的用法示例。
在下文中一共展示了TravelAgent.setSearchRadius方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPortalEvent
import org.bukkit.TravelAgent; //导入方法依赖的package包/类
/**
* When a portal event happends
*
* @param entityPortalEvent the portal event
*/
@EventHandler
public void onPortalEvent(PlayerPortalEvent entityPortalEvent)
{
//if we're enabled
if(isEnabled()) {
//create a travel agent for the portal
TravelAgent ta = entityPortalEvent.getPortalTravelAgent();
//if they're in the nether
if(entityPortalEvent.getPlayer().getWorld().getEnvironment() == World.Environment.NETHER) {
//set data from the nether
ta.setCanCreatePortal(config.getBoolean("PortalRanges.from_nether.allowed"));
ta.setCreationRadius(config.getInt("PortalRanges.from_nether.creation_radius"));
ta.setSearchRadius(config.getInt("PortalRanges.from_nether.search_radius"));
} else {
//set the data to the nether
ta.setCanCreatePortal(config.getBoolean("PortalRanges.to_nether.allowed"));
ta.setCreationRadius(config.getInt("PortalRanges.to_nether.creation_radius"));
ta.setSearchRadius(config.getInt("PortalRanges.to_nether.search_radius"));
}
}
}
示例2: createPortal
import org.bukkit.TravelAgent; //导入方法依赖的package包/类
public static Location createPortal(Location targetLoc, int radius, TravelAgent travelAgent) {
travelAgent.setCanCreatePortal(true);
travelAgent.setCreationRadius(radius);
travelAgent.setSearchRadius(radius);
if (travelAgent.createPortal(targetLoc)) {
return travelAgent.findPortal(targetLoc);
} else {
return null;
}
}