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


Java ProtectedRegion.getMembers方法代碼示例

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


在下文中一共展示了ProtectedRegion.getMembers方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
 
開發者ID:ddonofrio,項目名稱:libelula,代碼行數:31,代碼來源:WorldGuardManager.java

示例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;
}
 
開發者ID:ddonofrio,項目名稱:libelula,代碼行數:31,代碼來源:WorldGuardManager.java

示例3: delMemberPlayer

import com.sk89q.worldguard.protection.regions.ProtectedRegion; //導入方法依賴的package包/類
public boolean delMemberPlayer(ProtectedRegion pr, String playerName) {
    boolean result = true;
    DefaultDomain dd = pr.getMembers();
    if (dd.contains(playerName)) {
        dd.removePlayer(playerName);
    } else {
        result = false;
    }
    return result;
}
 
開發者ID:ddonofrio,項目名稱:LibelulaProtectionBlocks,代碼行數:11,代碼來源:WorldGuardManager.java

示例4: 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);
}
 
開發者ID:gvlfm78,項目名稱:BukkitHotels,代碼行數:8,代碼來源:HTWorldGuardManager.java

示例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);
}
 
開發者ID:gvlfm78,項目名稱:BukkitHotels,代碼行數:6,代碼來源:HTWorldGuardManager.java

示例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);
}
 
開發者ID:gvlfm78,項目名稱:BukkitHotels,代碼行數:6,代碼來源:HTWorldGuardManager.java

示例7: 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);
}
 
開發者ID:gvlfm78,項目名稱:BukkitHotels,代碼行數:6,代碼來源:HTWorldGuardManager.java


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