當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。