當前位置: 首頁>>代碼示例>>Java>>正文


Java RegionManager.getRegions方法代碼示例

本文整理匯總了Java中com.sk89q.worldguard.protection.managers.RegionManager.getRegions方法的典型用法代碼示例。如果您正苦於以下問題:Java RegionManager.getRegions方法的具體用法?Java RegionManager.getRegions怎麽用?Java RegionManager.getRegions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sk89q.worldguard.protection.managers.RegionManager的用法示例。


在下文中一共展示了RegionManager.getRegions方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: get

import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
protected String[] get(Event event) {
	World world = (World) this.world.getSingle(event);

	RegionManager set = WGBukkit.getRegionManager(world);
	Map<String, ProtectedRegion> regions = set.getRegions();
	List<String> list = new ArrayList<String>(regions.keySet());

	String[] s = new String[list.size()];
	return (String[]) list.toArray(s);
}
 
開發者ID:Sharpjaws,項目名稱:SharpSK,代碼行數:11,代碼來源:ExprAllRegionsInWorld.java

示例2: invalidRegions

import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
public void invalidRegions(Player player, String page) {

		RegionManager worldGuard = wg.getRegionManager(player.getWorld());
		Map < String, ProtectedRegion > regionList = worldGuard.getRegions();


		for (Entry < String, ProtectedRegion > list: regionList.entrySet()) {
			String newList = list.getValue().getId();
			if (!newList.equalsIgnoreCase("__global__")) {

				String owners = list.getValue().getOwners().toPlayersString().trim().replace("uuid:", "");
				ProtectedRegion isChild = list.getValue().getParent();

				if (!owners.contains("server") && owners.isEmpty() && isChild != null) {

					invalidNames.add(newList);

				}


			}
		}

		int pageNum = 1;
		if (isInt(page)) {
			pageNum = Integer.parseInt(page);
		}

		if (pageNum == 0) {
			pageNum = 1;
		}

		player.sendMessage(ChatColor.DARK_GRAY + "------------------------------------------------");
		player.sendMessage(ChatColor.RED + "In-Valid Owner Regions List :: Page " + pageNum + " / " + ((invalidNames.size() / 10) + 1));
		player.sendMessage(ChatColor.DARK_GRAY + "------------------------------------------------");

		displayList(player, getPage(invalidNames, pageNum));
		pages.clear();
		if (invalidNames.size() == 0) {
			player.sendMessage(ChatColor.GRAY + "Currently No Invalid Region Owner Names!");
		}
		player.sendMessage(ChatColor.DARK_GRAY + "------------------------------------------------");
		player.sendMessage(ChatColor.RED + "[ " + ChatColor.WHITE + invalidNames.size() + ChatColor.RED + " ]" + ChatColor.RED + " reported invalid owner(s)");
		player.sendMessage(ChatColor.DARK_GRAY + "------------------------------------------------");

		invalidNames.clear();

	}
 
開發者ID:fahlur,項目名稱:InactiveRegions,代碼行數:49,代碼來源:main.java

示例3: inactiveRegions

