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


Java RegionManager.hasRegion方法代碼示例

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


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

示例1: execute

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

	RegionManager regionManager = WGBukkit.getRegionManager(world);
	if (!regionManager.hasRegion(name)) {
		Skript.error("Region \"" + name + "\" in world \"" + world.getName() + "\" does not exists.");
		return;
	}

	regionManager.removeRegion(name, RemovalStrategy.REMOVE_CHILDREN);
	try {
		regionManager.save();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:Sharpjaws,項目名稱:SharpSK,代碼行數:18,代碼來源:EffDeleteRegion.java

示例2: execute

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

	RegionManager regionManager = WGBukkit.getRegionManager((org.bukkit.World) world);
	if (!regionManager.hasRegion(name)) {
		Skript.error("Region \"" + name + "\" in world \"" + world.getName() + "\" does not exists.");
		return;
	}

	Vector v1 = regionManager.getRegion(name).getMaximumPoint();
	Vector v2 = regionManager.getRegion(name).getMinimumPoint();
	Region region = new CuboidRegion(v1, v2);
	BaseBlock b = new BaseBlock(block.getTypeId(), block.getData().getData());

	EditSession es = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1);
	try {
		es.setBlocks(region, b);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:Sharpjaws,項目名稱:SharpSK,代碼行數:24,代碼來源:EffSetBlocks.java

示例3: get

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

	RegionManager regionManager = WGBukkit.getRegionManager(world);
	if (!regionManager.hasRegion(name)) {
		Skript.error("Region \"" + name + "\" in world \"" + world.getName() + "\" does not exists.");
		return null;
	}

	double x = regionManager.getRegion(name).getMaximumPoint().getX();
	double y = regionManager.getRegion(name).getMaximumPoint().getY();
	double z = regionManager.getRegion(name).getMaximumPoint().getZ();

	Location pos1 = new Location(world, x, y, z);

	return new Location[] { pos1 };
}
 
開發者ID:Sharpjaws,項目名稱:SharpSK,代碼行數:19,代碼來源:ExprGetPoint2.java

示例4: get

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

	RegionManager regionManager = WGBukkit.getRegionManager(world);
	if (!regionManager.hasRegion(name)) {
		Skript.error("Region \"" + name + "\" in world \"" + world.getName() + "\" does not exists.");
		return null;
	}

	double x = regionManager.getRegion(name).getMinimumPoint().getX();
	double y = regionManager.getRegion(name).getMinimumPoint().getY();
	double z = regionManager.getRegion(name).getMinimumPoint().getZ();

	Location pos1 = new Location(world, x, y, z);

	return new Location[] { pos1 };
}
 
開發者ID:Sharpjaws,項目名稱:SharpSK,代碼行數:19,代碼來源:ExprGetPoint1.java

示例5: praseWGRegion

import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
private ProtectedRegion praseWGRegion(final World world, final int valueX, final int valueZ) {
    RegionManager manager = plugin.getWorldGuardPlugin().getRegionManager(world);
    String serverName = buildLandName(LandTypes.SERVER.toString(), valueX, valueZ);
    String shopName = buildLandName(LandTypes.SHOP.toString(), valueX, valueZ);
    String worldName = buildLandName(world.getName(), valueX, valueZ);
    if (manager.hasRegion(serverName)) {
        return manager.getRegion(serverName);

    } else if (manager.hasRegion(shopName)) {
        return manager.getRegion(shopName);

    } else if (manager.hasRegion(worldName)) {
        return manager.getRegion(worldName);

    }
    return null;
}
 
開發者ID:MineGaming,項目名稱:cubit,代碼行數:18,代碼來源:CubitregionManager.java

示例6: getAccountHolder

