本文整理汇总了Java中com.sk89q.worldguard.protection.regions.ProtectedRegion.setMembers方法的典型用法代码示例。如果您正苦于以下问题:Java ProtectedRegion.setMembers方法的具体用法?Java ProtectedRegion.setMembers怎么用?Java ProtectedRegion.setMembers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldguard.protection.regions.ProtectedRegion
的用法示例。
在下文中一共展示了ProtectedRegion.setMembers方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addMembers
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
/**
* Adds a list of members to a region.
*
* @param world World were the region is.
* @param regionName The ID of the region.
* @param playerNames Players to be added.
* @return true on succes, false on failure.
*/
public boolean addMembers(World world, String regionName, String[] playerNames) {
RegionManager rm = wgp.getRegionManager(world);
if (rm == null) {
return false;
}
ProtectedRegion region = rm.getRegion(regionName);
if (region == null) {
return false;
}
DefaultDomain members = region.getMembers();
for (String playerName : playerNames) {
members.addPlayer(playerName);
}
region.setMembers(members);
try {
rm.save();
} catch (ProtectionDatabaseException ex) {
plugin.getLogger().log(Level.SEVERE, "Unexpected failure saving WorldGuard configuration: {0}", ex.toString());
return false;
}
return true;
}
示例2: removeMembers
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
/**
* Removes a list of members from a region.
*
* @param world World were the region is.
* @param regionName The ID of the region.
* @param playerNames Players to be added.
* @return true on succes, false on failure.
*/
public boolean removeMembers(World world, String regionName, String[] playerNames) {
RegionManager rm = wgp.getRegionManager(world);
if (rm == null) {
return false;
}
ProtectedRegion region = rm.getRegion(regionName);
if (region == null) {
return false;
}
DefaultDomain members = region.getMembers();
for (String playerName : playerNames) {
members.removePlayer(playerName);
}
region.setMembers(members);
try {
rm.save();
} catch (ProtectionDatabaseException ex) {
plugin.getLogger().log(Level.SEVERE, "Unexpected failure saving WorldGuard configuration: {0}", ex.toString());
return false;
}
return true;
}
示例3: removeMembers
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
public static void removeMembers(List<UUID> ids, ProtectedRegion r){
DefaultDomain members = r.getMembers();
DefaultDomain toRemove = new DefaultDomain();
ids.forEach(toRemove::addPlayer);
members.removeAll(toRemove);
r.setMembers(members);
}
示例4: setMembers
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
@Override
public void setMembers(ProtectedRegion region, RegionAccessSet regionAccessSet) {
DefaultDomain defaultDomain = buildDomain(regionAccessSet);
if(!region.getMembers().toUserFriendlyString().equals(defaultDomain.toUserFriendlyString())) {
region.setMembers(defaultDomain);
}
}
示例5: addMember
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
public static void addMember(OfflinePlayer p, ProtectedRegion r){
DefaultDomain members = r.getMembers();
members.addPlayer(p.getUniqueId());
r.setMembers(members);
}
示例6: addMembers
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
public static void addMembers(DefaultDomain dd, ProtectedRegion r){
DefaultDomain members = r.getMembers();
members.addAll(dd);
r.setMembers(members);
}
示例7: setMember
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
public static void setMember(UUID uuid, ProtectedRegion r){
DefaultDomain member = new DefaultDomain();
member.addPlayer(uuid);
r.setMembers(member);
}
示例8: setMembers
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
public static void setMembers(ArrayList<UUID> uuids, ProtectedRegion r){
DefaultDomain members = new DefaultDomain();
for(UUID uuid : uuids)
members.addPlayer(uuid);
r.setMembers(members);
}
示例9: removeMember
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
public static void removeMember(UUID id, ProtectedRegion r){
DefaultDomain members = r.getMembers();
members.removePlayer(id);
r.setMembers(members);
}