当前位置: 首页>>代码示例>>Java>>正文


Java ProtectedRegion.getId方法代码示例

本文整理汇总了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;
}
 
开发者ID:gvlfm78,项目名称:BukkitHotels,代码行数:26,代码来源:HotelsAPI.java

示例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;
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:19,代码来源:Utils.java

示例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 "";
}
 
开发者ID:leonardosnt,项目名称:OldBukkit,代码行数:9,代码来源:TerrenosManager.java

示例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;
}
 
开发者ID:gvlfm78,项目名称:BukkitHotels,代码行数:14,代码来源:HotelsAPI.java

示例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;
}
 
开发者ID:gvlfm78,项目名称:BukkitHotels,代码行数:15,代码来源:HotelsAPI.java

示例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;
}
 
开发者ID:gvlfm78,项目名称:BukkitHotels,代码行数:13,代码来源:Hotel.java

示例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));
}
 
开发者ID:MineGaming,项目名称:cubit,代码行数:47,代码来源:CubitDynmap.java

示例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;
}
 
开发者ID:maxikg,项目名称:mongowg,代码行数:5,代码来源:ProcessingProtectedRegion.java

示例9: id

import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
private String id(World world, ProtectedRegion pr) {
    return world.getName() + ";" + pr.getId();
}
 
开发者ID:macalinao,项目名称:cloudgame,代码行数:4,代码来源:Regions.java


注:本文中的com.sk89q.worldguard.protection.regions.ProtectedRegion.getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。