import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
@Override
public WorldGuardAccountHolder getAccountHolder(String id) {
    // FIXME use something more robust than - as world-id delimiter
    // try explicit world+id first 
    String[] parts = id.split("-", 2);
    if (parts.length == 2) {
        WorldGuardAccountHolder wgah = getAccountHolder(parts[0], parts[1]);
        if (wgah != null) return wgah;
    }

    // try bare id in all worlds
    GlobalRegionManager manager = plugin.getGlobalRegionManager();
    for (World world: Bukkit.getWorlds()) {
        RegionManager worldManager = manager.get(world);
        if (worldManager.hasRegion(id)) {
            ProtectedRegion region = worldManager.getRegion(id);
            return new WorldGuardAccountHolder(world.getName(), region);
        }
    }

    return null;
}
 
開發者ID:sakunc,項目名稱:Gringotts-,代碼行數:23,代碼來源:WorldGuardHandler.java

示例7: addRegion

import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
/**
 * Criar uma nova região no WorldGuard
 *
 * @param name O nome da nova região
 * @param center O lugar central dela (para ser baseado o tamanho)
 * @param larg Um número inteiro para representar a largura
 * @param comp Um número inteiro para representar o comprimento
 * @param priority A prioridade da região
 * @return Retorna a região que foi criada se for criada com sucesso. Se já houver uma região com esse nome OU houver uma falha, retorna null.
 */
@Nullable
public static ProtectedRegion addRegion ( final String name, final Location center, final int larg, final int comp, final int priority )
{
	Preconditions.checkArgument( center.getWorld().getName().equalsIgnoreCase( center.getWorld().getName() ), "Worlds not same!" );
	Location prim = new Location( center.getWorld(), center.getBlockX() + larg, center.getBlockY(), center.getBlockZ() );
	Location sec = new Location( center.getWorld(), center.getBlockX() - comp, center.getBlockY(), center.getBlockZ() - comp );
	prim = Framework.getMinimumPoint( prim, sec );
	sec = Framework.getMaximumPoint( prim, sec );
	final WorldGuardPlugin plugin = ( WorldGuardPlugin ) Framework.worldguard;
	final RegionManager rm = plugin.getRegionManager( center.getWorld() );
	if ( rm.hasRegion( name ) )
	{
		return null;
	}
	else
	{
		final ProtectedCuboidRegion cuboid = new ProtectedCuboidRegion( name, Framework.getWorldEditVector( prim ), Framework.getWorldEditVector( sec ) );
		cuboid.setPriority( priority );
		rm.addRegion( cuboid );
		return cuboid;
	}
}
 
開發者ID:ProjectSandstone,項目名稱:EventoZero,代碼行數:33,代碼來源:Framework.java

示例8: spatial_remove

import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
public boolean spatial_remove(final ABPortal portal) {
    final SafeLocation location = portal.getLocation();
    if ( location == null )
        return true;

    final HashSet<UUID> portals = worldPortals.get(location.getWorldId());
    if ( portals != null && portals.contains(portal.uid) )
        portals.remove(portal.uid);

    final World world = location.getWorld();
    if ( world == null )
        return true;

    final RegionManager rm = wg.getRegionManager(world);
    if ( rm == null )
        return true;

    final String key = "abyss-" + portal.uid.toString();
    if ( rm.hasRegion(key) )
        rm.removeRegion(key);

    return true;
}
 
開發者ID:stendec,項目名稱:Abyss,代碼行數:24,代碼來源:WorldGuardManager.java

示例9: isValidRegion

import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
public boolean isValidRegion(final World world, final int valueX, final int valueZ) {

        RegionManager manager = plugin.getWorldGuardPlugin().getRegionManager(world);
        String serverName = buildLandName(LandTypes.SERVER.toString().toLowerCase(), valueX, valueZ);
        String shopName = buildLandName(LandTypes.SHOP.toString().toLowerCase(), valueX, valueZ);
        String worldName = buildLandName(world.getName().toLowerCase(), valueX, valueZ);
        if (manager.hasRegion(serverName)) {
            return true;
        } else if (manager.hasRegion(shopName)) {
            return true;
        } else if (manager.hasRegion(worldName)) {
            return true;
        }
        return false;
    }
 
開發者ID:MineGaming,項目名稱:cubit,代碼行數:16,代碼來源:CubitregionManager.java

