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


Java WGBukkit.getRegionManager方法代码示例

本文整理汇总了Java中com.sk89q.worldguard.bukkit.WGBukkit.getRegionManager方法的典型用法代码示例。如果您正苦于以下问题:Java WGBukkit.getRegionManager方法的具体用法?Java WGBukkit.getRegionManager怎么用?Java WGBukkit.getRegionManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sk89q.worldguard.bukkit.WGBukkit的用法示例。


在下文中一共展示了WGBukkit.getRegionManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import com.sk89q.worldguard.bukkit.WGBukkit; //导入方法依赖的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.bukkit.WGBukkit; //导入方法依赖的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.bukkit.WGBukkit; //导入方法依赖的package包/类
protected String[] get(Event 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(region.getSingle(event))) {
					world = Bukkit.getWorld(a.getName());
					break;
				}

			}
		}
	}

	RegionManager rm = WGBukkit.getRegionManager(world);
	ProtectedRegion pregion = rm.getRegion(region.getSingle(event));
	List<String> list = new ArrayList<String>(pregion.getMembers().getPlayers());

	String[] s = new String[list.size()];
	return (String[]) list.toArray(s);
}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:22,代码来源:ExprAllMembers.java

示例4: get

import com.sk89q.worldguard.bukkit.WGBukkit; //导入方法依赖的package包/类
protected String[] get(Event 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(region.getSingle(event))) {
					world = Bukkit.getWorld(a.getName());
					break;
				}

			}
		}
	}

	RegionManager rm = WGBukkit.getRegionManager(world);
	ProtectedRegion pregion = rm.getRegion(region.getSingle(event));
	List<String> rfl = new ArrayList<String>();

	for (Entry<Flag<?>, Object> ra : pregion.getFlags().entrySet()) {
		rfl.add(ra.getKey().getName());
	}

	String[] s = new String[rfl.size()];
	return (String[]) rfl.toArray(s);
}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:26,代码来源:ExprAllFlagsOfRegion.java

示例5: get

import com.sk89q.worldguard.bukkit.WGBukkit; //导入方法依赖的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

示例6: get

import com.sk89q.worldguard.bukkit.WGBukkit; //导入方法依赖的package包/类
protected String[] get(Event 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(region.getSingle(event))) {
					world = Bukkit.getWorld(a.getName());
					break;
				}

			}
		}
	}

	RegionManager rm = WGBukkit.getRegionManager(world);
	ProtectedRegion pregion = rm.getRegion(region.getSingle(event));
	List<String> list = new ArrayList<String>(pregion.getOwners().getPlayers());

	String[] s = new String[list.size()];
	return (String[]) list.toArray(s);
}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:22,代码来源:ExprAllOwners.java

示例7: execute

import com.sk89q.worldguard.bukkit.WGBukkit; //导入方法依赖的package包/类
protected void execute(Event event) {
	String name = (String) this.name.getSingle(event);
	Location loc1 = (Location) this.loc1.getSingle(event);
	Location loc2 = (Location) this.loc2.getSingle(event);
	World world = (World) this.world.getSingle(event);

	int x1 = loc1.getBlockX();
	int y1 = loc1.getBlockY();
	int z1 = loc1.getBlockZ();

	int x2 = loc2.getBlockX();
	int y2 = loc2.getBlockY();
	int z2 = loc2.getBlockZ();

	Vector p1 = new Vector(x1, y1, z1);
	Vector p2 = new Vector(x2, y2, z2);
	RegionManager regionManager = WGBukkit.getRegionManager(world);
	ProtectedCuboidRegion region = new ProtectedCuboidRegion(name, p1.toBlockVector(), p2.toBlockVector());
	regionManager.addRegion(region);
	try {
		regionManager.save();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:26,代码来源:EffCreateRegion.java

示例8: get

import com.sk89q.worldguard.bukkit.WGBukkit; //导入方法依赖的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

示例9: get

import com.sk89q.worldguard.bukkit.WGBukkit; //导入方法依赖的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

示例10: getRegion

import com.sk89q.worldguard.bukkit.WGBukkit; //导入方法依赖的package包/类
@Override
@Synchronized
public Region getRegion(World world, String name) {
    RegionManager manager = WGBukkit.getRegionManager(world);
    ProtectedRegion rawRegion = manager.getRegion(name);
    if (rawRegion == null) return null;
    if (regionMap.containsKey(rawRegion)) {
        return regionMap.get(rawRegion);
    }
    ProtectedRegionRegion region = new ProtectedRegionRegion(rawRegion, world);
    regionMap.put(rawRegion, region);
    return region;
}
 
开发者ID:TechzoneMC,项目名称:SpawnShield,代码行数:14,代码来源:WorldGuard6Plugin.java

示例11: GGuard

import com.sk89q.worldguard.bukkit.WGBukkit; //导入方法依赖的package包/类
/**
    * @param plugin
    */
   public GGuard(ASkyGrid plugin) {
this.plugin = plugin;
rm = WGBukkit.getRegionManager(ASkyGrid.getGridWorld());
if (Settings.createNether && ASkyGrid.getNetherWorld() != null) {
    rmNether = WGBukkit.getRegionManager(ASkyGrid.getNetherWorld());
}
   }
 
开发者ID:tastybento,项目名称:askygrid,代码行数:11,代码来源:GGuard.java

示例12: execute

import com.sk89q.worldguard.bukkit.WGBukkit; //导入方法依赖的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

示例13: execute

import com.sk89q.worldguard.bukkit.WGBukkit; //导入方法依赖的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

示例14: execute

import com.sk89q.worldguard.bukkit.WGBukkit; //导入方法依赖的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

示例15: execute

import com.sk89q.worldguard.bukkit.WGBukkit; //导入方法依赖的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.addPlayer(((Player) o).getName());
			} else if (mark == 1) {
				owners.addPlayer(((Player) o).getUniqueId());
			} else if (mark == 0) {
				owners.addPlayer(((Player) o).getName());
			}
		} else if ((o instanceof OfflinePlayer)) {
			if (mark == -1) {
				owners.addPlayer(((OfflinePlayer) o).getName());
			} else if (mark == 1) {
				owners.addPlayer(((OfflinePlayer) o).getUniqueId());
			} else if (mark == 0) {
				owners.addPlayer(((OfflinePlayer) o).getName());
			}
		} else {
			owners.addPlayer(o.toString());
		}
	}

	regionManager.getRegion(name).setOwners(owners);
	try {
		regionManager.save();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:57,代码来源:EffAddOwner.java


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