本文整理匯總了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();
}