示例10: noOrOldRegion

import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
private static boolean noOrOldRegion(RegionManager regionManager, String regionId, IslandInfo island) {
    if (!regionManager.hasRegion(regionId)) {
        return true;
    }
    if (regionManager.getRegion(regionId).getOwners().size() == 0) {
        return true;
    }
    return !island.getRegionVersion().equals(getVersion());
}
 
開發者ID:rlf,項目名稱:uSkyBlock,代碼行數:10,代碼來源:WorldGuardHandler.java

示例11: islandLock

import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
public static void islandLock(final CommandSender sender, final String islandName) {
    try {
        RegionManager regionManager = getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld());
        if (regionManager.hasRegion(islandName + "island")) {
            ProtectedRegion region = regionManager.getRegion(islandName + "island");
            updateLockStatus(region, true);
            sender.sendMessage(tr("\u00a7eYour island is now locked. Only your party members may enter."));
        } else {
            sender.sendMessage(tr("\u00a74You must be the party leader to lock your island!"));
        }
    } catch (Exception ex) {
        LogUtil.log(Level.SEVERE, "ERROR: Failed to lock " + islandName + "'s Island (" + sender.getName() + ")", ex);
    }
}
 
開發者ID:rlf,項目名稱:uSkyBlock,代碼行數:15,代碼來源:WorldGuardHandler.java

示例12: islandUnlock

import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
public static void islandUnlock(final CommandSender sender, final String islandName) {
    try {
        RegionManager regionManager = getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld());
        if (regionManager.hasRegion(islandName + "island")) {
            ProtectedRegion region = regionManager.getRegion(islandName + "island");
            updateLockStatus(region, false);
            sender.sendMessage(tr("\u00a7eYour island is unlocked and anyone may enter, however only you and your party members may build or remove blocks."));
        } else {
            sender.sendMessage(tr("\u00a74You must be the party leader to unlock your island!"));
        }
    } catch (Exception ex) {
        LogUtil.log(Level.SEVERE, "ERROR: Failed to unlock " + islandName + "'s Island (" + sender.getName() + ")", ex);
    }
}
 
開發者ID:rlf,項目名稱:uSkyBlock,代碼行數:15,代碼來源:WorldGuardHandler.java

示例13: execute

