Java源码示例:com.bekvon.bukkit.residence.containers.Flags

示例1
private boolean playerHas(FlagPermissions permissions, Player player, String name, boolean def) {
    Flags internalFlag = Flags.getFlag(name);
    if (internalFlag == null) {
        Map<String, Boolean> permPlayerMap = permissions.getPlayerFlags(player.getName());
        Map<String, Boolean> permGlobalMap = permissions.getFlags();
        if (permPlayerMap != null) {
            return permPlayerMap.getOrDefault(name, permGlobalMap.getOrDefault(name, def));
        } else {
            return permGlobalMap.getOrDefault(name, def);
        }
    } else {
        return permissions.playerHas(player, internalFlag, def);
    }
}
 
示例2
@Override
public boolean canBuild_i(final Player p, final Location l) {
	final ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(l);
	if (res == null)
		return true; // No claim here
	ResidencePermissions perms = res.getPermissions();
	return perms.playerHas(p, Flags.build, true);
}
 
示例3
public static boolean isSafeZone(Location location) {
    ResidenceInterface manager = ResidenceApi.getResidenceManager();
    if(manager == null) return false;

    ClaimedResidence claim = manager.getByLoc(location);
    if(claim == null) return false;

    ResidencePermissions permissions = claim.getPermissions();
    return !permissions.has(Flags.pvp, true);
}
 
示例4
@Override
public boolean isMember(OfflinePlayer p) {
	return res.getPermissions().playerHas(p.getName(), Flags.build, false);
}
 
示例5
public boolean has(Flags flag, boolean defaultValue) {
    throw new UnsupportedOperationException("Dummy API");
}