import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public void inactiveRegions(Player player, String page) {
	RegionManager worldGuard = wg.getRegionManager(player.getWorld());
	Map < String, ProtectedRegion > regionList = worldGuard.getRegions();


	for (Entry < String, ProtectedRegion > list: regionList.entrySet()) {
		String newList = list.getValue().getId();
		if (!newList.equalsIgnoreCase("__global__")) {


			String owners = list.getValue().getOwners().toPlayersString().trim().replace("uuid:", "");

			ProtectedRegion isChild = list.getValue().getParent();

			if (owners != null && !owners.isEmpty() && isChild == null) {

				if (!owners.contains(",")) {
					if (!isUUID(owners)) {
						owners = list.getValue().getOwners().toPlayersString().trim().replace("name:", "");
						owners = Bukkit.getServer().getOfflinePlayer(owners).getUniqueId().toString();
					}

					long maxInactiveDays = 7776000000L;
					OfflinePlayer getPlayer = Bukkit.getServer().getOfflinePlayer(UUID.fromString(owners));
					if (ess3.getUser(getPlayer) != null) {


						long lastLogout = ess3.getUser(getPlayer).getLastLogout();
						long lastLogin = ess3.getUser(getPlayer).getLastLogin();

						for (String parent: WhiteList().getConfigurationSection("whitelist").getKeys(false)) {
							Whitelisted.add(parent);
						}
						if (!Whitelisted.contains(getPlayer.getName().toString())) {
							if (lastLogout > lastLogin) {
								long difference = lastLogout + maxInactiveDays;
								if (System.currentTimeMillis() > difference) {
									oNames.add(newList);
								}
							}
						}
						Whitelisted.clear();
					}
				}
			}
		}
	}

	int pageNum = 1;
	if (isInt(page)) {
		pageNum = Integer.parseInt(page);
	}

	if (pageNum == 0) {
		pageNum = 1;
	}

	player.sendMessage(ChatColor.DARK_GRAY + "------------------------------------------------");
	player.sendMessage(ChatColor.RED + " In-Active Owner Region(s) List :: Page " + pageNum + " / " + ((oNames.size() / 10) + 1));
	player.sendMessage(ChatColor.DARK_GRAY + "------------------------------------------------");


	displayList(player, getPage(oNames, pageNum));
	pages.clear();
	if (oNames.size() == 0) {
		player.sendMessage(ChatColor.GRAY + "There are currently no inactive regions!");
	}
	player.sendMessage(ChatColor.DARK_GRAY + "------------------------------------------------");
	player.sendMessage(ChatColor.RED + "[ " + ChatColor.WHITE + oNames.size() + ChatColor.RED + " ]" + ChatColor.RED + " reported in-active owner(s)");
	player.sendMessage(ChatColor.DARK_GRAY + "------------------------------------------------");

	oNames.clear();

}
 
開發者ID:fahlur,項目名稱:InactiveRegions,代碼行數:76,代碼來源:main.java

示例4: isRegionThere

import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
private boolean isRegionThere(Player checkPlayer) {
	
	if(SimpleTownsXtras.permission.playerHas(checkPlayer, "SimpleTownsXtras.WorldGuard.canclaimall")) {
		return false;
	}
	
	World world = checkPlayer.getWorld();
	
	Chunk chunk = world.getChunkAt( checkPlayer.getLocation() );
		
	int minChunkX = chunk.getX() << 4;
	int minChunkZ = chunk.getZ() << 4;
	int maxChunkX = minChunkX + 15;
	int maxChunkZ = minChunkZ + 15;
	
	int worldHeight = world.getMaxHeight();

	BlockVector minChunk = new BlockVector( minChunkX, 0, minChunkZ );
	BlockVector maxChunk = new BlockVector( maxChunkX, worldHeight, maxChunkZ );
	
	RegionManager regionManager = worldGuardPlugin.getRegionManager( world );
	
	ProtectedCuboidRegion region = new ProtectedCuboidRegion( "__simpletownsxtras__checkregion", minChunk, maxChunk );
	
	Map<String, ProtectedRegion> allregions = regionManager.getRegions(); 
	
	List<ProtectedRegion> allregionslist = new ArrayList<ProtectedRegion>( allregions.values() );
	
	List<ProtectedRegion> overlaps;
	
	boolean foundregions = false;
	
	try {
		overlaps = region.getIntersectingRegions( allregionslist );
		if( overlaps == null || overlaps.isEmpty() ) {
			foundregions = false;
		} else {
			for(ProtectedRegion currentRegion : overlaps) {
				
				if(!currentRegion.getMembers().contains(checkPlayer.getName()) && !currentRegion.getOwners().contains(checkPlayer.getName())) {
					
					// Is it claimable?
					if(!SimpleTownsXtras.permission.playerHas(checkPlayer, "SimpleTownsXtras.WorldGuard.claimable." + currentRegion.getId().toLowerCase())) {
						foundregions = true;
					}
				}
			}
		}
		
	} catch ( Exception ex ) {
		ex.printStackTrace();
	}
	
	region = null;
	allregionslist = null;
	overlaps = null;
	
	return foundregions;
}
 
開發者ID:markhughes,項目名稱:SimpleTowns-xtras,代碼行數:60,代碼來源:WorldGuardListener.java


注:本文中的com.sk89q.worldguard.protection.managers.RegionManager.getRegions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。