本文整理汇总了Java中com.sk89q.worldguard.protection.regions.ProtectedRegion.getId方法的典型用法代码示例。如果您正苦于以下问题:Java ProtectedRegion.getId方法的具体用法?Java ProtectedRegion.getId怎么用?Java ProtectedRegion.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldguard.protection.regions.ProtectedRegion
的用法示例。
在下文中一共展示了ProtectedRegion.getId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRoomAtLocation
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
public static Room getRoomAtLocation(Location loc, String hotelName){
World w = loc.getWorld();
//Get all regions that contain this location point
ApplicableRegionSet regions = HTWorldGuardManager.getRM(w).getApplicableRegions(loc);
for(ProtectedRegion r : regions){
String ID = r.getId();
if(!ID.startsWith("hotel-" + hotelName)) continue;
String roomNum = ID.replaceFirst("\\w+-\\w*-", "");
try{
Integer.parseInt(roomNum);
}
catch(NumberFormatException e){
continue;
}
Room room = new Room(w, hotelName, roomNum);
if(room.exists())
return room;
}
return null;
}
示例2: getRegion
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
/**
* Get the WorldGuard region name for the location specified.
* @param loc
* @return regionName
*/
public static String getRegion(Location loc) {
String name = "__global__";
int priority = -1;
for (ProtectedRegion r : WorldGuardPlugin.inst().getRegionManager(loc.getWorld()).getApplicableRegions(loc)) {
if (r.getPriority() > priority) {
priority = r.getPriority();
name = r.getId();
}
}
return name;
}
示例3: getTerrenoIdByBlock
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
public static String getTerrenoIdByBlock(Block b) {
for (ProtectedRegion pr : wg.getRegionManager(b.getWorld()).getApplicableRegions(b.getLocation())) {
if (pr.getId().contains("-")) {
return pr.getId();
}
}
return "";
}
示例4: getHotelsInWorld
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
public static ArrayList<Hotel> getHotelsInWorld(World w){
ArrayList<Hotel> hotels = new ArrayList<Hotel>();
for(ProtectedRegion r : HTWorldGuardManager.getRegions(w)){
String id = r.getId();
if(id.matches("hotel-\\w+$")){
String name = id.replaceFirst("hotel-", "");
Hotel hotel = new Hotel(w, name);
hotels.add(hotel);
}
}
return hotels;
}
示例5: getHotelAtLocation
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
public static Hotel getHotelAtLocation(Location loc){
World w = loc.getWorld();
//Get all regions that contain this location point
ApplicableRegionSet regions = HTWorldGuardManager.getRM(w).getApplicableRegions(loc);
for(ProtectedRegion r : regions){
String ID = r.getId();
String hotelName = ID.replaceFirst("hotel-", "").replaceAll("-\\d+", "");
Hotel hotel = new Hotel(w, hotelName);
if(hotel.exists()) return hotel;
}
return null;
}
示例6: getRooms
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
public ArrayList<Room> getRooms(){
ArrayList<Room> rooms = new ArrayList<Room>();
for(ProtectedRegion r : HTWorldGuardManager.getRegions(world)){
String id = r.getId();
if(id.matches("hotel-" + name.toLowerCase() + "-\\d+")){
String num = id.replaceFirst("hotel-" + name.toLowerCase() + "-", "");
Room room = new Room(this, num);
rooms.add(room);
}
}
return rooms;
}
示例7: updateRegionMarker
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
void updateRegionMarker(World world, ProtectedRegion region) {
double[] x;
double[] z;
String regionId = region.getId();
LandTypes cubitType = LandTypes.getLandType(regionId);
RegionData regionData = new RegionData(world);
regionData.setWGRegion(region);
boolean hasOwner = false;
if (regionData.getOwnersUUID().length >= 1) {
hasOwner = true;
}
RegionType tn = region.getType();
BlockVector l0 = region.getMinimumPoint();
BlockVector l1 = region.getMaximumPoint();
if (tn == RegionType.CUBOID) {
x = new double[4];
z = new double[4];
x[0] = l0.getX();
z[0] = l0.getZ();
x[1] = l0.getX();
z[1] = l1.getZ() + 1.0;
x[2] = l1.getX() + 1.0;
z[2] = l1.getZ() + 1.0;
x[3] = l1.getX() + 1.0;
z[3] = l0.getZ();
} else {
return;
}
String markerId = world.getName() + "_" + regionId;
AreaMarker m = this.markerSet.findAreaMarker(markerId);
if (m == null) {
m = this.markerSet.createAreaMarker(markerId, regionId, false, world.getName(), x, z, false);
if (m == null)
return;
} else {
m.setCornerLocations(x, z);
m.setLabel(regionId);
}
addStyle(m, regionData, cubitType, hasOwner);
m.setDescription(formatInfoBox(regionData, m, cubitType, hasOwner));
}
示例8: extractParent
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
private static String extractParent(ProtectedRegion region) {
ProtectedRegion parent = region.getParent();
return parent != null ? parent.getId() : null;
}
示例9: id
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
private String id(World world, ProtectedRegion pr) {
return world.getName() + ";" + pr.getId();
}