import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
protected void execute(Event event) {
	String name = (String) this.name.getSingle(event);
	World world = (World) this.world.getSingle(event);
	if (world == null) {
		for (RegionManager a : WGBukkit.getPlugin().getRegionContainer().getLoaded()) {
			for (Entry<String, ProtectedRegion> b : a.getRegions().entrySet()) {
				if (b.getKey().equals(name)) {
					world = Bukkit.getWorld(a.getName());
					break;
				}

			}
		}

	}

	RegionManager regionManager = WGBukkit.getRegionManager(world);
	if (!regionManager.hasRegion(name)) {
		Skript.error("Region \"" + name + "\" in world \"" + world.getName() + "\" does not exists.");
		return;
	}
	DefaultDomain members = regionManager.getRegion(name).getMembers();
	Object[] arrayOfObject;
	int j = (arrayOfObject = this.players.getArray(event)).length;
	for (int i = 0; i < j; i++) {

		Object o = arrayOfObject[i];
		if ((o instanceof Player)) {

			if (mark == -1) {
				members.addPlayer(((Player) o).getName());
			} else if (mark == 1) {
				members.addPlayer(((Player) o).getUniqueId());
			} else if (mark == 0) {
				members.addPlayer(((Player) o).getName());
			}

		} else if ((o instanceof OfflinePlayer)) {
			if (mark == -1) {
				members.addPlayer(((OfflinePlayer) o).getName());
			} else if (mark == 1) {
				members.addPlayer(((OfflinePlayer) o).getUniqueId());
			} else if (mark == 0) {
				members.addPlayer(((OfflinePlayer) o).getName());
			}

		} else {
			members.addPlayer(o.toString());
		}
	}

	regionManager.getRegion(name).setMembers(members);
	try {
		regionManager.save();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:Sharpjaws,項目名稱:SharpSK,代碼行數:59,代碼來源:EffAddMember.java

示例14: execute

import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
protected void execute(Event event) {
	String name = (String) this.name.getSingle(event);
	World world = (World) this.world.getSingle(event);
	if (world == null) {
		for (RegionManager a : WGBukkit.getPlugin().getRegionContainer().getLoaded()) {
			for (Entry<String, ProtectedRegion> b : a.getRegions().entrySet()) {
				if (b.getKey().equals(name)) {
					world = Bukkit.getWorld(a.getName());
					break;
				}

			}
		}

	}

	RegionManager regionManager = WGBukkit.getRegionManager(world);
	if (!regionManager.hasRegion(name)) {
		Skript.error("Region \"" + name + "\" in world \"" + world.getName() + "\" does not exists.");
		return;
	}

	DefaultDomain owners = regionManager.getRegion(name).getOwners();
	Object[] arrayOfObject;
	int j = (arrayOfObject = this.players.getArray(event)).length;
	for (int i = 0; i < j; i++) {
		Object o = arrayOfObject[i];
		if ((o instanceof Player)) {
			if (mark == -1) {
				owners.removePlayer(((Player) o).getName());
			} else if (mark == 1) {
				owners.removePlayer(((Player) o).getUniqueId());
			} else if (mark == 0) {
				owners.removePlayer(((Player) o).getName());
			}
		} else if ((o instanceof OfflinePlayer)) {
			if (mark == -1) {
				owners.removePlayer(((OfflinePlayer) o).getName());
			} else if (mark == 1) {
				owners.removePlayer(((OfflinePlayer) o).getUniqueId());
			} else if (mark == 0) {
				owners.removePlayer(((OfflinePlayer) o).getName());
			}
		} else {
			owners.removePlayer(o.toString());
		}
	}

	regionManager.getRegion(name).setOwners(owners);
	try {
		regionManager.save();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:Sharpjaws,項目名稱:SharpSK,代碼行數:56,代碼來源:EffRemoveOwner.java

示例15: execute

import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
protected void execute(Event event) {
	String name = (String) this.name.getSingle(event);
	World world = (World) this.world.getSingle(event);
	if (world == null) {
		for (RegionManager a : WGBukkit.getPlugin().getRegionContainer().getLoaded()) {
			for (Entry<String, ProtectedRegion> b : a.getRegions().entrySet()) {
				if (b.getKey().equals(name)) {
					world = Bukkit.getWorld(a.getName());
					break;
				}

			}
		}

	}

	RegionManager regionManager = WGBukkit.getRegionManager(world);
	if (!regionManager.hasRegion(name)) {
		Skript.error("Region \"" + name + "\" in world \"" + world.getName() + "\" does not exists.");
		return;
	}

	DefaultDomain members = regionManager.getRegion(name).getMembers();
	Object[] arrayOfObject;
	int j = (arrayOfObject = this.players.getArray(event)).length;
	for (int i = 0; i < j; i++) {
		Object o = arrayOfObject[i];
		if ((o instanceof Player)) {
			if (mark == -1) {
				members.removePlayer(((Player) o).getName());
			} else if (mark == 1) {
				members.removePlayer(((Player) o).getUniqueId());
			} else if (mark == 0) {
				members.removePlayer(((Player) o).getName());
			}
		} else if ((o instanceof OfflinePlayer)) {
			if (mark == -1) {
				members.removePlayer(((OfflinePlayer) o).getName());
			} else if (mark == 1) {
				members.removePlayer(((OfflinePlayer) o).getUniqueId());
			} else if (mark == 0) {
				members.removePlayer(((OfflinePlayer) o).getName());
			}
		} else {
			members.removePlayer(o.toString());
		}
	}

	regionManager.getRegion(name).setMembers(members);
	try {
		regionManager.save();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:Sharpjaws,項目名稱:SharpSK,代碼行數:56,代碼來源:EffRemoveMember.java


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